/* ================================================================
   Urdu Speech Annotator — Premium Dark Theme
   ================================================================ */

:root {
    /* Core palette */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.85);
    --bg-card-hover: rgba(30, 41, 59, 0.9);

    --accent-1: #8b5cf6;
    --accent-2: #6366f1;
    --accent-3: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #8b5cf6, #6366f1);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border: rgba(148, 163, 184, 0.12);
    --border-focus: rgba(139, 92, 246, 0.5);

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Glass effect */
    --glass-bg: rgba(15, 23, 42, 0.75);
    --glass-border: rgba(148, 163, 184, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* Sizing */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 50%);
}

/* ================================================================
   Top Bar
   ================================================================ */

#top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 60px;
    background: rgba(10, 14, 26, 0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-icon {
    font-size: 1.4rem;
    -webkit-text-fill-color: initial;
}

.top-bar-center {
    flex: 1;
    max-width: 400px;
    margin: 0 32px;
}

.progress-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.export-group {
    position: relative;
}

.export-btn {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid var(--accent-1);
    color: var(--accent-3);
    padding: 6px 14px;
    border-radius: var(--radius-xs);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.export-btn:hover {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.export-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #1e293b;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--glass-shadow);
    padding: 6px;
    min-width: 170px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.export-item {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    transition: background 0.15s;
    display: block;
}

.export-item:hover {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-3);
}

.annotator-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.annotator-input {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 6px 10px;
    font-size: 0.85rem;
    font-family: inherit;
    width: 130px;
    transition: border-color 0.2s;
}

.annotator-input:focus {
    outline: none;
    border-color: var(--accent-1);
}

/* ================================================================
   Main Layout
   ================================================================ */

#main-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 60px);
}

.panel-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 84px;
    align-self: start;
    max-height: calc(100vh - 108px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-1) transparent;
}

.panel-right {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ================================================================
   Cards (Glass)
   ================================================================ */

.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(12px);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
    border-color: rgba(139, 92, 246, 0.15);
}

/* ================================================================
   Sample Info
   ================================================================ */

.sample-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sample-id {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--accent-3);
}

.sample-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.annotation-badge {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    font-weight: 600;
}

/* ================================================================
   Audio Player
   ================================================================ */

.audio-label,
.transcript-label,
.shortcuts-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
}

.custom-player {
    display: flex;
    align-items: center;
    gap: 12px;
}

.play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.play-btn:active {
    transform: scale(0.95);
}

.play-btn svg {
    width: 18px;
    height: 18px;
}

.player-track {
    flex: 1;
    height: 6px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.player-progress {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.player-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 80px;
    text-align: right;
}

/* ================================================================
   Transcript
   ================================================================ */

.transcript-text {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 1.3rem;
    line-height: 2.4;
    color: var(--text-primary);
    text-align: right;
    min-height: 60px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border);
}

/* ================================================================
   Navigation
   ================================================================ */

.nav-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
}

.nav-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--accent-1);
    color: var(--accent-3);
}

.nav-btn-small {
    padding: 8px 12px;
}

.jump-controls {
    display: flex;
    gap: 4px;
    margin: 0 auto;
}

.jump-input {
    width: 80px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    text-align: center;
}

.jump-input:focus {
    outline: none;
    border-color: var(--accent-1);
}

/* ================================================================
   Shortcuts
   ================================================================ */

.shortcuts-card {
    padding: 14px 18px;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 12px;
    align-items: center;
}

kbd {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-family: 'Inter', monospace;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    min-width: 32px;
    text-align: center;
}

.shortcuts-grid span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ================================================================
   Form Sections
   ================================================================ */

.form-section {
    margin-bottom: 16px;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.section-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.optional-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ================================================================
   Emotion Chips
   ================================================================ */

.emotion-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.emotion-chip {
    cursor: pointer;
}

.emotion-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.emotion-chip span {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.6);
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    user-select: none;
}

.emotion-chip:hover span {
    border-color: var(--accent-1);
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-primary);
}

.emotion-chip input:checked + span {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--accent-1);
    color: var(--accent-3);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.2);
    font-weight: 600;
}

/* ================================================================
   Scale Rows (1–5)
   ================================================================ */

.scale-row {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.scale-item {
    flex: 1;
    cursor: pointer;
    text-align: center;
}

.scale-item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.scale-item span {
    display: block;
    padding: 12px 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.6);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.2s;
    user-select: none;
}

.scale-item small {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
    user-select: none;
}

.scale-item:hover span {
    border-color: var(--accent-1);
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-primary);
}

.scale-item input:checked + span {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

/* ================================================================
   Confidence Chips
   ================================================================ */

.confidence-row {
    display: flex;
    gap: 12px;
}

.confidence-chip {
    flex: 1;
    cursor: pointer;
}

.confidence-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.confidence-chip span {
    display: block;
    text-align: center;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.6);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    user-select: none;
}

.confidence-chip:hover span {
    border-color: var(--accent-1);
    background: rgba(139, 92, 246, 0.08);
}

.confidence-chip input:checked + span {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--accent-1);
    color: var(--accent-3);
    font-weight: 600;
}

/* ================================================================
   Notes
   ================================================================ */

.notes-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.notes-input:focus {
    outline: none;
    border-color: var(--accent-1);
}

.notes-input::placeholder {
    color: var(--text-muted);
}

/* ================================================================
   Submit
   ================================================================ */

.submit-section {
    position: sticky;
    bottom: 0;
    padding: 20px 0;
    display: flex;
    gap: 12px;
    background: linear-gradient(to top, var(--bg-primary) 60%, transparent);
    padding-top: 40px;
}

.submit-btn {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 32px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent-gradient);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.5);
}

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

.submit-shortcut {
    font-size: 0.75rem;
    opacity: 0.7;
    font-weight: 400;
}

.skip-btn {
    flex: 1;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.skip-btn:hover {
    background: rgba(139, 92, 246, 0.08);
    border-color: var(--accent-1);
    color: var(--accent-3);
}

/* ================================================================
   Toast
   ================================================================ */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    background: var(--success);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.4);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    background: var(--error);
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.4);
}

/* ================================================================
   Utilities
   ================================================================ */

.hidden {
    display: none !important;
}

/* ================================================================
   Scrollbar
   ================================================================ */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* ================================================================
   Responsive
   ================================================================ */

@media (max-width: 900px) {
    #main-content {
        grid-template-columns: 1fr;
    }

    .panel-left {
        position: static;
        max-height: none;
    }

    .scale-row {
        gap: 4px;
    }
}
