@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/samim-font@v4.1.0/dist/font-face.css');

:root {
    --ink: #20262a;
    --deep: #1f3a44;
    --deep-dark: #142930;
    --gold: #b6902c;
    --paper: #faf8f3;
    --line: #dcd6c8;
    --danger: #a13d3d;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    line-height: 1.8;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: 'Samim', 'Vazirmatn', Tahoma, sans-serif;
    font-weight: 700;
    margin: 0 0 .5em;
}

.site-header {
    background: var(--deep);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.site-header .brand {
    font-family: 'Samim', 'Vazirmatn', Tahoma, sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
}

.site-header nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .6rem;
}

.site-header nav a {
    color: #e7e3d8;
    text-decoration: none;
    padding: .45rem 1.1rem;
    border-radius: 999px;
    background: rgba(255,255,255,.1);
    border: 1.5px solid rgba(255,255,255,.22);
    font-weight: 600;
    display: inline-block;
    transition: all .15s ease;
}

.site-header nav a:hover {
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.35);
}
.site-header nav a.active {
    background: var(--gold);
    color: var(--deep-dark);
    font-weight: 700;
    border-color: var(--gold);
}

.site-header nav .pill {
    background: var(--gold);
    color: var(--deep-dark);
    font-weight: 700;
}
.site-header nav .pill.active { background: #fff; }

.site-header nav .muted { color: #cfcabb; }

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

.hero {
    text-align: center;
    padding: 3rem 1rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2.5rem;
}

.hero h1 { font-size: 2.4rem; color: var(--deep); }
.hero p { color: #555; font-size: 1.1rem; }

.section { margin-bottom: 3rem; }
.section.narrow { max-width: 640px; margin-inline: auto; }
.section h2 {
    color: var(--deep);
    border-right: 4px solid var(--gold);
    padding-right: .6rem;
    margin-bottom: 1.2rem;
}

.news-card {
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1.2rem 1.4rem;
    margin-bottom: 1rem;
    background: #fff;
}
.news-card h3 { color: var(--deep-dark); margin-bottom: .2rem; }
.news-card time { color: var(--gold); font-size: .9rem; }
.news-card p { margin-top: .6rem; }
.news-img {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: .8rem;
}

.link-more {
    color: var(--deep);
    font-weight: 700;
    text-decoration: none;
}

.muted { color: #777; }

.error { color: var(--danger); font-weight: 700; }
.notice {
    background: #eef4ee;
    border: 1px solid #bcd6bc;
    color: #2c5c2c;
    padding: .8rem 1.2rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

form label {
    display: block;
    margin-bottom: 1rem;
    font-size: .95rem;
    color: #444;
}

.checkbox-row {
    display: flex !important;
    align-items: center;
    gap: .6rem;
    margin-bottom: .7rem !important;
}
.checkbox-row input[type="checkbox"] {
    width: auto !important;
    margin: 0 !important;
}

form input, form select, form textarea {
    display: block;
    width: 100%;
    margin-top: .35rem;
    padding: .6rem .7rem;
    border: 1px solid var(--line);
    border-radius: 3px;
    font-family: inherit;
    font-size: 1rem;
    background: #fff;
}

form textarea { min-height: 100px; resize: vertical; }

button {
    background: var(--deep);
    color: #fff;
    border: none;
    padding: .65rem 1.6rem;
    border-radius: 3px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
}
button:hover { background: var(--deep-dark); }
button.danger { background: transparent; color: var(--danger); padding: .3rem .8rem; border: 1px solid var(--danger); }
button.danger:hover { background: var(--danger); color: #fff; }

.login-box {
    border: 1px solid var(--line);
    background: #fff;
    padding: 2rem;
    border-radius: 4px;
}

.auth-tabs {
    display: flex;
    gap: .6rem;
    margin-bottom: 1.5rem;
}
.auth-tabs a {
    text-decoration: none;
    color: var(--deep);
    background: #f1eee4;
    border: 1.5px solid var(--line);
    padding: .55rem 1.2rem;
    border-radius: 999px;
    font-size: .95rem;
    font-weight: 600;
    display: inline-block;
    transition: all .15s ease;
}
.auth-tabs a:hover { border-color: var(--gold); }
.auth-tabs a.active {
    background: var(--deep);
    color: #fff;
    border-color: var(--deep);
    font-weight: 700;
}

.panel-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-bottom: 2rem;
    border-bottom: none;
}
.panel-tabs a {
    text-decoration: none;
    color: var(--deep);
    background: #f1eee4;
    border: 1.5px solid var(--line);
    padding: .55rem 1.1rem;
    border-radius: 999px;
    font-size: .95rem;
    font-weight: 600;
    display: inline-block;
    transition: all .15s ease;
}
.panel-tabs a:hover { border-color: var(--gold); background: #e9e4d4; }
.panel-tabs a.active {
    background: var(--deep);
    color: #fff;
    border-color: var(--deep);
    font-weight: 700;
}

.panel-tabs.sub-tabs {
    margin-bottom: 1.2rem;
}
.panel-tabs.sub-tabs a {
    font-size: .85rem;
    padding: .4rem .9rem;
}

details.show-more {
    margin: -0.4rem 0 1.5rem;
}
details.show-more summary {
    cursor: pointer;
    list-style: none;
    display: inline-block;
    color: var(--deep);
    background: #fff;
    border: 1px solid var(--line);
    padding: .5rem 1.1rem;
    border-radius: 999px;
    font-size: .9rem;
    margin-top: .5rem;
}
details.show-more summary::-webkit-details-marker { display: none; }
details.show-more summary:hover { border-color: var(--gold); }
details.show-more[open] summary { margin-bottom: 1rem; }
details.show-more table { margin-top: .5rem; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1.2rem;
    text-align: center;
}
.stat-card .num {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--deep);
    font-family: 'Samim', 'Vazirmatn', Tahoma, sans-serif;
}
.stat-card .label { color: #777; font-size: .9rem; }

.student-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .8rem;
    justify-content: space-between;
}
.student-card strong { color: var(--deep-dark); flex: 1 1 140px; }

.student-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: center;
}
.student-actions a {
    color: var(--deep);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
    background: #f1eee4;
    border: 1px solid var(--line);
    padding: .4rem .8rem;
    border-radius: 999px;
}
.student-actions a:hover { border-color: var(--gold); }
.student-actions form { margin: 0; }
.student-actions button { padding: .4rem 1rem; font-size: .9rem; }

.absent-form, .note-form {
    display: flex;
    gap: .5rem;
    align-items: center;
}
.absent-form input[type="text"], .note-form textarea {
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: .4rem .6rem;
    font-family: inherit;
}
.note-form { width: 100%; margin-top: .5rem; }
.note-form textarea { flex: 1; min-height: 50px; resize: vertical; }

.badge {
    font-size: .85rem;
    padding: .25rem .7rem;
    border-radius: 3px;
    background: #f1eee4;
    color: var(--deep-dark);
}
.badge.present { background: #eef4ee; color: #2c5c2c; }
.badge.absent { background: #f7e9e9; color: var(--danger); }

.row-actions {
    display: flex;
    align-items: center;
    gap: .7rem;
    white-space: nowrap;
}
.row-actions a, .history-row .row-actions a, .news-card .row-actions a {
    color: var(--deep);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    background: #f1eee4;
    border: 1px solid var(--line);
    padding: .3rem .8rem;
    border-radius: 999px;
}
.row-actions a:hover, .history-row .row-actions a:hover, .news-card .row-actions a:hover { border-color: var(--gold); }
.row-actions form, .history-row .row-actions form, .news-card .row-actions form { margin: 0; }
.row-actions button, .history-row .row-actions button, .news-card .row-actions button { padding: .3rem .8rem; font-size: .85rem; }

.history-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: .8rem 1rem;
    margin-bottom: .6rem;
}
.history-row .row-actions {
    margin-inline-start: auto;
    display: flex;
    align-items: center;
    gap: .7rem;
}

.history-edit-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    background: #fbf8ee;
    border: 1px solid var(--gold);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: .6rem;
}
.history-edit-form label { margin-bottom: 0; flex: 1 1 140px; }
.history-edit-form textarea { width: 100%; min-height: 70px; }

.news-card .row-actions {
    display: flex;
    gap: .8rem;
    margin-top: .5rem;
}

.schedule-wrap, .table-wrap { overflow-x: auto; margin-bottom: 1rem; -webkit-overflow-scrolling: touch; }
.schedule-table { min-width: 700px; }
.schedule-table select {
    width: 100%;
    padding: .35rem .4rem;
    font-size: .85rem;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    border: 1px solid var(--line);
    background: #fff;
    padding: 1.2rem;
    border-radius: 4px;
}
.inline-form label { flex: 1 1 160px; margin-bottom: 0; }
.inline-form label.full { flex: 1 1 100%; }
.inline-form button { flex: 0 0 auto; height: fit-content; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    background: #fff;
}
.data-table th, .data-table td {
    border: 1px solid var(--line);
    padding: .6rem .8rem;
    text-align: right;
}
.data-table th { background: #f1eee4; color: var(--deep-dark); }

.site-footer {
    text-align: center;
    color: #888;
    padding: 2rem;
    border-top: 1px solid var(--line);
}
