/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8fafc;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 40px;
    color: #1a202c;
}

header h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    font-weight: 700;
    color: #2d3748;
}

header p {
    font-size: 1rem;
    color: #718096;
}

/* Main Content Area */
main {
    display: grid;
    gap: 24px;
}

section {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

section h2 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 1.25rem;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

/* Upload area styles */
.upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: 6px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease;
    background: #f7fafc;
}

.upload-area:hover {
    border-color: #4299e1;
    background: #ebf8ff;
}

.upload-area.dragover {
    border-color: #4299e1;
    background: #ebf8ff;
}

/* File list styles */
.file-list {
    margin-top: 20px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.file-list h3 {
    margin: 0 0 15px 0;
    color: #2d3748;
    font-size: 1rem;
    font-weight: 600;
}

.file-items {
    margin-bottom: 15px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.file-item:hover {
    border-color: #cbd5e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-weight: 500;
    color: #2d3748;
    font-size: 0.875rem;
}

.file-size {
    color: #718096;
    font-size: 0.75rem;
}

.btn-remove {
    background: #fed7d7;
    color: #742a2a;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background: #feb2b2;
    transform: scale(1.1);
}

.upload-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    color: #4299e1;
}

.upload-hint {
    color: #718096;
    font-size: 0.875rem;
    margin-top: 4px;
}

/* Progress Bar Styles */
.upload-progress {
    margin-top: 16px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: #4299e1;
    width: 0%;
    transition: width 0.3s ease;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #4a5568;
    font-size: 0.875rem;
}

input[type="text"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
    background: white;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.1);
}

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

/* Button Styles */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-transform: none;
    letter-spacing: 0;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #4299e1;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #3182ce;
}

.btn-success {
    background: #38a169;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #2f855a;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #4a5568;
}

/* Result Display Styles */
.upload-result,
.clone-result,
.tts-result {
    margin-top: 16px;
    padding: 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
}

.upload-result.success,
.clone-result.success,
.tts-result.success {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #22543d;
}

.upload-result.error,
.clone-result.error,
.tts-result.error {
    background: #fed7d7;
    border: 1px solid #feb2b2;
    color: #742a2a;
}

/* Voice List Styles */
.voices-list {
    margin-top: 16px;
}

.voice-item {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    transition: background-color 0.2s ease;
}

.voice-item:hover {
    background: #edf2f7;
}

.voice-id {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    color: #718096;
    font-size: 0.75rem;
}

/* Audio Player Styles */
audio {
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: 100%;
}

/* Footer Styles */
footer {
    text-align: center;
    margin-top: 32px;
    color: #718096;
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    section {
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .upload-area {
        padding: 24px 16px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Prompt section */
.prompt-section {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.prompt-section h2 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.25rem;
}

.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: color 0.2s ease;
}

.collapsible-header:hover {
    color: #4a5568;
}

.toggle-icon {
    font-size: 0.875rem;
    transition: transform 0.2s ease;
}

.toggle-icon.rotated {
    transform: rotate(180deg);
}

.section-description {
    color: #718096;
    font-size: 0.875rem;
    margin-bottom: 15px;
    line-height: 1.5;
}

.prompt-upload-area {
    border: 2px dashed #0ea5e9;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background: #f8fafc;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.prompt-upload-area:hover {
    border-color: #0284c7;
    background: #f1f5f9;
}

.prompt-upload-area.dragover {
    border-color: #0284c7;
    background: #e0f2fe;
    transform: scale(1.02);
}

.prompt-upload-area .upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.prompt-upload-area .upload-icon {
    font-size: 2rem;
    color: #0ea5e9;
}

.prompt-upload-area p {
    margin: 0;
    color: #475569;
    font-size: 1rem;
}

.prompt-upload-area .upload-hint {
    font-size: 0.875rem;
    color: #64748b;
}

.prompt-result {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
}

.prompt-result.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.prompt-result.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

/* Slider styles */
.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin-top: 2px;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4f46e5;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4f46e5;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider:hover::-webkit-slider-thumb {
    background: #3730a3;
}

.slider:hover::-moz-range-thumb {
    background: #3730a3;
}


/* Button group styles */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.button-group .btn {
    flex: 1;
}

/* Voice management section */
.voices-section {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.voices-section h2 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.25rem;
}

.voices-section .collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: color 0.2s ease;
    margin-bottom: 15px;
}

.voices-section .collapsible-header:hover {
    color: #4a5568;
}

.voices-section .toggle-icon {
    font-size: 0.875rem;
    transition: transform 0.2s ease;
}

.voices-section .toggle-icon.rotated {
    transform: rotate(180deg);
}

.voices-list {
    margin-top: 15px;
}

.voice-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.voice-id {
    font-weight: 500;
    color: #2d3748;
}

.delete-voice-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.delete-voice-btn:hover {
    background: #dc2626;
}
