@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Poppins:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #15803d;
    --primary-dark: #166534;
    --primary-light: #f0fdf4;

    --secondary-color: #f59e0b;
    --secondary-hover: #d97706;

    --background-color: #f8fafc;
    --card-background: #ffffff;

    --text-color-dark: #0f172a;
    --text-color-light: #64748b;
    --text-color-muted: #94a3b8;

    --border-color: #e2e8f0;
    --border-color-light: #f1f5f9;

    --success-color: #16a34a;
    --error-color: #dc2626;
    --warning-color: #f59e0b;
    --info-color: #0ea5e9;

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.10);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);

    --sidebar-bg-start: #14532d;
    --sidebar-bg-end: #052e16;
    --sidebar-header-bg: #052e16;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
    --sidebar-active-accent: #86efac;
    --sidebar-text: #f0fdf4;
    --sidebar-text-muted: #bbf7d0;
}

/* ================================================= */
/* 📐 BASIC RESET & LAYOUT                           */
/* ================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.no-scroll {
    overflow: hidden;
}

/* 🔒 লগইন না হওয়া পর্যন্ত মূল কনটেন্ট হাইড থাকবে */
#main-website-content {
    display: none;
}

.main-section-container {
    padding: 1.5rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    scroll-margin-top: 6rem; 
}

.section-heading-wrapper {
    display: flex; 
    align-items: center; 
    justify-content: 
    space-between; 
    gap: 12px;
}

/* ================================================= */
/* 🔝 HEADER & TOP BAR                              */
/* ================================================= */

#top-bar-section {
    background-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.main-header {
    display: flex;
    justify-content: space-between; 
    align-items: center;            
    padding: 0.8rem 1.2rem;
    max-width: 1200px;
    margin: 0 auto;
    color: #ffffff;
    position: relative;
}

.header-content {
    display: flex;
    align-items: center;
    z-index: 2;
}

.school-name {
    position: absolute;      
    left: 50%;                
    transform: translateX(-50%); 
    margin: 0;                
    text-align: center;
    font-size: 1.0rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
    color: #ffffff;
    pointer-events: none;
    z-index: 1;
}

.logout-button {
    background-color: var(--secondary-color);
    color: #ffffff;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 2;
}

.logout-button:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-1px);
}

.menu-button {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    z-index: 2;
}

/* ================================================= */
/* 🔍 SEARCH CONTAINER                              */
/* ================================================= */

.search-section {
    width: 100%;
    margin: 1.2rem 0;
}

.search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
    padding: 0 15px;
    display: block !important;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    font-size: 0.9rem;
    color: #888;
    pointer-events: none;
}

.search-container input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 2.4rem;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 0.92rem;
    font-family: inherit;
    outline: none;
    background-color: #ffffff;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.search-container input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(56, 102, 65, 0.25);
}

#clear-search-btn {
    position: absolute;
    right: 12px;
    background: #eee;
    border: none;
    font-size: 0.75rem;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    display: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

#clear-search-btn:hover {
    background: var(--error-color);
    color: #fff;
}

#search-dropdown-list {
    position: absolute;
    top: 100%;
    left: 15px;
    right: 15px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1500;
    margin-top: 6px;
    display: none;
    border: 1px solid var(--border-color);
}

.search-dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.search-dropdown-item:last-child {
    border-bottom: none;
}

.search-dropdown-item:hover {
    background-color: rgba(56, 102, 65, 0.08);
}

.search-dropdown-item .item-title {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-color-dark);
}

.search-dropdown-item .item-btn {
    background-color: var(--primary-color);
    color: #ffffff;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* ================================================= */
/* 🔐 MASTER LOGIN OVERLAY                            */
/* ================================================= */

#masterLoginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-color); 
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    background-image: linear-gradient(rgba(0, 56, 46, 0.85), rgba(0, 56, 46, 0.85)), url('photo/master_login_image.jpg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover; 
    backdrop-filter: blur(4px);
}

#masterLoginBox {
    background-color: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    text-align: center;
    width: 90%;
    max-width: 360px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#masterLoginBox input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
}

#masterLoginBox button {
    background-color: var(--primary-color);
    color: #ffffff;
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.error, .success {
    margin-top: -0.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.85rem;
}
.error { color: var(--error-color); }
.success { color: var(--success-color); }

/* ================================================= */
/* 🔢 CAPTCHA STYLING (NEW ADDITION)                 */
/* ================================================= */

.captcha-container {
    margin: 1rem 0;
    text-align: center;
}

.captcha-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 0.8rem;
    background-color: var(--primary-light);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px dashed var(--primary-color);
}

#captchaCanvas {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: 5px;
    user-select: none;
    -webkit-user-select: none;
    padding: 4px 8px;
    background: rgba(21, 128, 61, 0.1);
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    text-align: center;
    cursor: pointer;
}

.captcha-refresh-btn {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.captcha-refresh-btn:hover {
    background-color: var(--primary-dark);
    transform: rotate(180deg);
}

#userCaptcha {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#userCaptcha:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15);
}

/* ================================================= */
/* 🧭 SIDEBAR MENU                                   */
/* ================================================= */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    z-index: 1001;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
}

.overlay.active {
    visibility: visible;
    opacity: 1;
}

.sidebar-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
    color: var(--sidebar-text);
    padding-top: 0;
    box-shadow: 8px 0 25px rgba(0, 0, 0, 0.3);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1002;
    overflow-y: auto; 
}

.sidebar-menu.active {
    left: 0;
}

.sidebar-menu ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu .menu-item {
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.menu-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--sidebar-header-bg);
    transition: background-color 0.2s ease;
}

.menu-header-wrapper:hover {
    background-color: var(--sidebar-hover-bg);
}

.sidebar-menu .menu-header {
    font-weight: 600;
    font-size: 0.92rem;
    padding: 12px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    flex-grow: 1;
    letter-spacing: 0.3px;
}

.arrow-icon {
    cursor: pointer;
    padding: 12px 16px;
    color: var(--sidebar-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.arrow-icon i {
    font-size: 0.85rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.arrow-icon:hover {
    color: var(--sidebar-active-accent);
}

.submenu {
    display: none;
    background-color: rgba(0, 0, 0, 0.25);
    padding: 4px 0 !important;
}

.submenu li {
    margin: 2px 0;
}

.submenu .nav-link {
    display: flex;
    align-items: center;
    padding: 8px 12px 8px 24px;
    color: var(--sidebar-text-muted);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 400;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.submenu .nav-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: #ffffff;
    padding-left: 28px;
}

.submenu .nav-link.active-link {
    color: var(--sidebar-active-accent);
    border-left-color: var(--sidebar-active-accent);
    background-color: rgba(134, 239, 172, 0.08);
    font-weight: 500;
}

.menu-item.active .submenu {
    display: block;
}

.menu-item.active .arrow-icon i {
    transform: rotate(180deg);
    color: var(--sidebar-active-accent);
}

/* ================================================= */
/* 🔘 ALL BUTTONS GRID                               */
/* ================================================= */

.class-buttons-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 12px !important;
    width: 100% !important;
    margin: 1rem 0 !important;
    padding: 0 !important;
}

.exam-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 48px !important;
    padding: 10px 14px !important;        
    font-size: 0.88rem !important;        
    font-weight: 600 !important;
    line-height: 1.3 !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1) !important;
    transition: all 0.25s ease !important;
    background-color: #386641 !important;
    color: #ffffff !important;
    border: none !important;
    cursor: pointer !important;
    text-decoration: none !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

.exam-link:hover {
    background-color: #27472e !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

/* ================================================= */
/* 🦶 FOOTER STYLING                                 */
/* ================================================= */

.main-footer, footer {
    background-color: #386641 !important;
    color: #ffffff !important;
    text-align: center !important;
    padding: 2rem 1rem !important;
    margin-top: 1rem !important;
    width: 100% !important;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1) !important;
}

.main-footer p, footer p {
    margin: 6px 0 !important;
    font-size: 0.78rem !important;
    color: #ffffff !important;
    font-weight: 400 !important;
}

.main-footer .section-heading, footer .section-heading {
    color: #ffffff !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3) !important;
    padding-bottom: 8px !important;
    margin-bottom: 12px !important;
}

/* ================================================= */
/* 📱 MOBILE RESPONSIVE                              */
/* ================================================= */

@media (max-width: 600px) {
    .school-name {
        font-size: 0.92rem;
    }

    .class-buttons-grid {
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 10px !important;
    }

    .exam-link {
        font-size: 0.82rem !important;
        min-height: 44px !important; 
        padding: 8px 10px !important;
    }
}

/* ================================================= */
/* Fullscreen Loading Spinner  Overlay               */
/* ================================================= */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999; /* যেন সবকিছুর উপরে থাকে */
    backdrop-filter: blur(4px);
}

/* Spinner Animation */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff; /* আপনার থিম কালার অনুযায়ী পরিবর্তন করতে পারেন */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
