/* ===== Global Layout ===== */

body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;

    background-image: url('/static/images/tcf.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Soft overlay */

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.85);
    z-index: -1;
}


/* ===== Site Title ===== */

.site-title {
    text-align: center;
    margin-top: 20px;
}


/* ===== Flash Messages ===== */

.flash-error {
    background: #ffdddd;
    color: #a00;

    padding: 12px;

    border-radius: 6px;

    width: 90%;
    max-width: 600px;

    margin: 20px auto;
}


/* ===== Login Page ===== */

.login-container {
    background: rgba(255,255,255,0.9);

    padding: 30px;

    width: 90%;
    max-width: 350px;

    margin: 10vh auto;

    border-radius: 10px;

    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.login-container h3 {
    text-align: center;
}

/* ===== Login Responsive ===== */

@media (max-width:480px) {

    .login-container {
        padding: 20px;
    }

    input {
        padding: 14px;
    }

}


/* ===== Forms ===== */

form {
    display: flex;
    flex-direction: column;
}

input {
    margin-bottom: 12px;

    padding: 12px;

    border: 1px solid #ccc;
    border-radius: 6px;

    width: 100%;
    box-sizing: border-box;
}

button {
    padding: 12px;

    border: none;
    border-radius: 6px;

    background: #4c6ef5;
    color: white;

    font-size: 16px;

    cursor: pointer;
}

button:hover {
    background: #364fc7;
}


/* ===== Links ===== */

a {
    text-decoration: none;
}

.home-link {
    display: inline-block;
    margin-bottom: 10px;
    font-weight: bold;
}


/* ===== Dashboard Layout ===== */

.dashboard {
    display: flex;
    min-height: 100vh;
}


/* ===== Sidebar ===== */

.sidebar {

    width: 240px;

    background: linear-gradient(180deg,#4c6ef5,#364fc7);

    color: white;

    padding: 30px 20px;

    display: flex;
    flex-direction: column;
}


.sidebar a,
.sidebar button {

    color: white;

    padding: 12px;

    border-radius: 8px;

    margin-bottom: 10px;

    display: flex;
    align-items: center;

    gap: 10px;

    transition: 0.2s;
}

.sidebar a:hover,
.sidebar button:hover {
    background: rgba(255,255,255,0.15);
}

.sidebar a.active {

    background: white;
    color: #364fc7;

    font-weight: 600;
}


/* ===== Sidebar Mobile Adjustment ===== */
@media (max-width: 767px) {
    .sidebar {
        padding-right: 10px; /* add a little space on the right */
    }

    /* Optional: reduce width slightly to avoid full overlay flush */
    .sidebar.closed {
        transform: translateX(-250px); /* keeps sidebar hidden initially */
    }
}


/* ===== User Profile ===== */

.user-profile {

    display: flex;
    align-items: center;

    gap: 12px;

    margin-bottom: 40px;
}

.avatar {

    width: 45px;
    height: 45px;

    border-radius: 50%;

    background: white;
    color: #364fc7;

    font-weight: bold;

    display: flex;
    align-items: center;
    justify-content: center;
}


/* ===== Main Content ===== */

.main-content {

    flex: 1;

    padding: 40px;
}


/* ===== Lesson Grid ===== */

.lesson-list {

    display: grid;

    gap: 20px;
}

@media (min-width:600px) {

    .lesson-list {
        grid-template-columns: repeat(2,1fr);
    }

}

@media (min-width:992px) {

    .lesson-list {
        grid-template-columns: repeat(3,1fr);
    }

}


/* ===== Lesson Cards ===== */

.lesson-card {

    display: block;

    padding: 22px;

    border-radius: 14px;

    background: white;

    color: #333;

    box-shadow: 0 6px 18px rgba(0,0,0,0.05);

    transition: 0.3s;
}

.lesson-card:hover {

    transform: translateY(-6px);

    box-shadow: 0 12px 30px rgba(76,110,245,0.25);
}

.lesson-content {

    display: flex;
    align-items: center;

    gap: 15px;
}

.lesson-icon {

    font-size: 22px;

    color: #4c6ef5;
}


/* ===== Mobile Menu Button ===== */

.menu-toggle {

    display: none;

    background: #4c6ef5;

    color: white;

    border: none;

    padding: 10px 14px;

    border-radius: 6px;

    font-size: 18px;

    cursor: pointer;

    margin-bottom: 20px;
}

.menu-toggle:hover {
    background:#364fc7;
}


/* ===== Overlay ===== */

.overlay {

    position: fixed;

    inset: 0;

    background: rgba(0,0,0,0.4);

    opacity: 0;
    visibility: hidden;

    transition: opacity 0.3s ease;

    z-index: 900;

    pointer-events: none;
}

.overlay.show {

    opacity: 1;
    visibility: visible;

    pointer-events: auto;
}


/* ===== Mobile Layout ===== */

@media (max-width:768px) {

    .main-content {
        padding: 20px;
    }

    .menu-toggle {
        display: inline-block;
    }

    .sidebar {

        position: fixed;

        top: 0;
        left: -260px;

        height: 100vh;

        width: 240px;

        padding-top: 60px;

        z-index: 1000;

        transition: left 0.3s ease;

        box-shadow: 2px 0 12px rgba(0,0,0,0.2);
    }

    .sidebar.open {
        left: 0;
    }

}


/* ===== Lesson Sections ===== */

.section-card {

    background: white;

    padding: 25px;

    border-radius: 14px;

    box-shadow: 0 6px 18px rgba(0,0,0,0.05);

    margin-bottom: 25px;

    transition: 0.3s;

    opacity: 0;

    transform: translateY(20px);

    animation: fadeInUp 0.6s ease forwards;
}

.section-card:hover {

    transform: translateY(-6px);

    box-shadow: 0 15px 35px rgba(76,110,245,0.25);
}


.section-title {

    display: flex;

    align-items: center;

    gap: 10px;

    font-size: 18px;

    margin-bottom: 10px;

    color: #4c6ef5;
}


/* ===== Buttons ===== */

.action-button {

    display: inline-block;

    margin-top: 15px;

    padding: 12px 18px;

    background: linear-gradient(135deg,#4c6ef5,#364fc7);

    color: white;

    border-radius: 8px;

    font-weight: 500;

    transition: 0.2s;
}

.action-button:hover {

    transform: translateY(-2px);

    opacity: 0.95;
}


/* ===== Back Button ===== */

.back-button {

    display: inline-block;

    margin-top: 20px;

    padding: 12px 18px;

    background: #40a9ff;

    color: white;

    border-radius: 8px;

    transition: 0.2s;
}

.back-button:hover {
    transform: translateY(-2px);
}


/* ===== Card Animation ===== */

@keyframes fadeInUp {

    to {
        opacity: 1;
        transform: translateY(0);
    }

}


/* ===== Exam results ===== */
.result-grid {
    display: grid;
    gap: 20px;
    margin-top: 25px;
}

@media (min-width: 768px) {
    .result-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.result-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 35px rgba(76,110,245,0.25);
}

.result-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #4c6ef5;
}

.overall-box {
    margin-top: 35px;
    padding: 25px;
    border-radius: 16px;
    background: white;
    box-shadow: 0 6px 18px rgba(0,0,0,0.05);
}

.badge {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: bold;
    margin-top: 10px;
}

.pass {
    background: #dcfce7;
    color: #166534;
}

.fail {
    background: #fee2e2;
    color: #991b1b;
}

.back-btn {
    display: inline-block;
    margin-top: 25px;
    padding: 12px 20px;
    background: linear-gradient(135deg,#4c6ef5,#364fc7);
    color: white;
    border-radius: 8px;
    text-decoration: none;
}



/* ===== Exam Grid ===== */
.exam-grid {
    display: grid;
    gap: 25px;
    margin-top: 25px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    justify-content: center;
}

/* ===== Exam Card (Main Box per Exam) ===== */
.exam-card {
    position: relative;

    background: white;
    border-radius: 18px;
    padding: 22px;

    border: 1px solid #e5e7eb;

    box-shadow: 0 8px 22px rgba(0,0,0,0.06);

    transition: all 0.25s ease;

    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Hover effect */
.exam-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(76,110,245,0.18);
}

/* Optional icon */
.exam-card::before {
    content: "📘";
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 18px;
    opacity: 0.6;
}

/* ===== Exam Header ===== */
.exam-card h3 {
    margin: 0;
    padding-bottom: 10px;

    border-bottom: 1px solid #f1f1f1;

    color: #364fc7;
    font-size: 18px;
}

/* ===== Section Boxes ===== */
.section-row {
    background: #f9fafb;

    border-radius: 14px;
    padding: 15px;

    border: 1px solid #eef0f3;

    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Spacing between sections */
.section-row + .section-row {
    margin-top: 10px;
}

/* Section titles */
.section-row strong {
    display: block;
    margin-bottom: 5px;
}

/* ===== Colored Borders per Section ===== */

/* Part 1 */
.section-row:nth-of-type(1) {
    border-left: 5px solid #4c6ef5;
}

/* Part 2 */
.section-row:nth-of-type(2) {
    border-left: 5px solid #22c55e;
}

/* Essay */
.section-row:nth-of-type(3) {
    border-left: 5px solid #f59e0b;
}

/* ===== Chart Wrapper ===== */
.section-row .chart-wrapper {
    width: 60px;
    height: 60px;
    margin: 10px 0;
    position: relative;
}

/* ===== Section Info Text ===== */
.section-info {
    font-size: 13px;
    color: #374151;
    line-height: 1.4;
}

/* ===== Essay Question Boxes ===== */
.section-row > div[style] {
    background: white;
    border-radius: 10px;
    padding: 10px;

    border: 1px solid #e5e7eb;

    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

/* ===== Overall Score ===== */
.overall-score {
    margin-top: 10px;
    font-weight: bold;
    font-size: 15px;
    color: #111827;
}

/* ===== Responsive Tweaks ===== */

/* Tablet */
@media (min-width: 768px) {
    .section-row .chart-wrapper {
        width: 65px;
        height: 65px;
    }
}

/* Mobile */
@media (max-width: 767px) {

    .exam-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .exam-card {
        padding: 18px;
    }

    .section-row .chart-wrapper {
        width: 50px;
        height: 50px;
    }

}


.exam-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.arrow {
    transition: transform 0.3s ease;
}