
/* =========================================
   1. GLOBAL LAYOUT
   ========================================= */

html {
    font-size: 14px;
    min-height: 100%;
    position: relative;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    color: #0c1e49;
    background: #fff;
}

.site-header {
    flex: 0 0 auto;
    position: relative;
    z-index: 10;
}

    .site-header .navbar {
        margin-bottom: 0 !important;
        padding: 10px 16px;
    }

    .site-header .navbar-brand {
        color: #086cf5;
        font-size: 1.5rem;
        letter-spacing: -0.7px;
    }

    .site-header .nav-link {
        color: #152443;
    }

        .site-header .nav-link:hover {
            color: #086cf5;
        }

.page-container {
    flex: 1 0 auto;
    width: 100%;
    min-width: 0;
}

    .page-container > main {
        width: 100%;
    }

.site-footer {
    position: static;
    flex: 0 0 auto;
    width: 100%;
    margin-top: auto;
    background: #fff;
    white-space: normal;
}

    .site-footer .container {
        overflow-wrap: anywhere;
    }

/* Bootstrap keyboard focus */

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem #258cfb;
}

.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;
}

/* =========================================
   2. WATTIIR HOME PAGE
   ========================================= */

.wattiir-home {
    --blue: #086cf5;
    --blue-dark: #0754cf;
    --navy: #0c1e49;
    --muted: #637695;
    --border: #dce7f5;
    width: min(100%, 1400px);
    margin: 0 auto;
    padding: 24px 20px 32px;
    color: var(--navy);
}

    .wattiir-home *,
    .wattiir-home *::before,
    .wattiir-home *::after {
        box-sizing: border-box;
    }

    .wattiir-home a {
        text-decoration: none;
    }

/* Hero */

.home-hero {
    padding: 12px 8px 28px;
}

    .home-hero h1 {
        margin: 0;
        color: var(--navy);
        font-size: clamp(2rem, 3.7vw, 3.25rem);
        font-weight: 750;
        line-height: 1.08;
        letter-spacing: -1.5px;
    }

        .home-hero h1 > span {
            display: inline-block;
            position: relative;
            color: var(--blue);
        }

            .home-hero h1 > span::after {
                display: block;
                width: 78%;
                height: 5px;
                margin: 6px 0 0 8%;
                border-radius: 100%;
                background: #ffc629;
                content: "";
            }

    .home-hero > p {
        margin: 12px 0 0;
        color: #526783;
        font-size: clamp(1rem, 1.8vw, 1.25rem);
        line-height: 1.55;
    }

/* =========================================
   3. TWO-COLUMN DASHBOARD
   ========================================= */

.learning-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(310px, 1fr);
    align-items: stretch;
    gap: 20px;
}

.learning-panel,
.topics-panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #e0ebf8;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 5px 20px rgba(31, 92, 155, 0.045);
}

.panel-heading {
    display: flex;
    align-items: center;
    min-height: 58px;
    padding: 15px 24px;
    background: linear-gradient(110deg, #e8f4ff, #f5f9ff);
}

    .panel-heading h2 {
        margin: 0;
        color: var(--navy);
        font-size: clamp(1.15rem, 1.8vw, 1.45rem);
        font-weight: 750;
        letter-spacing: -0.5px;
    }

.learning-panel-body {
    padding: 18px 24px 24px;
}

.mode-label {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 650;
}

/* =========================================
   4. ESSAI / EXAMEN SELECTOR
   ========================================= */

.mode-selector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    min-height: 70px;
    padding: 12px 16px;
    border: 1px solid #d9e5f4;
    border-radius: 13px;
    background: #fff;
    color: var(--navy);
    text-align: left;
    cursor: pointer;
    box-shadow: 0 3px 9px rgba(29, 75, 130, 0.035);
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

    .mode-option:hover {
        border-color: #80b5ff;
    }

    .mode-option.active {
        border-color: var(--blue);
        background: var(--blue);
        color: #fff;
        box-shadow: 0 5px 13px rgba(8, 108, 245, 0.17);
    }

.mode-icon {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    color: var(--blue-dark);
}

.mode-option.active .mode-icon {
    color: #fff;
}

.mode-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

    .mode-copy strong {
        font-size: 1.05rem;
        font-weight: 700;
        line-height: 1.25;
    }

    .mode-copy small {
        color: var(--muted);
        font-size: 0.84rem;
        line-height: 1.4;
    }

.mode-option.active .mode-copy small {
    color: #fff;
}

/* Keyboard focus */

.mode-option:focus-visible,
.primary-action:focus-visible,
.secondary-action:focus-visible,
.topic-item:focus-visible {
    outline: 3px solid #8dc2ff;
    outline-offset: 3px;
}

/* =========================================
   5. PRACTICE ILLUSTRATION
   ========================================= */

.practice-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #dce6f2;
    text-align: center;
}

.practice-illustration {
    position: relative;
    display: grid;
    place-items: center;
    width: 220px;
    height: 140px;
    max-width: 100%;
    margin: 0 auto 4px;
}

.practice-orbit {
    position: absolute;
    width: 100%;
    height: 88%;
    border-radius: 46% 54% 53% 47%;
    background: linear-gradient(135deg, #eaf5ff, #dceeff);
    transform: rotate(-8deg);
}

.practice-sheet {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 9px;
    width: 112px;
    height: 112px;
    padding: 14px;
    border: 1px solid #edf3fa;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(31, 91, 155, 0.1);
}

.check-line {
    display: flex;
    align-items: center;
    gap: 9px;
}

.check-box {
    display: grid;
    place-items: center;
    flex: 0 0 19px;
    width: 19px;
    height: 19px;
    border-radius: 4px;
    background: #2787fa;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.check-line:nth-child(2) .check-box {
    opacity: 0.75;
}

.check-line:nth-child(3) .check-box {
    opacity: 0.5;
}

.check-line-text {
    width: 48px;
    height: 5px;
    border-radius: 5px;
    background: #c6e1ff;
}

.check-line:nth-child(2) .check-line-text {
    width: 39px;
}

.check-line:nth-child(3) .check-line-text {
    width: 43px;
}

.practice-play {
    position: absolute;
    z-index: 2;
    right: 24px;
    bottom: 16px;
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    box-shadow: 0 5px 14px rgba(8, 108, 245, 0.22);
}

    .practice-play svg {
        width: 26px;
        height: 26px;
        margin-left: 3px;
    }

.practice-content > h2 {
    margin: 3px 0 7px;
    font-size: clamp(1.3rem, 2.2vw, 1.7rem);
    font-weight: 750;
    letter-spacing: -0.5px;
}

.practice-content > p:not(.mode-feedback) {
    max-width: 440px;
    margin: 0 auto 16px;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.55;
}

/* Main action buttons */

.practice-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(100%, 390px);
    margin: 0 auto;
}

.primary-action,
.secondary-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 49px;
    padding: 12px 18px;
    border: 1px solid var(--blue);
    border-radius: 30px;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.3;
    transition: background 160ms ease, box-shadow 160ms ease;
}

.primary-action {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 6px 15px rgba(8, 108, 245, 0.15);
}

    .primary-action:hover {
        background: var(--blue-dark);
        color: #fff;
    }

.secondary-action {
    background: #fff;
    color: var(--blue-dark);
}

    .secondary-action:hover {
        background: #f1f7ff;
        color: var(--blue-dark);
    }

    .secondary-action svg {
        flex: 0 0 22px;
        width: 22px;
        height: 22px;
    }

.mode-feedback {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

/* =========================================
   6. RUBRIQUES SEARCH AND TOPIC LIST
   ========================================= */

.topics-panel-body {
    padding: 12px 20px 16px;
}

.topic-search {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 41px;
    padding: 0 12px;
    border: 1px solid #cddced;
    border-radius: 10px;
    background: #fff;
}

    .topic-search:focus-within {
        border-color: var(--blue);
        box-shadow: 0 0 0 3px rgba(8, 108, 245, 0.08);
    }

    .topic-search svg {
        flex: 0 0 18px;
        width: 18px;
        height: 18px;
        color: #526b8e;
    }

    .topic-search input {
        width: 100%;
        min-width: 0;
        height: 100%;
        padding: 0;
        border: 0;
        outline: none;
        background: transparent;
        color: var(--navy);
        font: inherit;
        font-size: 0.85rem;
    }

        .topic-search input::placeholder {
            color: #71819a;
            opacity: 1;
        }

.topic-list {
    margin-top: 5px;
}

.topic-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto 13px;
    align-items: center;
    gap: 10px;
    min-height: 60px;
    padding: 7px 0;
    border-bottom: 1px solid #e5edf6;
    color: var(--navy);
}

    .topic-item:last-of-type {
        border-bottom: 0;
    }

    .topic-item:hover .topic-name {
        color: var(--blue-dark);
    }


.topic-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f2f7fc;
    font-weight: 800;
    line-height: 1;
}

    .topic-icon .sign-warning {
        font-size: 27px;
    }

    .topic-icon .sign-cross {
        color: #182b47;
        font-size: 2.5rem;
        text-shadow: 1px 1px #f9bf26;
    }

    .topic-icon .sign-speed {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: 4px solid #ed2838;
        border-radius: 50%;
        background: #fff;
        color: #172642;
        font-size: 0.95rem;
    }

    .topic-icon .sign-traffic {
        font-size: 25px;
    }

    .topic-icon .sign-parking {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 7px;
        background: #0870d9;
        color: #fff;
        font-size: 2rem;
    }

    .topic-icon .sign-danger {
        color: #e52430;
        font-size: 2rem;
        text-shadow: 1px 1px #fff;
    }

    .topic-icon .sign-steering {
        color: #183458;
        font-size: 2.3rem;
    }

    .topic-icon .sign-first-aid {
        color: #f32738;
        font-size: 3rem;
    }


.topic-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.topic-name {
    overflow-wrap: anywhere;
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.3;
}

.progress-track {
    display: block;
    width: 100%;
    height: 6px;
    overflow: hidden;
    border-radius: 8px;
    background: #e5ebf2;
}

    .progress-track > span {
        display: block;
        height: 100%;
        border-radius: inherit;
        background: linear-gradient(90deg, #13b9ed, #1686fb);
    }

.topic-percent {
    color: var(--muted);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.topic-chevron {
    color: #526e93;
    font-size: 1.6rem;
    line-height: 1;
}

.topic-item[hidden],
.no-topics[hidden] {
    display: none !important;
}

.no-topics {
    padding: 14px 0;
    color: var(--muted);
    font-size: 0.9rem;
}

/* =========================================
   7. TABLET
   ========================================= */

@media (max-width: 900px) {
    .wattiir-home {
        padding-right: 16px;
        padding-left: 16px;
    }

    .learning-dashboard {
        grid-template-columns: minmax(0, 1.35fr) minmax(270px, 1fr);
        gap: 14px;
    }

    .learning-panel-body {
        padding-right: 16px;
        padding-left: 16px;
    }

    .panel-heading {
        padding-right: 16px;
        padding-left: 16px;
    }

    .topics-panel-body {
        padding-right: 13px;
        padding-left: 13px;
    }

    .mode-option {
        gap: 9px;
        padding: 10px;
    }

    .mode-copy small {
        font-size: 0.77rem;
    }

    .topic-item {
        grid-template-columns: 36px minmax(0, 1fr) auto 10px;
        gap: 7px;
    }

    .topic-icon {
        width: 34px;
        height: 36px;
    }

    .topic-name {
        font-size: 0.8rem;
    }
}

/* =========================================
   8. MOBILE
   ========================================= */

@media (max-width: 650px) {
    .site-header .navbar {
        padding: 8px 12px;
    }

    .site-header .navbar-collapse {
        padding-top: 10px;
    }

    .site-header .navbar-nav {
        align-items: stretch !important;
    }

    .wattiir-home {
        width: 100%;
        padding: 16px 12px 30px;
    }

    .home-hero {
        padding: 8px 4px 20px;
    }

        .home-hero h1 {
            font-size: clamp(1.9rem, 7.5vw, 2.5rem);
            letter-spacing: -0.9px;
        }

        .home-hero > p {
            margin-top: 12px;
            font-size: 1rem;
        }

    .learning-dashboard {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .panel-heading {
        min-height: 51px;
        padding: 13px 16px;
    }

        .panel-heading h2 {
            font-size: 1.12rem;
        }

    .learning-panel-body {
        padding: 15px 13px 20px;
    }

    .mode-selector {
        gap: 9px;
    }

    .mode-option {
        gap: 8px;
        min-height: 80px;
        padding: 11px 9px;
    }

        .mode-option.active {
            padding: 10px 8px;
        }

    .mode-icon {
        flex-basis: 28px;
        width: 28px;
        height: 28px;
    }

    .mode-copy strong {
        font-size: 0.95rem;
    }

    .mode-copy small {
        font-size: 0.73rem;
    }

    .practice-content {
        margin-top: 20px;
        padding-top: 14px;
    }

    .practice-illustration {
        width: 190px;
        height: 125px;
    }

    .practice-sheet {
        width: 100px;
        height: 102px;
    }

    .practice-play {
        right: 19px;
        bottom: 12px;
        width: 49px;
        height: 49px;
    }

    .practice-content > h2 {
        font-size: 1.35rem;
    }

    .practice-content > p:not(.mode-feedback) {
        max-width: 350px;
        font-size: 0.91rem;
    }

    .practice-actions {
        width: min(100%, 360px);
    }

    .primary-action,
    .secondary-action {
        min-height: 46px;
        font-size: 0.9rem;
    }

    .topics-panel-body {
        padding: 12px 14px;
    }

    .topic-item {
        grid-template-columns: 40px minmax(0, 1fr) auto 12px;
        gap: 9px;
        min-height: 58px;
    }

    .topic-icon {
        width: 37px;
        height: 38px;
    }

    .topic-name {
        font-size: 0.85rem;
    }
}

/* =========================================
   9. ACCESSIBILITY
   ========================================= */

@media (prefers-reduced-motion: reduce) {
    .wattiir-home *,
    .wattiir-home *::before,
    .wattiir-home *::after {
        transition: none !important;
    }
}
/* Wattiir brand logo */

.site-header .wattiir-brand {
    display: inline-flex;
    align-items: center;
    padding: 0;
    margin-right: 28px;
}

.site-header .wattiir-logo {
    display: block;
    width: 187.5px;
    height: auto;
    max-height: 78px;
    object-fit: contain;
}

/* Mobile logo sizing */

@media (max-width: 650px) {
    .site-header .wattiir-logo {
        width: 162px;
        max-height: 66px;
    }
}
/* Wattiir practice page heading */
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

    .panel-heading h2 {
        margin: 0;
    }

    .panel-heading span {
        color: #526783;
        font-size: 0.95rem;
        white-space: nowrap;
    }
/* Practice completion message */
.practice-completion {
    margin: 24px 0 16px;
    text-align: center;
}

    .practice-completion h3 {
        margin: 0 0 8px;
        color: #0c1e49;
        font-size: 1.35rem;
    }

    .practice-completion p {
        margin: 0;
        color: #637695;
        line-height: 1.6;
    }

.practice-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

    .practice-actions .primary-action,
    .practice-actions .secondary-action {
        width: 100%;
        max-width: 430px;
        text-align: center;
    }
/* Final practice score */
.practice-score {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin: 22px 0 16px;
}

    .practice-score strong {
        color: #0877f9;
        font-size: 2.5rem;
        font-weight: 800;
    }

    .practice-score span {
        color: #637695;
    }

.score-progress {
    max-width: 430px;
    height: 10px;
    margin: 0 auto 12px;
    overflow: hidden;
    border-radius: 20px;
    background: #e5edf7;
}

    .score-progress span {
        display: block;
        height: 100%;
        border-radius: inherit;
        background: linear-gradient(90deg, #13b9ed, #1686fb);
        transition: width 200ms ease;
    }

.score-percentage {
    margin: 0 0 16px;
    color: #526783;
    font-weight: 600;
}

.score-details {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-bottom: 18px;
}

.score-correct {
    color: #16834a;
    font-weight: 600;
}

.score-incorrect {
    color: #c24141;
    font-weight: 600;
}