/* Base styles */
body {
    font-family: Arial, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    background-color: #121212;
    color: #e0e0e0;
}

h1, h2 { color: #f0f0f0; }

.container {
    background-color: #1e1e1e;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    margin-top: 20px;
}

/* Common button styles */
button {
    background-color: #7289DA;
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

button:hover { background-color: #5f73bc; }
button:disabled { background-color: #4a4a4a; cursor: not-allowed; }

/* Recorder/playback containers */
.recorder-container, .playback-container {
    margin: 20px 0;
    padding: 15px;
    border: 1px solid #333;
    border-radius: 5px;
    background-color: #252525;
}

/* Status and timer */
.status {
    margin: 10px 0;
    font-style: italic;
    color: #b0b0b0;
}

.timer {
    font-size: 24px;
    margin: 10px 0;
    color: #f0f0f0;
}

/* Progress bar */
progress {
    width: 100%;
    height: 10px;
    -webkit-appearance: none;
    appearance: none;
}

progress::-webkit-progress-bar {
    background-color: #333;
    border-radius: 5px;
}

progress::-webkit-progress-value, progress::-moz-progress-bar {
    background-color: #7289DA;
    border-radius: 5px;
}

/* Recording indicator */
.recording-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #ff5252;
    margin-right: 10px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Audio controls */
audio::-webkit-media-controls-panel { background-color: #252525; }
audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display { color: #e0e0e0; }

/* Form inputs */
input[type="text"], input[type="url"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="tel"], textarea, select,
.setting-input, .file-input {
    background-color: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 5px;
    padding: 8px 12px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.setting-input { width: 100%; padding: 10px; border-radius: 4px; }

input:focus, textarea:focus, .setting-input:focus, .file-input:focus {
    border-color: #7289DA;
    outline: none;
    box-shadow: 0 0 3px rgba(114, 137, 218, 0.5);
}

.file-input:focus { box-shadow: 0 0 0 2px rgba(114, 137, 218, 0.3); }
.file-input:hover { border-color: #7289DA; }

select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e0e0e0' d='M6 9L1 4h10'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

textarea, textarea.setting-input {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

textarea.setting-input { min-height: 150px; font-family: monospace; }

/* Ready/save buttons */
.ready-button, .save-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 15px 30px;
    margin: 20px 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.save-button { padding: 10px 20px; border-radius: 4px; font-size: 16px; font-weight: normal; }

.ready-button:hover, .save-button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.save-button:hover { transform: none; box-shadow: none; }

.ready-button:disabled {
    background-color: #4a4a4a;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* File info */
.file-info {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
    font-style: italic;
}

.file-info.loaded { color: #4CAF50; }
.file-info.error { color: #f44336; }

/* Radio buttons */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #e0e0e0;
    transition: color 0.3s;
}

.radio-label:hover { color: #7289DA; }

.radio-label input[type="radio"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #444;
    border-radius: 50%;
    background-color: #2a2a2a;
    cursor: pointer;
    transition: all 0.3s;
}

.radio-label input[type="radio"]:checked {
    border-color: #7289DA;
    background-color: #7289DA;
    box-shadow: inset 0 0 0 3px #2a2a2a;
}

.radio-label input[type="radio"]:hover { border-color: #7289DA; }

/* Tab styles */
.tabs { width: 100%; margin-bottom: 20px; }
.tab-buttons { display: flex; border-bottom: 1px solid #444; }

.tab-button {
    padding: 10px 20px;
    background-color: #2a2a2a;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
    color: #e0e0e0;
    margin: 0 5px;
    border-radius: 5px 5px 0 0;
}

.tab-button:hover { background-color: #3a3a3a; }
.tab-button.active { background-color: #7289DA; color: white; }

.tab-content { display: none; padding: 20px 0; }
.tab-content.active { display: block; }

/* Settings styles */
.settings-container, .credits-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
}

.credits-container { padding: 20px; }

.setting-group { margin-bottom: 20px; }

.setting-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

/* Character info */
.character-info {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #2a2a2a 0%, #333 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #444;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.character-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 20px;
    border: 3px solid #555;
    flex-shrink: 0;
    transition: border-color 0.3s ease;
}

.character-avatar:hover { border-color: #777; }
.character-avatar:not([src]), .character-avatar[src=""] { display: none; }

.character-details { flex-grow: 1; }

.character-details h3 {
    margin: 0;
    color: #fff;
    font-size: 1.3em;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Message styles */
.user-message, .assistant-message {
    margin: 10px 0;
    padding: 10px 15px;
    border-radius: 10px;
    max-width: 80%;
    text-align: left;
    line-height: 1.4;
}

.user-message {
    background-color: #2b5278;
    align-self: flex-end;
    margin-left: auto;
}

.assistant-message {
    background-color: #383838;
    align-self: flex-start;
    margin-right: auto;
}

/* Transcription styles */
#transcriptionResult {
    display: flex;
    flex-direction: column;
    margin-top: 15px;
    border-top: 1px solid #444;
    padding-top: 15px;
}

.transcription-container { margin-top: 30px; }

/* Credits styles */
.credit-item {
    margin-bottom: 30px;
    padding: 15px;
    background-color: #2a2a2a;
    border-radius: 5px;
    border-left: 4px solid #7289DA;
}

.credit-item h3 { margin-top: 0; color: #7289DA; }

.credit-item a {
    color: #7289DA;
    text-decoration: none;
    display: inline-block;
    margin-top: 10px;
    transition: color 0.3s;
}

.credit-item a:hover {
    color: #5a6ebd;
    text-decoration: underline;
}

/* Character Tab Styles */
.character-tab-container {
    max-width: 100%;
    background-color: #1e1e1e;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.character-display {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
    align-items: flex-end;
}

.character-avatar-section {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.character-tab-avatar {
    width: 150px;
    height: 150px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid #444;
    transition: border-color 0.3s;
}

.character-tab-avatar:hover {
    border-color: #777;
}

.avatar-placeholder {
    width: 150px;
    height: 150px;
    border-radius: 10px;
    border: 2px dashed #444;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-style: italic;
    background-color: #252525;
}

.character-fields {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
}

/* Full-width fields that span across the entire character display */
.character-field-group.full-width {
    flex: 1 0 100%;
    width: 100%;
    order: 10;
}

.character-field-group {
    margin-bottom: 15px;
}

.character-fields .character-field-group {
    margin-bottom: 0;
}

.character-fields .character-field-group:first-child {
    margin-bottom: 10px;
}

.character-field-label {
    display: block;
    margin-bottom: 5px;
    color: #f0f0f0;
    font-weight: bold;
    font-size: 14px;
    text-align: left;
}

.character-field-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #444;
    border-radius: 5px;
    background-color: #2a2a2a;
    color: #e0e0e0;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.character-field-input:focus {
    outline: none;
    border-color: #7289DA;
    box-shadow: 0 0 5px rgba(114, 137, 218, 0.3);
}

.character-textarea {
    min-height: 80px;
    resize: vertical;
}

.character-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.apply-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.apply-button:hover {
    background-color: #45a049;
}

.apply-button:disabled {
    background-color: #4a4a4a;
    cursor: not-allowed;
}

.clear-button {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.clear-button:hover {
    background-color: #da190b;
}

/* Responsive design for character tab */
@media (max-width: 768px) {
    .character-display {
        flex-direction: column;
    }
    
    .character-avatar-section {
        flex: none;
        align-self: center;
    }
    
    .character-fields {
        min-width: auto;
    }
    
    .character-field-group.full-width {
        order: unset;
    }
}
