﻿/* =========================================================
   FONT
   ========================================================= */

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}


/* =========================================================
   GLOBAL
   ========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    direction: rtl;
    font-family: 'Vazirmatn', sans-serif;
    background: #f5f7fb;
    color: #1e293b;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

button,
input,
textarea,
select {
    font-family: inherit;
}


/* =========================================================
   APP LAYOUT
   ========================================================= */

.app-layout {
    min-height: 100vh;
    display: flex;
    background: #f5f7fb;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: #ffffff;
    border-left: 1px solid #e8edf3;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    transition: width .25s ease, transform .25s ease;
    box-shadow: -4px 0 20px rgba(15, 23, 42, .03);
}

.sidebar-closed {
    width: 78px;
}


/* =========================================================
   SIDEBAR HEADER
   ========================================================= */

.sidebar-header {
    height: 82px;
    display: flex;
    align-items: center;
    padding: 0 18px;
    gap: 12px;
    border-bottom: 1px solid #f0f2f5;
}

.logo-box {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.sidebar-logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: transparent !important;
}

.logo-text {
    white-space: nowrap;
}

.logo-title {
    font-size: 20px;
    font-weight: 700;
    color: #172033;
}

.logo-subtitle {
    margin-top: 3px;
    font-size: 11px;
    color: #94a3b8;
}


/* =========================================================
   SCHOOL SWITCHER
   ========================================================= */

.school-switcher {
    margin: 16px 12px 8px;
    padding: 10px;
    border: 1px solid #e8edf4;
    border-radius: 13px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: 9px;
}

.school-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 9px;
    background: #e8f0ff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .school-icon svg {
        width: 18px;
        height: 18px;
    }

.school-info {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

    .school-info strong {
        font-size: 12px;
        font-weight: 700;
        color: #334155;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .school-info span {
        margin-top: 3px;
        font-size: 10px;
        color: #94a3b8;
        white-space: nowrap;
    }

.school-dropdown {
    border: 0;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .school-dropdown svg {
        width: 15px;
        height: 15px;
    }


/* =========================================================
   NAVIGATION
   ========================================================= */

.sidebar-nav {
    flex: 1;
    padding: 22px 12px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 11px;
    color: #a0aec0;
    padding: 0 14px 10px;
    white-space: nowrap;
}


/* =========================================================
   NAV ITEM
   ========================================================= */

.nav-item {
    min-height: 48px;
    margin-bottom: 4px;
    padding: 0 13px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #64748b;
    font-size: 14px;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

    .nav-item:hover {
        background: #f1f5ff;
        color: #2563eb;
        transform: translateX(-2px);
    }

    .nav-item.active {
        background: linear-gradient(90deg, #eff6ff, #f5f7ff);
        color: #2563eb;
        font-weight: 700;
    }


/* =========================================================
   NAV ICON
   ========================================================= */

.nav-icon {
    width: 21px;
    height: 21px;
    min-width: 21px;
    flex-shrink: 0;
    color: currentColor;
}


/* =========================================================
   NAV GROUP
   ========================================================= */

.nav-group {
    margin-bottom: 3px;
}

.nav-group-header {
    width: 100%;
    min-height: 46px;
    border: 0;
    background: transparent;
    padding: 0 13px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #64748b;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

    .nav-group-header:hover {
        background: #f8fafc;
        color: #2563eb;
    }

    .nav-group-header > span {
        display: flex;
        align-items: center;
        gap: 10px;
    }

.group-icon {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
}

.group-arrow {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: transform .2s ease;
}

    .group-arrow.rotate {
        transform: rotate(180deg);
    }


/* =========================================================
   SUBMENU
   ========================================================= */

.nav-submenu {
    margin: 2px 0 7px;
    padding-right: 18px;
    border-right: 1px solid #e7edf5;
}

.nav-subitem {
    display: flex;
    align-items: center;
    min-height: 39px;
    padding: 0 14px;
    border-radius: 8px;
    text-decoration: none;
    color: #64748b;
    font-size: 12px;
    position: relative;
    transition: background .18s ease, color .18s ease;
}

    .nav-subitem::before {
        content: "";
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: #cbd5e1;
        margin-left: 9px;
        transition: background .18s ease, transform .18s ease;
    }

    .nav-subitem:hover {
        background: #f8fafc;
        color: #2563eb;
    }

    .nav-subitem.active {
        background: #eff6ff;
        color: #2563eb;
        font-weight: 700;
    }

        .nav-subitem.active::before {
            background: #2563eb;
            transform: scale(1.5);
        }


/* =========================================================
   DIVIDER
   ========================================================= */

.nav-divider {
    height: 1px;
    background: #edf0f4;
    margin: 15px 8px;
}


/* =========================================================
   SIDEBAR FOOTER
   ========================================================= */

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid #f0f2f5;
}

.user-card {
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar,
.topbar-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #e0ecff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

    .user-info strong {
        font-size: 13px;
        font-weight: 700;
        color: #334155;
    }

    .user-info span {
        margin-top: 3px;
        font-size: 10px;
        color: #94a3b8;
    }


/* =========================================================
   LOGOUT
   ========================================================= */

.logout-button {
    width: 100%;
    margin-top: 12px;
    height: 40px;
    border: 0;
    border-radius: 9px;
    background: #fff1f2;
    color: #e11d48;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .18s ease, color .18s ease;
}

    .logout-button svg {
        width: 17px;
        height: 17px;
    }

    .logout-button:hover {
        background: #ffe4e6;
        color: #be123c;
    }


/* =========================================================
   MAIN AREA
   ========================================================= */

.main-area {
    flex: 1;
    margin-right: 260px;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-right .25s ease;
}

.sidebar-closed ~ .main-area {
    margin-right: 78px;
}


/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
    height: 82px;
    background: #ffffff;
    border-bottom: 1px solid #e8edf3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.topbar-right,
.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}


/* =========================================================
   SIDEBAR TOGGLE
   ========================================================= */

.sidebar-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid #e5eaf0;
    background: #ffffff;
    border-radius: 10px;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, color .2s, border-color .2s;
}

    .sidebar-toggle svg {
        width: 20px;
        height: 20px;
    }

    .sidebar-toggle:hover {
        background: #f1f5ff;
        color: #2563eb;
        border-color: #dbe7ff;
    }


/* =========================================================
   PAGE HEADING
   ========================================================= */

.page-heading h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #172033;
}

.page-heading span {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #94a3b8;
}


/* =========================================================
   NOTIFICATION
   ========================================================= */

.notification-button {
    width: 42px;
    height: 42px;
    position: relative;
    border: 0;
    background: #f8fafc;
    border-radius: 10px;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .notification-button svg {
        width: 20px;
        height: 20px;
    }

    .notification-button:hover {
        background: #f1f5f9;
        color: #2563eb;
    }

.notification-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 10px;
    background: #ef4444;
    color: white;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* =========================================================
   TOPBAR USER
   ========================================================= */

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
}

    .topbar-user-info strong {
        font-size: 13px;
        font-weight: 700;
        color: #334155;
    }

    .topbar-user-info span {
        margin-top: 3px;
        font-size: 10px;
        color: #94a3b8;
    }


/* =========================================================
   CONTENT
   ========================================================= */

.content {
    flex: 1;
    min-height: 0;
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
}


/* =========================================================
   CLOSED SIDEBAR
   ========================================================= */

.sidebar-closed .sidebar-header {
    justify-content: center;
    padding: 0;
}

.sidebar-closed .logo-text {
    display: none;
}

.sidebar-closed .school-switcher {
    margin-left: 10px;
    margin-right: 10px;
    justify-content: center;
    padding: 8px;
}

.sidebar-closed .school-info,
.sidebar-closed .school-dropdown {
    display: none;
}

.sidebar-closed .sidebar-nav {
    padding-left: 9px;
    padding-right: 9px;
}

.sidebar-closed .nav-section-title {
    display: none;
}

.sidebar-closed .nav-item {
    justify-content: center;
    padding: 0;
}

    .sidebar-closed .nav-item span:not(.nav-icon) {
        display: none;
    }

.sidebar-closed .nav-group-header {
    justify-content: center;
    padding: 0;
}

    .sidebar-closed .nav-group-header > span {
        justify-content: center;
    }

        .sidebar-closed .nav-group-header > span span:not(.group-icon) {
            display: none;
        }

.sidebar-closed .group-arrow {
    display: none;
}

.sidebar-closed .nav-submenu {
    display: none;
}

.sidebar-closed .nav-icon {
    width: 21px;
    height: 21px;
}


/* =========================================================
   STUDENTS
   ========================================================= */

.students-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 18px;
    margin-bottom: 12px;
}

.students-title h1 {
    margin: 0;
    font-size: 22px;
}

.students-class-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .students-class-selector label {
        font-weight: 600;
        white-space: nowrap;
    }


/* =========================================================
   MOBILE SIDEBAR OVERLAY
   ========================================================= */

.sidebar-overlay {
    display: none;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 900px) {

    /* -----------------------------------------
       Sidebar
       ----------------------------------------- */

    .sidebar {
        width: 260px;
        transform: translateX(100%);
        box-shadow: -8px 0 25px rgba(15, 23, 42, .12);
    }

        .sidebar.sidebar-open {
            width: 260px;
            transform: translateX(0);
        }

        .sidebar.sidebar-closed {
            width: 260px;
            transform: translateX(100%);
        }


    /* -----------------------------------------
       Sidebar Overlay
       ----------------------------------------- */

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .35);
        z-index: 999;
    }


    /* -----------------------------------------
       Main
       ----------------------------------------- */

    .main-area,
    .sidebar-closed ~ .main-area,
    .sidebar-open ~ .main-area {
        width: 100%;
        margin-right: 0;
    }


    /* -----------------------------------------
       Topbar
       ----------------------------------------- */

    .topbar {
        width: 100%;
        height: 70px;
        padding: 0 16px;
    }

    .topbar-right,
    .topbar-left {
        gap: 10px;
    }

    .topbar-user-info {
        display: none;
    }

    .page-heading h1 {
        font-size: 17px;
    }

    .page-heading span {
        font-size: 10px;
    }


    /* -----------------------------------------
       Content
       ----------------------------------------- */

    .content {
        width: 100%;
        padding: 18px;
        overflow-x: hidden;
    }


    /* -----------------------------------------
       School
       ----------------------------------------- */

    .school-switcher {
        margin-top: 12px;
    }
}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 600px) {

    .topbar {
        height: 70px;
    }

    .content {
        padding: 14px;
    }

    .page-heading h1 {
        font-size: 17px;
    }

    .page-heading span {
        font-size: 10px;
    }
}
