/* Zajednički izgled svih playera — isti kao prijemni-player, plus moduli, zaključane lekcije i traka za besplatne */
/* Boje i fontovi dolaze iz /index_files/tokens.css (aliasi --bg-main, --primary, …) */

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

[hidden] { display: none !important; }

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    user-select: none;
}

button { font-family: inherit; }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }

.lesson-btn:focus-visible,
.module-head:focus-visible { outline-offset: -2px; }

.app-shell {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
}

/* ---------------- AUTH GATE ---------------- */

.auth-gate {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.auth-gate-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    color: var(--text-muted);
}

.auth-gate-logo { height: 56px; }

.auth-gate.denied .spinner { display: none; }
.auth-gate.denied p {
    color: var(--text-main);
    font-weight: 600;
}
.auth-gate.denied .auth-gate-inner::after {
    content: "\f023";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 2.4rem;
    color: var(--primary);
    order: 1;
    filter: drop-shadow(0 0 15px var(--primary-glow));
}

.spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ---------------- SIDEBAR ---------------- */

.sidebar {
    width: 340px;
    background-color: var(--sidebar-bg);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-top {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 6px;
}

.brand-logo-img { height: 30px; }

.progress-card {
    background: var(--card-bg);
    padding: 12px 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

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

.card-header b { color: var(--primary); }

.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

#progress-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #ffcf23, #ff8d3a);
    border-radius: 10px;
    box-shadow: 0 0 8px var(--primary-glow);
    transition: width 0.5s ease;
}

.progress-sub {
    display: block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-box input {
    width: 100%;
    padding: 11px 12px 11px 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.search-box input:focus {
    border-color: rgba(255, 176, 32, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.course-nav {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.course-nav::-webkit-scrollbar { width: 6px; }
.course-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }

.lesson-btn {
    width: 100%;
    min-height: var(--tap);
    padding: 12px 14px;
    line-height: 1.35;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 11px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    text-align: left;
    transition: all 0.2s ease;
}

.lesson-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-main); }

.lesson-btn.active-lesson {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: rgba(255, 176, 32, 0.3);
    font-weight: 700;
}

.lesson-btn.completed .status-icon { color: var(--success); }

.lesson-btn.soon { opacity: 0.6; }

.lesson-name { flex: 1; }

.status-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.soon-tag {
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ---------------- GLAVNI SADRŽAJ ---------------- */

.content-area-player {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-main);
    display: flex;
    justify-content: center;
}

.player-wrapper {
    width: 100%;
    max-width: 1000px;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.back-link-player {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 236, 210, 0.16);
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 0.2s, background 0.2s;
}

.back-link-player:hover {
    border-color: rgba(255, 176, 32, 0.5);
    background: rgba(255, 176, 32, 0.06);
}

.user-chip {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip i { color: var(--primary); }

.video-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
}

#vdo-player {
    border: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.video-loader,
.video-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 20px;
    background: radial-gradient(circle at center, #1c1915 0%, #000 75%);
    color: var(--text-muted);
    z-index: 5;
}

.video-empty i {
    font-size: 2.6rem;
    color: var(--primary);
    filter: drop-shadow(0 0 15px var(--primary-glow));
}

.video-empty h2 { color: #fff; font-size: 1.3rem; }
.video-empty p { font-size: 0.9rem; max-width: 380px; line-height: 1.5; }

.content-footer {
    margin-top: 25px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#lesson-title {
    margin-top: 10px;
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) { border-color: rgba(255, 176, 32, 0.4); color: var(--primary); }
.nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.button-glow {
    background: linear-gradient(120deg, #ffcf23, #ff8d3a);
    color: #000;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    height: 48px;
    padding: 0 22px;
    border-radius: var(--r-md);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.button-glow:active:not(:disabled) { transform: scale(0.98); }

.button-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 176, 32, 0.7);
}

.button-glow.is-done {
    background: var(--card-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    box-shadow: none;
}

.button-glow.is-done:hover { color: var(--text-main); transform: none; }

.shortcut-hint {
    margin-top: 28px;
    font-size: 0.78rem;
    color: var(--text-muted);
    opacity: 0.7;
}

kbd {
    font-family: inherit;
    font-size: var(--fs-xs);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
}

/* ---------------- TOAST ---------------- */

.toast {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: toastIn 0.25s ease;
    max-width: calc(100% - 32px);
}

.toast-success { border-color: rgba(94, 224, 160, 0.4); }
.toast-error { border-color: rgba(240, 122, 106, 0.5); color: var(--danger); }

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------------- MOBILNI ---------------- */

.mobile-nav {
    display: none;
    background: var(--sidebar-bg);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.menu-btn {
    width: var(--tap);
    height: var(--tap);
    margin-right: -8px;
    display: grid;
    place-items: center;
    background: none;
    border: none;
    border-radius: var(--r-md);
    color: var(--primary);
    font-size: 1.4rem;
    cursor: pointer;
}

.menu-btn:hover { background: rgba(255, 255, 255, 0.05); }

@media (max-width: 992px) {
    .app-shell { flex-direction: column; }
    .mobile-nav { display: flex; }

    .sidebar {
        position: fixed;
        top: 60px;
        right: -100%;
        width: 100%;
        height: calc(100dvh - 60px);
        transition: right 0.3s ease;
        border-left: none;
    }

    .sidebar.open { right: 0; }
    .desktop-only { display: none; }
    .player-wrapper { padding: 15px; }
    .shortcut-hint { display: none; }
    #lesson-title { font-size: 1.25rem; }
}

@media (max-width: 600px) {
    .actions { width: 100%; }
    .button-glow { flex: 1; justify-content: center; padding: 0 12px; }
    .user-chip { display: none; }
}

/* =========================================================
   Dodaci za ostale playere
   ========================================================= */

/* Moduli (sekcije koje se otvaraju) */

.module-card {
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.module-card.open { border-color: var(--border); }

.module-head {
    width: 100%;
    min-height: var(--tap);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    border-radius: 10px;
}

.module-head:hover { background: rgba(255, 255, 255, 0.04); }

.module-title { flex: 1; min-width: 0; }

.module-check {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: transparent;
    transition: all 0.2s;
}

.module-done .module-check {
    background: var(--success);
    border-color: var(--success);
    color: var(--bg-main);
}

.module-count {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.chevron {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
}

.module-card.open .chevron { transform: rotate(180deg); }

.lesson-list {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 0 8px 8px;
}

.module-card.open .lesson-list { display: flex; }

.lesson-list .lesson-btn {
    padding: 11px 12px;
    font-size: 0.86rem;
    background: transparent;
}

.lesson-list .lesson-btn:hover { background: rgba(255, 255, 255, 0.05); }
.lesson-list .lesson-btn.active-lesson { background: var(--primary-soft); }

/* Zaključana lekcija (besplatni prijemni) */

.lesson-btn.locked { opacity: 0.6; }
.lock-icon { font-size: 0.8rem; opacity: 0.7; }

.video-locked {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 20px;
    background: radial-gradient(circle at center, #1c1915 0%, #000 75%);
    color: var(--text-muted);
    z-index: 5;
}

.video-locked > i {
    font-size: 2.6rem;
    color: var(--primary);
    filter: drop-shadow(0 0 15px var(--primary-glow));
}

.video-locked h2 { color: #fff; font-size: 1.3rem; }
.video-locked p { font-size: 0.9rem; max-width: 380px; line-height: 1.5; }
.video-locked a { text-decoration: none; }

.button-glow:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* Besplatni player — poziv na kupovinu */

.free-bar {
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 18px 22px;
    border-radius: 12px;
    background:
        radial-gradient(400px 160px at 0% 0%, rgba(255, 176, 32, 0.14), transparent 70%),
        var(--card-bg);
    border: 1px solid rgba(255, 176, 32, 0.28);
}

.free-bar div { flex: 1; min-width: 220px; }
.free-bar b { display: block; font-size: 1rem; }
.free-bar span { font-size: 0.88rem; color: var(--text-muted); }
.free-bar a { text-decoration: none; }

@media (max-width: 600px) {
    .free-bar a { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .chevron, .module-check, #progress-fill { transition: none; }
}
