/* ============================================
   EI Listen – Article Audio Player
   v1.0.0
   ============================================ */

/* ── Player Container (Dark) ────────────────── */
.eil-player {
    margin: 0 0 24px;
    border-radius: 16px;
    overflow: hidden;
    color: #e2e8f0;
    background: linear-gradient(145deg, #0f172a, #1e293b);
    border: 1px solid rgba(139, 92, 246, 0.2);
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ── Top Section ────────────────────────────── */
.eil-player-top {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px 12px;
}

.eil-player-icon {
    font-size: 32px;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.15));
    border: 1px solid rgba(139, 92, 246, 0.25);
}

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

.eil-player-title {
    font-size: 17px;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 4px;
}

.eil-player-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #94a3b8;
    flex-wrap: wrap;
}

.eil-words::before { content: '📝 '; }
.eil-time::before { content: '⏱ '; }
.eil-time {
    color: #a78bfa;
    font-weight: 600;
}

#eil-status {
    color: #38bdf8;
    font-weight: 600;
}

/* ── Language Selector ──────────────────────── */
.eil-lang-wrap {
    flex-shrink: 0;
}

.eil-lang-select {
    padding: 8px 32px 8px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a78bfa' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all 0.2s;
}

.eil-lang-select:hover,
.eil-lang-select:focus {
    border-color: rgba(139, 92, 246, 0.5);
    background-color: rgba(139, 92, 246, 0.25);
    outline: none;
}

.eil-lang-select option {
    background: #1e293b;
    color: #e2e8f0;
}

/* ── Scrubable Timeline ─────────────────────── */
.eil-scrubber {
    padding: 12px 20px 6px;
    user-select: none;
    -webkit-user-select: none;
}

.eil-scrub-track {
    position: relative;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: height 0.15s;
}

.eil-scrub-track:hover,
.eil-scrubbing .eil-scrub-track {
    height: 12px;
}

.eil-scrub-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #3b82f6, #06b6d4);
    border-radius: 8px;
    transition: width 0.3s ease;
    pointer-events: none;
    background-size: 200% 100%;
    animation: eilShimmer 3s infinite linear;
}

.eil-scrubbing .eil-scrub-fill {
    transition: none; /* instant feedback while dragging */
}

@keyframes eilShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Draggable handle */
.eil-scrub-handle {
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #8b5cf6;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
    pointer-events: none;
    transition: left 0.3s ease, transform 0.15s;
    opacity: 0;
}

.eil-scrub-track:hover .eil-scrub-handle,
.eil-scrubbing .eil-scrub-handle {
    opacity: 1;
}

.eil-scrubbing .eil-scrub-handle {
    transition: left 0s;
    transform: translate(-50%, -50%) scale(1.2);
}

/* Paragraph markers */
.eil-marker {
    position: absolute;
    top: 50%;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: all 0.2s;
}

.eil-scrub-track:hover .eil-marker {
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.35);
    pointer-events: auto;
    cursor: pointer;
}

.eil-marker-active {
    width: 7px;
    height: 7px;
    background: #a78bfa !important;
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.6);
}

/* Labels below scrubber */
.eil-scrub-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 12px;
    color: #64748b;
}

.eil-scrub-current {
    font-weight: 700;
    color: #a78bfa;
    font-variant-numeric: tabular-nums;
}

.eil-scrub-hint {
    font-size: 11px;
    color: #475569;
    opacity: 0;
    transition: opacity 0.2s;
}

.eil-scrub-track:hover ~ .eil-scrub-labels .eil-scrub-hint,
.eil-scrubbing .eil-scrub-hint {
    opacity: 1;
}

/* ── Controls ───────────────────────────────── */
.eil-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px 16px;
    flex-wrap: wrap;
}

.eil-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 50%;
    background: transparent;
    color: #e2e8f0;
    font-size: 18px;
    padding: 0;
}

/* Play button – primary CTA */
.eil-btn-play {
    width: 52px;
    height: 52px;
    font-size: 24px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 18px rgba(139, 92, 246, 0.45);
    border-radius: 50%;
}

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

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

/* Skip / Stop buttons */
.eil-btn-skip,
.eil-btn-stop {
    width: 38px;
    height: 38px;
    font-size: 16px;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.eil-btn-skip:hover,
.eil-btn-stop:hover {
    background: rgba(148, 163, 184, 0.2);
    border-color: rgba(148, 163, 184, 0.3);
}

/* ── Speed Controls ─────────────────────────── */
.eil-speed-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.eil-speed-label {
    font-size: 12px;
    color: #64748b;
    margin-right: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.eil-speed-btn {
    padding: 4px 10px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.eil-speed-btn:hover {
    color: #e2e8f0;
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
}

.eil-speed-btn.eil-speed-active {
    color: #ffffff;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    border-color: #8b5cf6;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

/* ── Loading Spinner ────────────────────────── */
.eil-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: eilSpin 0.7s linear infinite;
}

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

/* ── Paragraph Highlighting ─────────────────── */
.eil-highlight {
    background: rgba(139, 92, 246, 0.12) !important;
    border-left: 3px solid #8b5cf6 !important;
    padding-left: 12px !important;
    border-radius: 4px;
    transition: background 0.3s, border-color 0.3s;
}


/* ═══════════════════════════════════════════════
 * LIGHT THEME
 * ═══════════════════════════════════════════════ */
.eil-player.eil-light {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-color: rgba(139, 92, 246, 0.12);
    color: #1e293b;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.eil-light .eil-player-title { color: #0f172a; }
.eil-light .eil-player-meta { color: #64748b; }
.eil-light .eil-time { color: #7c3aed; }
.eil-light #eil-status { color: #2563eb; }

.eil-light .eil-player-icon {
    background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(59,130,246,0.08));
    border-color: rgba(139,92,246,0.15);
}

.eil-light .eil-lang-select {
    color: #1e293b;
    background-color: rgba(139,92,246,0.06);
    border-color: rgba(139,92,246,0.2);
}
.eil-light .eil-lang-select option { background: #fff; color: #1e293b; }

/* Light scrubber */
.eil-light .eil-scrub-track { background: rgba(0,0,0,0.06); }
.eil-light .eil-scrub-handle { border-color: #7c3aed; }
.eil-light .eil-marker { background: rgba(0,0,0,0.12); }
.eil-light .eil-scrub-track:hover .eil-marker { background: rgba(0,0,0,0.2); }
.eil-light .eil-marker-active { background: #7c3aed !important; }
.eil-light .eil-scrub-current { color: #7c3aed; }
.eil-light .eil-scrub-labels { color: #94a3b8; }
.eil-light .eil-scrub-hint { color: #94a3b8; }

.eil-light .eil-btn { color: #475569; }
.eil-light .eil-btn-play { color: #ffffff !important; }

.eil-light .eil-btn-skip,
.eil-light .eil-btn-stop {
    background: rgba(100,116,139,0.06);
    border-color: rgba(100,116,139,0.12);
}
.eil-light .eil-btn-skip:hover,
.eil-light .eil-btn-stop:hover {
    background: rgba(100,116,139,0.12);
}

.eil-light .eil-speed-label { color: #94a3b8; }
.eil-light .eil-speed-btn { color: #64748b; border-color: rgba(100,116,139,0.15); }
.eil-light .eil-speed-btn:hover { color: #1e293b; background: rgba(139,92,246,0.08); }
.eil-light .eil-speed-btn.eil-speed-active { color: #fff; }

.eil-light .eil-highlight {
    background: rgba(139, 92, 246, 0.06) !important;
    border-left-color: #7c3aed !important;
}


/* ═══════════════════════════════════════════════
 * MOBILE
 * ═══════════════════════════════════════════════ */
@media (max-width: 767px) {
    .eil-player-top {
        flex-wrap: wrap;
        gap: 10px;
    }
    .eil-lang-wrap {
        width: 100%;
    }
    .eil-lang-select {
        width: 100%;
    }
    .eil-controls {
        gap: 6px;
    }
    .eil-speed-wrap {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        margin-top: 6px;
    }
    .eil-btn-play {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    .eil-para-info {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 400px) {
    .eil-speed-btn {
        padding: 4px 7px;
        font-size: 11px;
    }
}
