/* Reset and base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f5f7fa;
    color: #1a1a2e;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Container */
.container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 520px;
    text-align: center;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: #6b7280;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* Upload section */
.upload-section {
    margin-bottom: 1.5rem;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1.5rem;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.upload-label:hover {
    border-color: #6366f1;
    background-color: #f5f3ff;
}

.upload-icon {
    font-size: 2rem;
}

.upload-text {
    font-weight: 600;
    font-size: 1rem;
    color: #374151;
}

.upload-hint {
    font-size: 0.8rem;
    color: #9ca3af;
}

#file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

#file-input:focus + .upload-label,
.upload-label:focus-within {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Disabled upload state */
.upload-section.disabled .upload-label {
    border-color: #e5e7eb;
    background-color: #f9fafb;
    cursor: not-allowed;
    opacity: 0.6;
}

.upload-section.disabled .upload-label:hover {
    border-color: #e5e7eb;
    background-color: #f9fafb;
}

/* Image preview */
.image-preview {
    margin-bottom: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.image-preview img {
    display: block;
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    background: #f9fafb;
}

/* Inline error (validation) */
.error-inline {
    color: #dc2626;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: #fef2f2;
    border-radius: 6px;
    border: 1px solid #fecaca;
}

/* Submit button */
.submit-btn {
    display: inline-block;
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: #6366f1;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    margin-bottom: 1.5rem;
}

.submit-btn:hover:not(:disabled) {
    background: #4f46e5;
}

.submit-btn:disabled {
    background: #c7d2fe;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Loading indicator */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 0;
    margin-bottom: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.status-message {
    font-size: 0.95rem;
    color: #4b5563;
    font-weight: 500;
}

/* Audio section */
.audio-section {
    margin-top: 1rem;
    padding: 1.25rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    text-align: left;
}

.audio-description {
    font-size: 0.9rem;
    color: #166534;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.audio-section audio {
    width: 100%;
}

/* Error section */
.error-section {
    margin-top: 1rem;
    padding: 1.25rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    text-align: left;
}

.error-message {
    color: #991b1b;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.retry-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    background: #ef4444;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.retry-btn:hover {
    background: #dc2626;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    body {
        padding: 0.5rem;
        align-items: flex-start;
    }

    .container {
        padding: 1.5rem 1rem;
        border-radius: 8px;
    }

    h1 {
        font-size: 1.4rem;
    }

    .upload-label {
        padding: 1.5rem 1rem;
    }
}
