/* ===== HablaIP ASR - Dark AI Theme ===== */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #0f1628;
    --bg-card: #131929;
    --bg-card-hover: #1a2236;
    --bg-input: #0d1420;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #06b6d4 100%);
    --accent-gradient-soft: linear-gradient(135deg, rgba(59,130,246,0.15) 0%, rgba(139,92,246,0.15) 50%, rgba(6,182,212,0.15) 100%);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255,255,255,0.08);
    --border-accent: rgba(59,130,246,0.4);
    --shadow-glow: 0 0 30px rgba(59,130,246,0.15);
    --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
    --radius: 12px;
    --radius-lg: 16px;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
}

body {
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(59,130,246,0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139,92,246,0.07) 0%, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

/* ===== HEADER / NAV ===== */
.asr-header {
    background: rgba(10,14,26,0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.asr-header .navbar { padding: 0.75rem 0; }

.asr-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.2rem;
}
.brand-icon { font-size: 1.4rem; }
.brand-text { color: var(--text-primary); }
.brand-accent {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.asr-nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.asr-nav-link:hover { color: var(--text-primary) !important; }

/* ===== FOOTER ===== */
.asr-footer {
    background: rgba(10,14,26,0.9);
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ===== UPLOAD PAGE ===== */
.asr-hero {
    text-align: center;
    padding: 4rem 1rem 2rem;
}
.asr-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--accent-gradient-soft);
    border: 1px solid var(--border-accent);
    border-radius: 99px;
    padding: 0.35rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #93c5fd;
    margin-bottom: 1.5rem;
}
.asr-hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 1rem;
}
.asr-hero h1 .gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.asr-hero p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 520px;
    margin: 0 auto 2.5rem;
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
    max-width: 640px;
    margin: 0 auto;
    border: 2px dashed var(--border-accent);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent-blue);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}
.upload-zone input[type="file"] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.8; }
.upload-zone h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.4rem; }
.upload-zone p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.2rem; }
.upload-formats {
    display: flex; gap: 0.4rem; justify-content: center; flex-wrap: wrap;
}
.fmt-badge {
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.25);
    border-radius: 6px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    color: #93c5fd;
    font-weight: 500;
}

/* ===== SELECTED FILE INFO ===== */
.file-selected {
    max-width: 640px;
    margin: 1rem auto 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: none;
    align-items: center;
    gap: 1rem;
}
.file-selected.visible { display: flex; }
.file-icon-box {
    width: 42px; height: 42px;
    background: var(--accent-gradient-soft);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
}
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 500; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 0.78rem; color: var(--text-muted); }

/* ===== BTN TRANSCRIBE ===== */
.btn-transcribe {
    display: block;
    margin: 1.5rem auto 0;
    max-width: 640px;
    width: 100%;
    padding: 0.9rem 2rem;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px rgba(59,130,246,0.35);
}
.btn-transcribe:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(59,130,246,0.5);
}
.btn-transcribe:disabled {
    opacity: 0.5; cursor: not-allowed; transform: none;
}

/* ===== PROGRESS / STATUS ===== */
.asr-status {
    max-width: 640px;
    margin: 1.2rem auto 0;
    border-radius: var(--radius);
    padding: 0.9rem 1.25rem;
    font-size: 0.9rem;
    display: none;
}
.asr-status.visible { display: block; }
.asr-status.processing {
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.3);
    color: #93c5fd;
}
.asr-status.success {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.3);
    color: #86efac;
}
.asr-status.error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
}
.spinner-inline {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(147,197,253,0.3);
    border-top-color: #93c5fd;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 0.4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== AUDIO LIST ===== */
.asr-list-section {
    max-width: 900px;
    margin: 3rem auto 2rem;
    padding: 0 1rem;
}
.asr-list-section h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.asr-list-section h2::before {
    content: '';
    display: inline-block;
    width: 3px; height: 16px;
    background: var(--accent-gradient);
    border-radius: 2px;
}
.audio-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.audio-card:hover {
    border-color: var(--border-accent);
    background: var(--bg-card-hover);
    transform: translateX(3px);
}
.audio-card-icon {
    width: 44px; height: 44px;
    background: var(--accent-gradient-soft);
    border: 1px solid var(--border-accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex-shrink: 0;
}
.audio-card-info { flex: 1; min-width: 0; }
.audio-card-name { font-weight: 500; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-card-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
.audio-card-status { font-size: 0.8rem; font-weight: 500; }
.status-done { color: #86efac; }
.status-processing { color: #93c5fd; }
.status-error { color: #fca5a5; }
.audio-card-arrow { color: var(--text-muted); font-size: 0.9rem; }

/* ===== MODAL ===== */
.asr-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.asr-modal-backdrop.open { display: flex; }
.asr-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    animation: modalIn 0.25s ease;
}
@keyframes modalIn {
    from { opacity:0; transform: scale(0.95) translateY(10px); }
    to   { opacity:1; transform: scale(1) translateY(0); }
}
.asr-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.asr-modal-title {
    font-weight: 600; font-size: 1rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80%;
}
.btn-modal-close {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    width: 32px; height: 32px;
    cursor: pointer;
    font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; flex-shrink: 0;
}
.btn-modal-close:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.asr-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* LEFT: Player */
.modal-player-panel {
    width: 320px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: rgba(0,0,0,0.2);
}
.waveform-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}
.waveform-visual {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin-bottom: 0.75rem;
}
.wave-bar {
    width: 3px;
    background: var(--accent-gradient);
    border-radius: 2px;
    animation: wavePulse 1.2s ease-in-out infinite;
}
.wave-bar:nth-child(odd)  { animation-delay: 0.1s; }
.wave-bar:nth-child(3n)   { animation-delay: 0.3s; }
@keyframes wavePulse {
    0%, 100% { transform: scaleY(0.4); opacity: 0.5; }
    50%       { transform: scaleY(1);   opacity: 1; }
}
audio {
    width: 100%;
    border-radius: 8px;
    filter: invert(1) hue-rotate(180deg);
    opacity: 0.9;
}
.player-meta { font-size: 0.82rem; color: var(--text-muted); }
.player-meta span { display: block; margin-bottom: 0.2rem; }

/* RIGHT: Timeline */
.modal-timeline-panel {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.modal-timeline-panel::-webkit-scrollbar { width: 6px; }
.modal-timeline-panel::-webkit-scrollbar-track { background: transparent; }
.modal-timeline-panel::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.timeline-header {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.timeline-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    cursor: pointer;
    transition: all 0.2s;
}
.timeline-item:hover, .timeline-item.active {
    border-color: var(--border-accent);
    background: var(--bg-card-hover);
}
.timeline-item.active {
    box-shadow: 0 0 0 1px rgba(59,130,246,0.3);
}
.timeline-time {
    font-size: 0.75rem;
    font-weight: 600;
    color: #60a5fa;
    white-space: nowrap;
    padding-top: 0.1rem;
    min-width: 72px;
}
.timeline-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
}
.timeline-loading {
    display: flex; align-items: center; gap: 0.5rem;
    color: var(--text-muted); font-size: 0.9rem;
    padding: 2rem 0;
    justify-content: center;
}


@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}