:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --error: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    padding: 20px;
}

/* Background Blob Animations */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: blur(100px);
}

.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.35;
    animation: move 25s infinite alternate ease-in-out;
}

.blob-1 {
    width: 450px;
    height: 450px;
    background: #4f46e5;
    top: -100px;
    left: -150px;
}

.blob-2 {
    width: 550px;
    height: 550px;
    background: #7c3aed;
    bottom: -200px;
    right: -150px;
    animation-delay: -5s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: #2563eb;
    top: 40%;
    left: 60%;
    animation-delay: -10s;
}

@keyframes move {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(120px, 80px) scale(1.15); }
}

/* Container & Smooth Transitions */
.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 40px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6);
    text-align: center;
    transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s;
}

.glass-container.expanded {
    max-width: 850px;
}

header {
    margin-bottom: 30px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo .icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.4));
}

h1 {
    font-size: 2.6rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #a5b4fc, #e9d5ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.95rem;
}

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

/* Developer Portal Card */
.dev-section {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 25px;
    text-align: left;
}

.dev-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.dev-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #f1f5f9;
}

.badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.no-key {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.authorized {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.dev-body p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.key-display-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.key-display-row input {
    flex: 1;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px 14px;
    color: #cbd5e1;
    font-family: monospace;
    font-size: 0.95rem;
    outline: none;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.stats-row strong {
    color: var(--primary);
    font-size: 1rem;
}

.text-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.text-btn:hover {
    color: #818cf8;
}

/* Config panel */
.config-section {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 25px;
    text-align: left;
}

.config-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #e2e8f0;
}

.preset-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.preset-selector label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.preset-selector select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.preset-selector select:focus {
    border-color: var(--primary);
}

.preset-selector select option {
    background: var(--bg-dark);
    color: var(--text-main);
}

/* Sliders */
.sliders-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.slider-label span {
    color: var(--text-main);
}

.slider-group input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: transform 0.1s;
}

.slider-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-group input[type="range"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.slider-group input[type="range"]:disabled::-webkit-slider-thumb {
    background: var(--text-muted);
    cursor: not-allowed;
}

/* Upload Dropzone */
.upload-box {
    border: 2px dashed var(--glass-border);
    border-radius: 20px;
    padding: 50px 30px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
}

.upload-box:hover, .upload-box.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    font-size: 3.2rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.2));
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    margin-top: 15px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -5px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
    padding: 12px 28px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    margin-left: 10px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: var(--text-muted);
}

/* Spinner Processing Card */
.processing-card {
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--glass-border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto 25px;
    animation: spin 1s cubic-bezier(0.55, 0.055, 0.675, 0.19) infinite;
}

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

/* Results Section & Layout */
.result-container {
    text-align: left;
}

.success-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    justify-content: center;
}

.success-icon {
    font-size: 1.8rem;
}

.file-name-info {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 25px;
    word-break: break-all;
}

/* Comparison Metric Cards Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

@media(min-width: 600px) {
    .metrics-grid {
        grid-template-columns: 1fr 1fr;
    }
    .sliders-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.metric-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--glass-border);
}

.metric-card.original {
    border-left: 4px solid var(--error);
}

.metric-card.normalized {
    border-left: 4px solid var(--success);
}

.metric-card h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card.original h4 { color: #fca5a5; }
.metric-card.normalized h4 { color: #6ee7b7; }

.metric-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.metric-row:last-child {
    margin-bottom: 0;
}

.metric-row strong {
    color: var(--text-main);
}

/* Comparison Players */
.players-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.02);
    padding: 20px;
    border-radius: 18px;
    border: 1px solid var(--glass-border);
}

@media(min-width: 600px) {
    .players-container {
        grid-template-columns: 1fr 1fr;
    }
}

.player-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 85px;
    overflow: hidden;
}

.player-wrapper label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.player-wrapper audio {
    width: 100%;
    height: 54px;
    display: block;
    outline: none;
}

/* Chart Wrapper */
.chart-wrapper {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 30px;
    min-width: 0;
}

.chart-wrapper h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #cbd5e1;
}

.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
    overflow: hidden;
}

/* Auth error banner styling */
.auth-error-banner {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.88rem;
    line-height: 1.4;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.25s ease-out;
}

.auth-error-banner.hidden {
    display: none !important;
}

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

.action-buttons {
    text-align: center;
    margin-top: 10px;
}

/* Footer status badge */
footer {
    margin-top: 35px;
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.api-badge {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.support-info {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.support-info a {
    color: var(--primary);
    text-decoration: underline;
    transition: color 0.2s;
}

.support-info a:hover {
    color: #818cf8;
}

#api-status.online { color: #34d399; font-weight: 600; }
#api-status.warning { color: #fbbf24; font-weight: 600; }
#api-status.offline { color: #f87171; font-weight: 600; }

/* Billing Section Styles */
.billing-container {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--glass-border);
}

.billing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tier-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
}

.tier-title strong {
    color: var(--text-main);
    background: linear-gradient(135deg, #a5b4fc, #e9d5ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.quota-text {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px;
    border: 1px solid var(--glass-border);
}

.quota-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #a5b4fc);
    border-radius: 5px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.billing-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-upgrade {
    background: linear-gradient(135deg, var(--success), #34d399);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 4px 15px -3px rgba(16, 185, 129, 0.4);
    transition: all 0.3s;
}

.btn-upgrade:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -3px rgba(16, 185, 129, 0.6);
}

.btn-upgrade:disabled {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.lockout-warning {
    color: var(--error);
    font-size: 0.82rem;
    font-weight: 600;
    animation: pulse 2s infinite;
}

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

/* Locked Upload Dropzone */
.upload-box.disabled-lock {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.02) !important;
    cursor: not-allowed !important;
    position: relative;
    opacity: 0.5;
}

.upload-box.disabled-lock::after {
    content: "🔒 Quota Exhausted - Upload Locked";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.95);
    color: #fca5a5;
    padding: 12px 24px;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 0.95rem;
    font-weight: 600;
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
