@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #1f1f35;
    --border-color: rgba(255, 255, 255, 0.06);
    --text-primary: #f1f1f6;
    --text-secondary: #8b8ba3;
    --text-muted: #5a5a72;
    --accent: #f59e0b;
    --accent-purple: #8b5cf6;
    --accent-glow: rgba(245, 158, 11, 0.15);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --gradient-1: linear-gradient(135deg, #f59e0b 0%, #f97316 50%, #ef4444 100%);
    --gradient-2: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow-glow: 0 0 30px rgba(245, 158, 11, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background */
.bg-effects { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-effects .orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.35; animation: float 20s ease-in-out infinite; }
.bg-effects .orb-1 { width: 350px; height: 350px; background: rgba(245, 158, 11, 0.12); top: -100px; right: -80px; }
.bg-effects .orb-2 { width: 250px; height: 250px; background: rgba(139, 92, 246, 0.08); bottom: -60px; left: -60px; animation-delay: -10s; }
@keyframes float {
    0%, 100% { transform: translate(0,0) scale(1); }
    50% { transform: translate(-20px,20px) scale(0.95); }
}

/* ============ LOGIN ============ */
.login-screen {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

.login-box {
    width: 380px;
    max-width: 90vw;
    text-align: center;
    animation: slideUp 0.5s ease-out;
}

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

.login-header .bee-logo {
    font-size: 2.2rem;
    filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.4));
}

.login-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-desc {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 28px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-input {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    text-align: center;
    transition: var(--transition);
    outline: none;
}

.login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-input.shake {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.login-btn {
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--gradient-1);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.35);
}

.login-error {
    color: var(--error);
    font-size: 0.82rem;
    margin-top: 10px;
    min-height: 20px;
}

/* ============ MAIN APP ============ */
.container {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 0 auto;
    padding: 20px 20px 12px;
}

/* Header: inline bee + title */
.header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}

.header .bee-icon {
    font-size: 1.6rem;
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.4));
}

.header h1 {
    font-size: 1.4rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.01em;
}

/* Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}

.card.compact { padding: 16px 18px; }

.card-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-title .icon { font-size: 0.85rem; }

/* Main grid: 2 columns */
.main-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.right-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ============ PROVIDER (merged with status) ============ */
.provider-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.provider-option {
    cursor: pointer;
}

.provider-option input { display: none; }

.provider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius-xs);
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    transition: var(--transition);
}

.provider-option:hover .provider-row {
    border-color: rgba(255, 255, 255, 0.1);
}

.provider-option.selected .provider-row {
    border-color: var(--accent);
    background: rgba(245, 158, 11, 0.05);
}

.provider-logo {
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(139, 92, 246, 0.1);
    flex-shrink: 0;
}

.provider-info { flex: 1; min-width: 0; }

.provider-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.provider-model {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

/* Status dots (inline with provider) */
.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: var(--transition);
}

.status-dot.checking {
    background: var(--warning);
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-dot.error {
    background: var(--error);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

/* ============ UPLOAD ZONE ============ */
.upload-zone {
    border: 2px dashed rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-xs);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(245, 158, 11, 0.02);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(245, 158, 11, 0.05);
}

.upload-zone .upload-icon { font-size: 1.8rem; margin-bottom: 6px; display: block; }
.upload-zone .upload-text { font-size: 0.85rem; font-weight: 500; margin-bottom: 3px; }
.upload-zone .upload-hint { font-size: 0.72rem; color: var(--text-muted); }

/* File info */
.file-info {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(245, 158, 11, 0.04);
    border: 1px solid rgba(245, 158, 11, 0.12);
    border-radius: var(--radius-xs);
    margin-top: 10px;
}

.file-info.visible { display: flex; }
.file-info .file-icon { font-size: 1.4rem; }
.file-info .file-details { flex: 1; min-width: 0; }
.file-info .file-name { font-weight: 600; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info .file-size { font-size: 0.72rem; color: var(--text-secondary); margin-top: 1px; }
.file-info .file-remove {
    width: 28px; height: 28px; border-radius: 50%; border: none;
    background: rgba(239, 68, 68, 0.1); color: var(--error);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; transition: var(--transition);
}
.file-info .file-remove:hover { background: rgba(239, 68, 68, 0.2); }

/* Settings */
.settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-group select {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b8ba3' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
}

.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Submit */
.submit-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--gradient-1);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.35);
}

.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.submit-btn .btn-icon { font-size: 1.1rem; }

/* Processing */
.processing-overlay { display: none; text-align: center; padding: 36px 20px; }
.processing-overlay.visible { display: block; }
.processing-overlay h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.processing-overlay p { color: var(--text-secondary); font-size: 0.82rem; }

.waveform { display: flex; align-items: center; justify-content: center; gap: 3px; height: 28px; margin-bottom: 16px; }
.waveform .bar { width: 3px; border-radius: 3px; background: var(--accent); animation: wave 1.2s ease-in-out infinite; }
.waveform .bar:nth-child(1) { height: 10px; animation-delay: 0s; }
.waveform .bar:nth-child(2) { height: 18px; animation-delay: 0.1s; }
.waveform .bar:nth-child(3) { height: 24px; animation-delay: 0.2s; }
.waveform .bar:nth-child(4) { height: 14px; animation-delay: 0.3s; }
.waveform .bar:nth-child(5) { height: 20px; animation-delay: 0.4s; }
.waveform .bar:nth-child(6) { height: 28px; animation-delay: 0.5s; }
.waveform .bar:nth-child(7) { height: 16px; animation-delay: 0.6s; }
.waveform .bar:nth-child(8) { height: 22px; animation-delay: 0.7s; }
.waveform .bar:nth-child(9) { height: 12px; animation-delay: 0.8s; }
@keyframes wave {
    0%, 100% { transform: scaleY(0.5); opacity: 0.5; }
    50% { transform: scaleY(1); opacity: 1; }
}

/* Results */
.result-card { display: none; animation: slideUp 0.5s ease-out; margin-top: 14px; }
.result-card.visible { display: block; }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.stats-bar { display: flex; gap: 5px; margin-bottom: 14px; flex-wrap: wrap; }
.stat-chip {
    padding: 4px 10px;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.12);
    border-radius: 50px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.srt-preview {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    max-height: 280px;
    overflow-y: auto;
}

.srt-preview pre {
    padding: 14px;
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.srt-preview::-webkit-scrollbar { width: 5px; }
.srt-preview::-webkit-scrollbar-track { background: transparent; }
.srt-preview::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

.action-buttons { display: flex; gap: 8px; margin-top: 12px; }
.action-btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: var(--radius-xs);
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}

.action-btn.primary { background: var(--gradient-1); border: none; color: white; }
.action-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3); }
.action-btn.secondary { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); }
.action-btn.secondary:hover { border-color: var(--text-muted); color: var(--text-primary); }

/* Messages */
.message { display: none; padding: 10px 14px; border-radius: var(--radius-xs); font-size: 0.82rem; font-weight: 500; margin-bottom: 12px; }
.message.visible { display: flex; align-items: center; gap: 8px; }
.message.error { background: var(--error-bg); border: 1px solid rgba(239,68,68,0.2); color: var(--error); }
.message.success { background: var(--success-bg); border: 1px solid rgba(16,185,129,0.2); color: var(--success); }

/* Toast */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    padding: 10px 18px; background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-xs); color: var(--text-primary); font-size: 0.82rem; font-weight: 500;
    z-index: 100; transform: translateY(80px); opacity: 0; transition: var(--transition);
}
.toast.visible { transform: translateY(0); opacity: 1; }

/* Footer */
.footer { text-align: center; padding: 10px; color: var(--text-muted); font-size: 0.7rem; }
.footer a { color: var(--accent); text-decoration: none; }

/* Responsive */
@media (max-width: 700px) {
    .container { padding: 16px 14px 10px; }
    .main-grid { grid-template-columns: 1fr; }
    .settings-row { grid-template-columns: 1fr 1fr; }
    .action-buttons { flex-direction: column; }
    .header h1 { font-size: 1.2rem; }
}
