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

html[dir='rtl'] {
    direction: rtl;
}

body.rtl-body {
    direction: rtl;
    text-align: right;
    font-family: 'Vazirmatn', 'Poppins', sans-serif;
    background: linear-gradient(180deg, #f5f9ea 0%, #ffffff 200px);
    unicode-bidi: plaintext;
}

body.rtl-body *,
body.rtl-body *::before,
body.rtl-body *::after {
    box-sizing: border-box;
}

body.rtl-body p,
body.rtl-body h1,
body.rtl-body h2,
body.rtl-body h3,
body.rtl-body h4,
body.rtl-body h5,
body.rtl-body h6,
body.rtl-body .section-title,
body.rtl-body .news-info,
body.rtl-body .about-info,
body.rtl-body .footer-thumb,
body.rtl-body .team-info,
body.rtl-body .author-info,
body.rtl-body .module-form,
body.rtl-body .table,
body.rtl-body .alert,
body.rtl-body label,
body.rtl-body .field-help,
body.rtl-body .help-block {
    text-align: right !important;
}

body.rtl-body ul,
body.rtl-body ol {
    padding-right: 18px;
    padding-left: 0;
}

body.rtl-body .container {
    width: 100% !important;
    max-width: none !important;
    padding-left: 34px !important;
    padding-right: 34px !important;
}

body.rtl-body .row {
    margin-left: -12px;
    margin-right: -12px;
}

body.rtl-body [class*='col-'] {
    padding-left: 12px;
    padding-right: 12px;
}

body.rtl-body .text-left {
    text-align: right !important;
}

body.rtl-body .pull-left {
    float: right !important;
}

.site-header {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(217, 236, 155, 0.22), transparent 28%),
        linear-gradient(135deg, #253612 0%, #18240b 54%, #101807 100%);
    color: #fff;
    height: auto;
    min-height: 150px;
    display: block;
    border-bottom: none;
    padding: 26px 0 20px;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08), 0 18px 36px rgba(16, 24, 7, 0.28);
}

.site-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 22% 20%, rgba(255, 255, 255, 0.12), transparent 42%),
        radial-gradient(circle at 80% 70%, rgba(217, 236, 155, 0.08), transparent 35%);
    pointer-events: none;
}

.site-header .container {
    position: relative;
    z-index: 1;
}

.site-header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.site-header-copy {
    flex: 1 1 auto;
    min-width: 0;
}

.site-header-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(165, 196, 34, 0.18);
    border: 1px solid rgba(201, 226, 122, 0.25);
    color: #d9ec9b;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
}

.site-header-title {
    margin: 0 0 8px;
    color: #ffffff;
    font-size: 34px;
    line-height: 1.45;
    font-weight: 700;
}

.site-header-lead {
    margin: 0;
    max-width: 820px;
    color: rgba(246, 249, 239, 0.82);
    font-size: 15px;
    line-height: 1.95;
}

.site-header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 310px;
    max-width: 360px;
    padding: 16px 18px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.04) 100%);
    border: 1px solid rgba(217, 236, 155, 0.14);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(6px);
}

.site-header-logo-wrap {
    width: 88px;
    height: 88px;
    border-radius: 50px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    padding: 8px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.site-header-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 50px;
}

.site-header-brand-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.site-header-brand-text strong {
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.5;
}

.site-header-brand-text span {
    color: rgba(246, 249, 239, 0.76);
    font-size: 13px;
    line-height: 1.85;
}

.site-header-quick-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.site-header-quick-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(217, 236, 155, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
    color: #fff !important;
    white-space: nowrap;
    text-decoration: none;
}

.site-header-quick-nav a:hover,
.site-header-quick-nav a:focus {
    background: rgba(165, 196, 34, 0.18);
    border-color: rgba(201, 226, 122, 0.24);
    color: #eff8cf !important;
}

.site-header p,
.site-header span,
.site-header a {
    color: #fff;
}

.navbar.navbar-default.navbar-static-top {
    margin: -12px 34px 0;
    border: none;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 34px rgba(31, 42, 22, 0.12);
}

.navbar.navbar-default .navbar-collapse {
    border-color: transparent;
}

.navbar.navbar-default .navbar-nav > li > a {
    color: #324223;
    font-weight: 700;
    font-size: 14px;
}

.navbar.navbar-default .navbar-nav > li > a:hover,
.navbar.navbar-default .navbar-nav > li > a:focus {
    color: #6b8c18;
    background: transparent;
}

.navbar.navbar-default .dropdown-menu {
    border: 1px solid #dbe7c0;
    border-radius: 16px;
    box-shadow: 0 16px 30px rgba(29, 41, 17, 0.12);
}

.navbar-brand {
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.navbar-brand-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 50%;
}

body.rtl-body .navbar-header,
body.rtl-body .navbar-brand,
body.rtl-body .navbar-nav,
body.rtl-body .navbar-nav > li {
    float: right;
}

body.rtl-body .navbar-nav.navbar-right:last-child {
    margin-right: 0;
    margin-left: 0;
}

body.rtl-body .navbar-nav > li > a {
    text-align: right;
}

body.rtl-body .nav-user-label {
    padding: 15px 6px;
    color: #8b9b63;
    font-size: 13px;
}

body.rtl-body .nav-user-label span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

body.rtl-body .nav-logout-form {
    margin: 0;
}

body.rtl-body .nav-logout-btn {
    color: #55633a;
    font-weight: 600;
    padding: 15px 8px;
    text-decoration: none;
}

body.rtl-body .nav-logout-btn:hover,
body.rtl-body .nav-logout-btn:focus {
    color: #2c3616;
    text-decoration: none;
}

body.rtl-body .dropdown-menu {
    right: 0;
    left: auto;
    text-align: right;
}

body.rtl-body .phone-icon i,
body.rtl-body .date-icon i,
body.rtl-body .email-icon i,
body.rtl-body .navbar-brand i,
body.rtl-body .btn i,
body.rtl-body .section-btn i {
    margin-left: 6px;
    margin-right: 0;
}

.app-shell {
    padding-top: 34px;
    padding-bottom: 72px;
    min-height: 68vh;
}

.section-title h2 {
    font-size: 2.6em;
    margin-bottom: 8px;
}

.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-form .form-control {
    min-width: 180px;
}

.news-thumb {
    border: 1px solid #eef2e0;
    box-shadow: 0 14px 30px rgba(63, 78, 35, 0.08);
    border-radius: 20px;
}

body.rtl-body .form-control,
body.rtl-body input,
body.rtl-body textarea,
body.rtl-body select {
    direction: rtl;
    text-align: right;
}

body.rtl-body input::placeholder,
body.rtl-body textarea::placeholder {
    text-align: right;
}

body.rtl-body input[type='date'],
body.rtl-body input[type='time'],
body.rtl-body input[type='number'],
body.rtl-body input[type='email'],
body.rtl-body input[type='url'],
body.rtl-body input[type='tel'] {
    direction: ltr;
    text-align: left;
}

body.rtl-body .table > thead > tr > th,
body.rtl-body .table > tbody > tr > td,
body.rtl-body .table > tfoot > tr > td {
    text-align: right;
}

.student-grade-sheet {
    table-layout: fixed;
    border-collapse: collapse;
}

.student-grade-sheet th,
.student-grade-sheet td {
    border: 1px solid #d5dde6 !important;
    background: #ffffff;
}

.student-grade-sheet .grade-empty {
    background: #ffffff;
    color: transparent;
}

.student-grade-sheet .grade-term-row td {
    background: #f3f6fa;
    font-weight: 700;
    text-align: center !important;
}

.student-grade-sheet .grade-summary-row td {
    background: #f8fbff;
    font-weight: 600;
    text-align: center !important;
    color: #2a3950;
}

body.rtl-body .pagination {
    padding-right: 0;
}

body.rtl-body .pagination > li {
    float: right;
}

.module-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.module-form .full {
    grid-column: 1 / -1;
}

.module-form .form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.inline-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.inline-checks label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f5f8ec;
    border: 1px solid #dfe8c1;
    border-radius: 20px;
    padding: 6px 10px;
    font-size: 13px;
}

body.rtl-body .inline-checks label input[type='checkbox'] {
    margin-left: 6px;
    margin-right: 0;
}

.actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.actions-cell form {
    display: inline-block;
}

@media (max-width: 991px) {
    body.rtl-body .container {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
}

@media (max-width: 767px) {
    body.rtl-body .container {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .section-title h2 {
        font-size: 2.1em;
    }
}

.behavior-row {
    background: #fbfcf7;
}

.behavior-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 10px;
}

.behavior-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.behavior-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.behavior-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #e7eed2;
}

.behavior-item.merit {
    background: #f2fae2;
}

.behavior-item.violation {
    background: #fff0f0;
    border-color: #f3d2d2;
}

.behavior-modal-open {
    overflow: hidden;
}

.behavior-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.behavior-modal-overlay[hidden] {
    display: none !important;
}

.behavior-modal-card {
    width: min(680px, 100%);
    max-height: calc(100vh - 32px);
    overflow: auto;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #d9e5b8;
    box-shadow: 0 30px 50px rgba(15, 23, 42, 0.25);
}

.behavior-modal-head {
    padding: 14px 16px;
    border-bottom: 1px solid #e8efcf;
    background: linear-gradient(180deg, #f8fbf0 0%, #ffffff 100%);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.behavior-modal-head h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #2f3c16;
}

.behavior-modal-subtitle {
    margin: 2px 0 0;
    color: #6d7a4e;
    font-size: 13px;
}

.behavior-modal-close {
    border: none;
    background: #eef5d8;
    color: #516329;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.behavior-modal-close:hover {
    background: #dbe9b7;
}

.behavior-modal-body {
    padding: 16px;
}

.grades-modal-card {
    width: min(920px, 100%);
}

.grades-modal-state {
    margin-bottom: 10px;
    padding: 9px 11px;
    border-radius: 8px;
    border: 1px solid #dde7bc;
    background: #f7faee;
    color: #53642e;
    font-size: 13px;
}

.grades-modal-state.is-loading {
    background: #eef5ff;
    border-color: #cfe0f6;
    color: #385a88;
}

.grades-modal-state.is-error {
    background: #fff2f2;
    border-color: #f3d1d1;
    color: #8b2f2f;
}

.grades-modal-table td,
.grades-modal-table th {
    border: 1px solid #d5dde6 !important;
    background: #ffffff;
    vertical-align: middle !important;
}

.grades-modal-table {
    table-layout: fixed;
    border-collapse: collapse;
}

.grades-modal-term-cell {
    text-align: center !important;
    font-weight: 700;
    white-space: nowrap;
}

.grades-modal-row.is-locked td {
    background: #f7f8fb;
}

.grades-modal-table input[type='number'] {
    max-width: 100%;
}

.grades-modal-score-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.grades-modal-locked-top {
    display: flex;
    align-items: center;
    gap: 6px;
}

.grades-override-toggle {
    white-space: nowrap;
}

.grades-override-toggle.is-open {
    background: #dce9ff;
    border-color: #b3c8e8;
    color: #2c5189;
}

.grades-override-panel {
    padding: 8px;
    border: 1px dashed #d5deeb;
    border-radius: 8px;
    background: #f8fbff;
}

.grades-override-panel[hidden] {
    display: none !important;
}

.grades-override-field + .grades-override-field {
    margin-top: 6px;
}

.grades-override-label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: #425676;
}

.grades-override-reason {
    min-height: 58px;
    resize: vertical;
}

.grades-modal-locked-input {
    background: #eef1f6 !important;
    color: #8a93a2 !important;
    cursor: not-allowed;
    pointer-events: none;
}

.grades-modal-empty-row {
    color: #77855d;
    background: #fafcf5;
}

.grades-modal-actions {
    margin-top: 10px;
}

.behavior-tab-wrap {
    display: inline-flex;
    border: 1px solid #d9e6b5;
    border-radius: 9px;
    background: #f7faee;
    padding: 4px;
    gap: 4px;
}

.behavior-tab {
    border: none;
    background: transparent;
    color: #5d6f33;
    padding: 8px 14px;
    border-radius: 7px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.behavior-tab.is-active {
    background: #a5c422;
    color: #ffffff;
}

.behavior-panel {
    display: none;
    margin-top: 14px;
}

.behavior-panel.is-active {
    display: block;
}

.behavior-form-modal label {
    display: block;
    margin-bottom: 5px;
    color: #4f5f2c;
}

.behavior-form-modal .btn {
    margin-top: 8px;
}

.behavior-history-wrap {
    margin-top: 14px;
    border-top: 1px solid #ecf2da;
    padding-top: 12px;
}

.behavior-history-wrap h4 {
    margin: 0 0 8px;
    font-size: 14px;
    color: #49572c;
    font-weight: 700;
}

.behavior-empty {
    font-size: 12px;
    color: #869469;
}

.behavior-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.behavior-history-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e2ebc8;
}

.behavior-history-item.merit {
    background: #f2fae2;
}

.behavior-history-item.violation {
    background: #fff2f2;
    border-color: #f3d1d1;
}

.behavior-history-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.behavior-note {
    color: #2f3e1a;
    font-size: 13px;
}

.behavior-meta {
    color: #7b8860;
    font-size: 11px;
}

.behavior-delete-form {
    margin: 0;
    align-self: center;
}

.pagination-wrap {
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contract-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.certificate-box {
    border: 2px dashed #a5c422;
}

.signature-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    margin-top: 40px;
    text-align: center;
}

.system-footer {
    position: relative;
    margin-top: 26px;
    padding: 34px 0 20px;
    background:
        radial-gradient(circle at top left, rgba(168, 202, 44, 0.15), transparent 30%),
        linear-gradient(135deg, #253612 0%, #18240b 54%, #101807 100%);
    color: #f6f9ef;
}

.system-footer-top {
    margin-bottom: 24px;
}

.system-footer-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(165, 196, 34, 0.18);
    border: 1px solid rgba(201, 226, 122, 0.25);
    color: #d9ec9b;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
}

.system-footer-title {
    margin: 0 0 8px;
    color: #ffffff;
    font-size: 30px;
    line-height: 1.5;
    font-weight: 700;
}

.system-footer-lead {
    margin: 0;
    max-width: 920px;
    color: rgba(246, 249, 239, 0.8);
    font-size: 15px;
    line-height: 2;
}

.system-footer-grid {
    display: flex;
    align-items: stretch;
}

.system-footer-card {
    height: 100%;
    padding: 24px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(217, 236, 155, 0.14);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(6px);
}

.system-footer-card h4 {
    margin: 0 0 12px;
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
}

.system-footer .footer-thumb p,
.system-footer-contact-text {
    line-height: 2;
    color: rgba(246, 249, 239, 0.82);
    font-size: 14px;
}

.system-footer-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.system-footer-tags span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(217, 236, 155, 0.12);
    color: #d9ec9b;
    font-size: 12px;
    font-weight: 700;
}

.system-footer .footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 9px;
}

.system-footer .footer-links li {
    margin: 0;
}

.system-footer .footer-links a {
    display: inline-flex;
    align-items: center;
    color: #f7fbef;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.system-footer .footer-links a:hover,
.system-footer .footer-links a:focus {
    color: #ddee9d;
    text-decoration: none;
    transform: translateX(-2px);
}

.system-footer-map-wrap {
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(217, 236, 155, 0.16);
    background: rgba(255, 255, 255, 0.04);
    min-height: 260px;
    margin-top: 14px;
}

.system-footer-map {
    width: 100%;
    height: 260px;
    border: 0;
    display: block;
}

.system-footer-bottom {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(217, 236, 155, 0.12);
}

.system-footer .footer-copy {
    margin: 0;
    font-size: 13px;
    color: rgba(246, 249, 239, 0.75);
}

@media (max-width: 991px) {
    .module-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .behavior-grid {
        grid-template-columns: 1fr;
    }

    .site-header-logo-wrap {
        width: 70px;
        height: 70px;
    }

    .site-header-main {
        flex-direction: column;
        align-items: stretch;
    }

    .site-header-brand {
        max-width: none;
        min-width: 0;
    }

    .site-header-title {
        font-size: 28px;
    }

    .navbar.navbar-default.navbar-static-top {
        margin: -8px 20px 0;
    }

    .system-footer-title {
        font-size: 24px;
    }

    .system-footer-card {
        margin-bottom: 16px;
    }
}

@media (max-width: 767px) {
    .module-form {
        grid-template-columns: 1fr;
    }

    .filter-form .form-control {
        min-width: 100%;
    }

    .toolbar-row {
        align-items: stretch;
    }

    .toolbar-row > * {
        width: 100%;
    }

    .table {
        font-size: 12px;
    }

    .contract-meta {
        grid-template-columns: 1fr;
    }

    .site-header-quick-nav {
        width: 100%;
        justify-content: flex-start;
        margin-top: 8px;
    }

    .site-header-quick-nav a {
        width: auto;
    }

    .site-header {
        padding: 20px 0 16px;
    }

    .site-header-title {
        font-size: 24px;
    }

    .site-header-lead {
        font-size: 14px;
    }

    .site-header-brand {
        flex-direction: column;
        align-items: flex-start;
        border-radius: 20px;
    }

    .site-header-logo-wrap {
        width: 76px;
        height: 76px;
    }

    .navbar.navbar-default.navbar-static-top {
        margin: -4px 14px 0;
        border-radius: 18px;
    }

    .navbar.navbar-default .navbar-nav > li > a {
        font-size: 13px;
    }

    .system-footer {
        padding: 28px 0 18px;
    }

    .system-footer-title {
        font-size: 22px;
    }

    .system-footer-card {
        padding: 18px;
        border-radius: 18px;
    }

    .system-footer-map-wrap,
    .system-footer-map {
        min-height: 220px;
        height: 220px;
    }
}

@media (min-width: 768px) {
    body.rtl-body .navbar-right {
        float: right !important;
    }
}
