/* ==========================================
   RESET VƏ BAZA TƏNZİMLƏMƏLƏRİ
   ========================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #0f172a;
    color: #fff;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ==========================================
   ƏSAS STRUKTUR
   ========================================== */

.dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

/* ==========================================
   ÜST NAVİQASİYA PANELİ
   ========================================== */

.top-navbar {
    height: 70px;
    min-height: 70px;
    background: #1e293b;
    border-bottom: 1px solid #334155;

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 0 30px;

    flex-shrink: 0;
}

.nav-logo {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
}

.nav-logo span {
    color: #3b82f6;
}

.nav-user-zone {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-status-tag {
    background: #064e3b;
    border: 1px solid #10b981;
    color: #10b981;

    padding: 5px 12px;
    border-radius: 20px;

    font-size: 12px;
    font-weight: bold;
}

.user-status-tag.locked {
    background: #7f1d1d;
    border-color: #ef4444;
    color: #ef4444;
}

.user-info {
    font-size: 14px;
    color: #e2e8f0;
}

.logout-link-btn {
    background: #334155;
    color: white;

    text-decoration: none;

    padding: 8px 16px;
    border-radius: 8px;

    font-size: 13px;
    font-weight: bold;

    border: 1px solid #475569;

    transition: all 0.2s;
}

.logout-link-btn:hover {
    background: #ef4444;
    border-color: #f43f5e;
}

/* ==========================================
   DASHBOARD BODY
   ========================================== */

.dashboard-body {
    display: flex;

    flex: 1;

    height: calc(100vh - 70px);
    min-height: 0;

    width: 100%;
}

/* ==========================================
   SOL MENYU PANELİ
   ========================================== */

.left-sidebar {
    width: 260px;
    min-width: 260px;

    background: #1e293b;
    border-right: 1px solid #334155;

    padding: 25px 15px;

    display: flex;
    flex-direction: column;

    gap: 10px;

    flex-shrink: 0;
}

.sidebar-title {
    font-size: 11px;
    font-weight: bold;

    color: #64748b;

    letter-spacing: 1px;

    padding-left: 10px;

    margin-top: 15px;
    margin-bottom: 5px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-item {
    color: #94a3b8;

    text-decoration: none;

    padding: 12px 15px;

    border-radius: 10px;

    font-size: 14px;
    font-weight: 500;

    transition: all 0.2s;

    display: block;
}

.menu-item:hover {
    color: white;
    background: #334155;
}

.menu-item.active {
    color: white;

    background: #2563eb;

    font-weight: bold;

    box-shadow:
        0 4px 12px rgba(37, 99, 235, 0.2);
}

.sidebar-divider {
    height: 1px;

    background: #334155;

    margin: 10px 0;
}

/* ==========================================
   SAĞ ƏSAS KONTENT
   ========================================== */

.main-content {
    flex: 1;

    min-width: 0;
    min-height: 0;

    background: #0f172a;

    padding: 40px;

    overflow-y: auto;

    display: flex;
    flex-direction: column;
    align-items: center;
}

.content-header-title {
    text-align: center;

    margin-bottom: 30px;

    width: 100%;
}

.content-header-title h2 {
    font-size: 26px;

    color: #f8fafc;

    margin-bottom: 8px;
}

.content-header-title p {
    color: #94a3b8;

    font-size: 15px;
}

/* ==========================================
   HEXAGON GRID
   ========================================== */

.subject-container-box {
    max-width: 1000px !important;

    background: transparent !important;

    border: none !important;

    box-shadow: none !important;

    padding: 20px;
}

.hexagon-grid {
    position: relative;

    width: 530px;
    height: 420px;

    margin: 60px auto 0 auto;

    padding-bottom: 80px;
}

.hex {
    width: 150px;
    height: 82.5px;

    background: #1e293b;

    position: absolute;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        filter 0.2s;

    display: flex;

    flex-direction: column;

    justify-content: center;

    align-items: center;

    z-index: 2;
}

.hex::before {
    content: "";

    position: absolute;

    top: -37.5px;
    left: 0;

    width: 0;
    height: 0;

    border-left: 75px solid transparent;
    border-right: 75px solid transparent;

    border-bottom: 37.5px solid #1e293b;

    transition:
        border-bottom-color 0.2s ease;
}

.hex::after {
    content: "";

    position: absolute;

    bottom: -37.5px;
    left: 0;

    width: 0;
    height: 0;

    border-left: 75px solid transparent;
    border-right: 75px solid transparent;

    border-top: 37.5px solid #1e293b;

    transition:
        border-top-color 0.2s ease;
}

/* ==========================================
   HEXAGON POZİSİYALARI
   ========================================== */

.hex:nth-child(1) {
    top: 40px;
    left: 0;
}

.hex:nth-child(2) {
    top: 40px;
    left: 165px;
}

.hex:nth-child(3) {
    top: 40px;
    left: 330px;
}

.hex:nth-child(4) {
    top: 175px;
    left: 82.5px;
}

.hex:nth-child(5) {
    top: 175px;
    left: 247.5px;
}

.hex:nth-child(6) {
    top: 175px;
    left: 412.5px;
}

/* ==========================================
   HEXAGON HOVER
   ========================================== */

.hex:hover {
    transform: scale(1.05);

    z-index: 10;

    filter:
        drop-shadow(
            0 12px 24px
            rgba(59, 130, 246, 0.4)
        );

    background: #1d4ed8 !important;
}

.hex:hover::before {
    border-bottom-color: #1d4ed8 !important;
}

.hex:hover::after {
    border-top-color: #1d4ed8 !important;
}

.hex-icon {
    font-size: 32px;

    z-index: 5;

    position: relative;

    margin-top: -2px;

    pointer-events: none;
}

.hex-txt {
    font-size: 14px;

    font-weight: bold;

    color: #f8fafc;

    text-align: center;

    z-index: 5;

    position: relative;

    margin-top: 6px;

    white-space: nowrap;

    pointer-events: none;
}

.hex-in,
.hex-bg {
    clip-path: none !important;

    transform: none !important;

    width: 100%;
    height: 100%;

    display: contents;
}

/* ==========================================
   VİDEO KARTI
   ========================================== */

.video-container-card {
    width: 100%;
    max-width: 900px;

    background: #1e293b;

    border: 1px solid #334155;

    border-radius: 16px;

    /*
     * Quiz overlay video wrapper daxilindədir.
     * Ona görə kartın overflow-u hidden olmamalıdır.
     */
    overflow: visible;

    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.5);
}

.card-header-bar {
    background: #111827;

    padding: 15px 20px;

    display: flex;

    justify-content: space-between;

    align-items: center;

    border-bottom: 1px solid #334155;

    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.close-lesson-btn {
    background: #7f1d1d;

    color: #f87171;

    border: 1px solid #b91c1c;

    padding: 6px 14px;

    border-radius: 6px;

    cursor: pointer;

    font-weight: bold;

    font-size: 12px;

    transition:
        background 0.2s;
}

.close-lesson-btn:hover {
    background: #b91c1c;
    color: white;
}

/* ==========================================
   ƏSAS VİDEO WRAPPER
   ========================================== */

.video-wrapper-dashboard {
    position: relative;

    width: 100%;

    aspect-ratio: 16 / 9;

    background: #000;

    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;

    /*
     * Overlay video wrapper daxilində düzgün
     * yerləşsin deyə hidden saxlanılır.
     */
    overflow: hidden;
}

#mainMathVideo {
    position: absolute !important;

    top: 0;
    left: 0;

    width: 100% !important;
    height: 100% !important;

    display: block;

    background: #000;
}

/*
 * YouTube iframe-i tam ölçüyə gətiririk.
 */
#mainMathVideo iframe {
    width: 100% !important;
    height: 100% !important;

    border: 0;
}

/* ==========================================
   REJİM SEÇİM MODALI
   ========================================== */

.welcome-modal-overlay {
    position: fixed;

    inset: 0;

    background:
        rgba(15, 23, 42, 0.85);

    display: flex;

    justify-content: center;

    align-items: center;

    z-index: 999999;

    backdrop-filter: blur(8px);
}

.login-wrapper-screen {
    position: fixed;

    inset: 0;

    background: #0f172a;

    display: flex;

    justify-content: center;

    align-items: center;

    z-index: 999999;
}

.welcome-box {
    background: #1e293b;

    border: 1px solid #334155;

    padding: 40px;

    border-radius: 20px;

    text-align: center;

    max-width: 500px;

    width: 90%;

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.6);
}

.login-form input {
    width: 100%;

    padding: 14px;

    margin: 10px 0;

    border-radius: 10px;

    border: 1px solid #475569;

    background: #0f172a;

    color: white;

    outline: none;
}

.login-form input:focus {
    border-color: #3b82f6;

    box-shadow:
        0 0 0 2px
        rgba(59, 130, 246, 0.15);
}

.welcome-buttons {
    display: flex;

    gap: 15px;

    margin-top: 15px;
}

.btn-welcome {
    flex: 1;

    padding: 15px;

    border-radius: 10px;

    border: 1px solid #475569;

    background: #334155;

    color: white;

    cursor: pointer;

    display: flex;

    flex-direction: column;

    align-items: center;

    gap: 5px;
}

.btn-welcome strong {
    font-size: 16px;
}

.btn-welcome span {
    font-size: 12px;

    color: #94a3b8;
}

.btn-welcome.strict:hover {
    background: #1e3a8a;
}

.btn-welcome.relaxed:hover {
    background: #064e3b;
}

/* =========================================================
   İNTERAKTİV QUIZ OVERLAY
   ========================================================= */

/*
 * ƏSAS DÜZƏLİŞ:
 *
 * Overlay artıq sadəcə kiçik bir qutu deyil.
 * Video wrapper-in bütün sahəsini tutur.
 *
 * Beləliklə:
 * YouTube video
 *       ↓
 * quiz overlay
 *       ↓
 * sual videosu
 *       ↓
 * düymələr
 *
 * hamısı idarə olunan layout olur.
 */

.quiz-overlay {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    /*
     * Əsas video tamamilə örtülür.
     */
    background:
        rgba(2, 6, 23, 0.94);

    display: none;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    /*
     * Əvvəlki translate(-50%, -50%) burada lazım deyil.
     */
    transform: none;

    opacity: 0;

    padding: 12px;

    /*
     * Overlay daxilində elementlər heç vaxt
     * wrapper-dan kənara çıxmasın.
     */
    overflow: auto;

    overscroll-behavior: contain;

    z-index: 2147483647;

    transition:
        opacity 0.25s ease;

    /*
     * Safari/Chrome layering üçün
     */
    isolation: isolate;

    -webkit-overflow-scrolling: touch;
}

/*
 * Quiz açıldıqda.
 */
.quiz-overlay.modal-active {
    opacity: 1;

    transform: none;
}

/* =========================================================
   SUAL VİDEOSU
   ========================================================= */

/*
 * Sənin HTML-də "quiz-video-box" yoxdur.
 *
 * Real element:
 * .modal-video-container
 *
 * Ona görə hər ikisini də dəstəkləyirik.
 */

#quizOverlay .quiz-video-box,
#quizOverlay .modal-video-container {

    width: min(760px, calc(100% - 10px));

    /*
     * ƏSAS DƏYİŞİKLİK:
     *
     * Video artıq bütün modalı tutmayacaq.
     */
    aspect-ratio: 16 / 9;

    height: auto;

    /*
     * Ekranın hündürlüyünün maksimum 46%-i.
     */
    max-height: 46vh;

    /*
     * Böyük monitorlarda maksimum 420px.
     */
    max-width: 760px;

    min-height: 0;

    background: #000;

    border-radius: 12px;

    overflow: hidden;

    margin: 0 auto 12px auto;

    flex: 0 1 auto;

    /*
     * Video sahəsi heç vaxt düymələri itələməsin.
     */
    flex-shrink: 1;

    position: relative;

    z-index: 1;

    box-shadow:
        0 15px 45px
        rgba(0, 0, 0, 0.55);
}

/*
 * Sual videosunun özü.
 */

#popupQuestionVideo {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;

    background: #000;

    border: 0;

    outline: none;
}

/* =========================================================
   TIMER
   ========================================================= */

#quizOverlay .timer-container {
    width: min(760px, calc(100% - 10px));

    height: 7px;

    min-height: 7px;

    background: #334155;

    border-radius: 10px;

    margin: 0 auto 12px auto;

    overflow: hidden;

    flex-shrink: 0;

    position: relative;

    z-index: 3;
}

#quizOverlay .timer-bar {
    height: 100%;

    width: 100%;

    background:
        linear-gradient(
            90deg,
            #22c55e,
            #3b82f6
        );

    border-radius: 10px;

    transition:
        width 1s linear;
}

/* =========================================================
   CAVAB DÜYMƏLƏRİ
   ========================================================= */

#quizOverlay .options-container {

    width: min(760px, calc(100% - 10px));

    display: flex;

    gap: 12px;

    margin: 0 auto 10px auto;

    flex-shrink: 0;

    position: relative;

    z-index: 20;
}

#quizOverlay .btn-action {

    flex: 1;

    min-height: 48px;

    color: white;

    border: none;

    padding: 12px 20px;

    font-size: 15px;

    border-radius: 9px;

    cursor: pointer;

    font-weight: bold;

    transition:
        transform 0.15s ease,
        filter 0.15s ease,
        box-shadow 0.15s ease;

    touch-action: manipulation;

    position: relative;

    z-index: 30;
}

#quizOverlay .btn-action:hover {
    transform: translateY(-2px);

    filter: brightness(1.1);
}

#quizOverlay .btn-action:active {
    transform: translateY(0);
}

#quizOverlay .btn-action.yes {
    background: #10b981;

    box-shadow:
        0 5px 20px
        rgba(16, 185, 129, 0.25);
}

#quizOverlay .btn-action.no {
    background: #ef4444;

    box-shadow:
        0 5px 20px
        rgba(239, 68, 68, 0.25);
}

/* =========================================================
   MİKROFON
   ========================================================= */

#quizOverlay .mic-section {

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 5px;

    flex-shrink: 0;

    position: relative;

    z-index: 30;
}

#quizOverlay .mic-btn {

    background: #475569;

    width: 42px;
    height: 42px;

    border-radius: 50%;

    border: none;

    cursor: pointer;

    display: flex;

    justify-content: center;

    align-items: center;

    font-size: 18px;

    color: white;

    transition:
        background 0.2s,
        transform 0.2s;
}

#quizOverlay .mic-btn:hover {
    background: #64748b;

    transform: scale(1.05);
}

#quizOverlay .mic-btn.listening {
    background: #f43f5e;

    animation:
        pulse 1.5s infinite;
}

#quizOverlay .mic-status {
    font-size: 11px;

    color: #94a3b8;

    text-align: center;

    max-width: 100%;

    line-height: 1.3;
}

/* =========================================================
   MODALIN DAXİLİNDƏ SCROLL
   ========================================================= */

#quizOverlay::-webkit-scrollbar {
    width: 5px;
}

#quizOverlay::-webkit-scrollbar-track {
    background: transparent;
}

#quizOverlay::-webkit-scrollbar-thumb {
    background: #475569;

    border-radius: 10px;
}

/* =========================================================
   PULSE ANİMASİYASI
   ========================================================= */

@keyframes pulse {

    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
    }
}

/* =========================================================
   KİÇİK EKRANLAR
   ========================================================= */

@media (max-width: 900px) {

    .left-sidebar {
        width: 220px;
        min-width: 220px;
    }

    .main-content {
        padding: 20px;
    }

    .video-container-card {
        max-width: 100%;
    }

    #quizOverlay .modal-video-container,
    #quizOverlay .quiz-video-box {
        max-height: 42vh;
    }
}

/* =========================================================
   MOBİL
   ========================================================= */

@media (max-width: 650px) {

    body {
        overflow: auto;
    }

    .dashboard-container {
        min-height: 100vh;

        height: auto;
    }

    .top-navbar {
        height: auto;
        min-height: 60px;

        padding: 10px 15px;

        flex-wrap: wrap;

        gap: 8px;
    }

    .nav-logo {
        font-size: 17px;
    }

    .nav-user-zone {
        gap: 6px;
    }

    .user-info {
        display: none;
    }

    .dashboard-body {
        height: auto;

        min-height: calc(100vh - 60px);

        flex-direction: column;
    }

    .left-sidebar {
        width: 100%;
        min-width: 100%;

        padding: 10px;

        border-right: none;

        border-bottom: 1px solid #334155;
    }

    .sidebar-menu {
        display: grid;

        grid-template-columns:
            repeat(2, 1fr);

        gap: 5px;
    }

    .sidebar-title,
    .sidebar-divider {
        display: none;
    }

    .menu-item {
        padding: 9px;

        font-size: 12px;

        text-align: center;
    }

    .main-content {
        padding: 12px;

        overflow: visible;
    }

    .hexagon-grid {
        transform: scale(0.75);

        transform-origin: top center;

        margin-top: 20px;
    }

    /* ==========================================
       MOBİL QUIZ
       ========================================== */

    #quizOverlay {
        padding: 8px;
    }

    #quizOverlay .modal-video-container,
    #quizOverlay .quiz-video-box {

        width: calc(100% - 8px);

        max-width: 100%;

        /*
         * Mobil ekranlarda daha kiçik video.
         */
        max-height: 38vh;

        margin-bottom: 8px;

        border-radius: 8px;
    }

    #quizOverlay .timer-container {
        width: calc(100% - 8px);

        margin-bottom: 9px;
    }

    /*
     * Düymələr alt-alta.
     */

    #quizOverlay .options-container {

        width: calc(100% - 8px);

        display: flex;

        flex-direction: column;

        gap: 7px;

        margin-bottom: 8px;
    }

    #quizOverlay .btn-action {

        width: 100%;

        min-height: 42px;

        padding: 10px;

        font-size: 13px;
    }

    #quizOverlay .mic-btn {
        width: 38px;
        height: 38px;

        font-size: 16px;
    }

    #quizOverlay .mic-status {
        font-size: 10px;
    }

    .welcome-buttons {
        flex-direction: column;
    }

    .welcome-box {
        padding: 25px;

        max-height: 90vh;

        overflow-y: auto;
    }
}

/* =========================================================
   ÇOX ALÇAQ EKRANLAR
   Məsələn: 1366x768, laptop və s.
   ========================================================= */

@media (max-height: 700px) {

    #quizOverlay {
        padding: 8px;
    }

    #quizOverlay .modal-video-container,
    #quizOverlay .quiz-video-box {

        max-height: 40vh;

        margin-bottom: 8px;
    }

    #quizOverlay .timer-container {
        margin-bottom: 8px;
    }

    #quizOverlay .options-container {
        margin-bottom: 7px;
    }

    #quizOverlay .btn-action {
        min-height: 40px;

        padding: 8px 15px;

        font-size: 13px;
    }

    #quizOverlay .mic-btn {
        width: 36px;
        height: 36px;
    }
}

/* =========================================================
   ÇOX ALÇAQ + DAR EKRAN
   ========================================================= */

@media (max-height: 600px) {

    #quizOverlay .modal-video-container,
    #quizOverlay .quiz-video-box {

        max-height: 32vh;
    }

    #quizOverlay .btn-action {
        min-height: 36px;

        padding: 6px 12px;

        font-size: 12px;
    }

    #quizOverlay .mic-btn {
        width: 32px;
        height: 32px;
    }

    #quizOverlay .mic-status {
        display: none;
    }
}

/* =========================================================
   QONAQ REJİMİ
   ========================================================= */

.guest-mode .dashboard-body {
    height: 100vh !important;
}

.guest-mode .main-content {
    padding: 0;

    justify-content: center;

    min-height: 100vh;
}

/* =========================================================
   FULLSCREEN ÜÇÜN QEYD
   ========================================================= */

/*
 * YouTube iframe fullscreen olduqda CSS z-index-i
 * iframe-in üzərinə çıxa bilmir.
 *
 * Buna görə fullscreen zamanı JavaScript ilə
 * fullscreen-dən çıxmaq lazımdır.
 *
 * Bu CSS digər hallarda modalın maksimum
 * layering səviyyəsini təmin edir.
 */

#quizOverlay {
    isolation: isolate;
}

#quizOverlay,
#quizOverlay * {
    -webkit-tap-highlight-color: transparent;
}

/*
 * Düymələrin kliklənməsinə mane olan element
 * olmasın.
 */

#quizOverlay .options-container,
#quizOverlay .btn-action,
#quizOverlay .mic-section,
#quizOverlay .mic-btn {
    pointer-events: auto;
}
