/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Dark Theme Colors */
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f2e;
    --bg-tertiary: #252d3d;
    --bg-hover: #2d3548;
    
    /* Accent Colors */
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    
    /* Text Colors */
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Status Colors */
    --success-bg: #064e3b;
    --success-border: #059669;
    --success-text: #6ee7b7;
    
    --error-bg: #7f1d1d;
    --error-border: #dc2626;
    --error-text: #fca5a5;
    
    --info-bg: #1e3a8a;
    --info-border: #3b82f6;
    --info-text: #93c5fd;
    
    /* Border & Shadow */
    --border-color: #374151;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 32px 20px;
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.header h1 {
    font-size: 36px;
    margin-bottom: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Sections */
.section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.section-title {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

.input-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

.label-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

.file-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input:hover {
    border-color: var(--accent-primary);
}

.file-input::file-selector-button {
    padding: 8px 16px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    margin-right: 12px;
}

.file-input::file-selector-button:hover {
    opacity: 0.9;
}

.file-info {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    display: none;
}

.file-info.active {
    display: block;
}

.file-info strong {
    color: var(--text-primary);
}

.input-field,
.textarea-field,
.select-field {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.input-field:focus,
.textarea-field:focus,
.select-field:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.textarea-field {
    resize: vertical;
    min-height: 120px;
}

.result-textarea {
    min-height: 300px;
    font-family: 'Courier New', monospace;
    line-height: 1.8;
}

.select-field {
    cursor: pointer;
}

/* API Status Badges */
.api-status {
    display: inline-block;
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.api-status.saved {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.api-status.not-saved {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    flex: 1;
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.btn-download {
    width: 100%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    margin-top: 12px;
}

.btn-download:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

/* Status Messages */
.status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.status.error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

.status.info {
    background: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

/* Result Box */
.result-box {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    color: var(--text-primary);
    white-space: pre-wrap;
    line-height: 1.8;
    max-height: 400px;
    overflow-y: auto;
}

.result-box::-webkit-scrollbar {
    width: 8px;
}

.result-box::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.result-box::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.result-box::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Audio Player */
.audio-player {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}

audio {
    width: 100%;
    outline: none;
    border-radius: 8px;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .header {
        padding: 24px 16px;
        margin-bottom: 24px;
    }

    .header h1 {
        font-size: 28px;
    }

    .subtitle {
        font-size: 14px;
    }

    .section {
        padding: 20px 16px;
        margin-bottom: 16px;
    }

    .section-title {
        font-size: 18px;
    }

    .button-group {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    .input-field,
    .textarea-field,
    .select-field {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 24px;
    }

    .section {
        padding: 16px 12px;
    }

    .result-box {
        padding: 16px;
        font-size: 14px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-0 {
    margin-bottom: 0 !important;
}