/* ===== پایه و راست‌به‌چپ ===== */
:root {
    --accent: #0d9488; /* teal 600 */
    --accent-dark: #0f766e; /* teal 700 */
    --accent-darker: #115e59; /* teal 800 */
    --accent-bg: #ccfbf1; /* teal 100 */
    --accent-text: #115e59; /* متن روی زمینه‌ی روشن teal */

    /* ===== توکن‌هایِ ساختاری (برایِ پشتیبانیِ چندتمی — Account/Profile.aspx) ===== */
    --page-bg: #f4f6f9;
    --surface: #ffffff;
    --surface-border: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --nav-hover-bg: #f3f4f6;
    --nav-hover-text: #111827;
    --input-border: #cbd5e1;
    --row-alt-bg: #f8fafc;
    --row-hover-bg: #f0fdfa;
}

/* ===== تم‌هایِ رنگی (پیکر در Account/Profile.aspx، ذخیره در UserProfile.ThemeKey) ===== */
:root[data-theme="blue"] {
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --accent-darker: #1e40af;
    --accent-bg: #dbeafe;
    --accent-text: #1e40af;
}

:root[data-theme="purple"] {
    --accent: #7c3aed;
    --accent-dark: #6d28d9;
    --accent-darker: #5b21b6;
    --accent-bg: #ede9fe;
    --accent-text: #5b21b6;
}

:root[data-theme="amber"] {
    --accent: #d97706;
    --accent-dark: #b45309;
    --accent-darker: #92400e;
    --accent-bg: #fef3c7;
    --accent-text: #92400e;
}

:root[data-theme="rose"] {
    --accent: #e11d48;
    --accent-dark: #be123c;
    --accent-darker: #9f1239;
    --accent-bg: #ffe4e6;
    --accent-text: #9f1239;
}

:root[data-theme="green"] {
    --accent: #16a34a;
    --accent-dark: #15803d;
    --accent-darker: #166534;
    --accent-bg: #dcfce7;
    --accent-text: #166534;
}

:root[data-theme="dark"] {
    --accent: #2dd4bf;
    --accent-dark: #14b8a6;
    --accent-darker: #0d9488;
    --accent-bg: #134e4a;
    --accent-text: #5eead4;

    --page-bg: #0f172a;
    --surface: #1e293b;
    --surface-border: #334155;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --nav-hover-bg: #334155;
    --nav-hover-text: #f1f5f9;
    --input-border: #475569;
    --row-alt-bg: #24334a;
    --row-hover-bg: #1e3a34;
}

* {
    box-sizing: border-box;
}

/* فونت معمولی (Normal) */
@font-face {
    font-family: 'IranSans';
    src: url('fonts/IRANSansWeb(FaNum).woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* فونت درشت (Bold) */
@font-face {
    font-family: 'IranSans';
    src: url('fonts/IRANSansWeb(FaNum)_Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}


body {
    margin: 0;
    font-family: 'IranSans', Tahoma, "Segoe UI", sans-serif;
    direction: rtl;
    text-align: right;
    background: var(--page-bg);
    color: var(--text-primary);
    line-height: 1.9;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===== هدر ===== */
.site-header {
    background: var(--surface);
    color: var(--text-primary);
    border-bottom: 1px solid var(--surface-border);
}

.header-logo {
    height: 40px;
    width: auto;
    display: block;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    flex-wrap: wrap;
    gap: 8px;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--accent-dark);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: bold;
}

    .nav-link:hover {
        background: var(--accent-bg);
        color: var(--accent-darker);
    }

.user-badge {
    color: #6b7280;
    font-size: .9rem;
}

/* ===== محتوای اصلی ===== */
.site-main {
    padding: 28px 16px;
    min-height: 60vh;
}

.card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

    .card h1, .card h2 {
        margin-top: 0;
        color: var(--accent);
    }

/* ===== فرم ورود ===== */
.login-box {
    max-width: 400px;
    margin: 40px auto;
}

.login-logo {
    text-align: center;
    margin-bottom: 10px;
}

    .login-logo img {
        height: 120px;
        width: auto;
        max-width: 100%;
    }

.login-box h2 {
    text-align: center;
}

.form-group {
    margin-bottom: 16px;
}

    .form-group label {
        display: block;
        margin-bottom: 6px;
        font-weight: bold;
    }

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    direction: rtl;
    text-align: center;
    background: var(--surface);
    color: var(--text-primary);
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 11px 22px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
}

    .btn:hover {
        background: var(--accent-dark);
    }

.btn-block {
    width: 100%;
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* پیامِ popup‌مانند بالای صفحه (toast) */
.toast-host {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 480px;
}

    .toast-host .alert {
        position: relative;
        padding-left: 34px;
        box-shadow: 0 8px 24px rgba(0,0,0,.15);
        margin-bottom: 0;
    }

.toast-close {
    position: absolute;
    top: 8px;
    left: 8px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: inherit;
    opacity: .6;
    padding: 2px 6px;
}

    .toast-close:hover {
        opacity: 1;
    }

/* ===== جدول ===== */
.table {
    width: 100%;
    border-collapse: collapse;
}

    .table th, .table td {
        border: 1px solid var(--surface-border);
        padding: 10px 12px;
        text-align: right;
        color: var(--text-primary);
    }

    .table th {
        background: var(--accent);
        color: white;
    }

.remove-all-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

    .remove-all-link:hover {
        text-decoration: underline;
    }

.remove-all-x {
    color: #fca5a5;
    font-weight: 700;
}

/* ===== فوتر ===== */
.site-footer {
    background: #1f2937;
    color: #9ca3af;
    text-align: center;
    padding: 16px;
    font-size: .85rem;
}

/* ===== گرید استاندارد ===== */
.grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.grid-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.grid-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.grid-title {
    margin: 0;
    color: var(--accent);
    font-size: 1.2rem;
}

.grid-search {
    display: flex;
    gap: 6px;
}

.grid-no-search .grid-search {
    display: none;
}

.grid-no-search-export .grid-search,
.grid-no-search-export .btn-excel,
.grid-no-search-export .btn-pdf {
    display: none;
}

.grid-search-input {
    direction: rtl;
    text-align: right;
    min-width: 220px;
}

.btn-add {
    background: #16a34a;
}

    .btn-add:hover {
        background: #15803d;
    }

.btn-excel {
    background: #08a3a8;
}

    .btn-excel:hover {
        background: #027c80;
    }

.btn-pdf {
    background: #b91c1c;
}

    .btn-pdf:hover {
        background: #991b1b;
    }

.btn-logfmt {
    background: #6d28d9;
}

    .btn-logfmt:hover {
        background: #5b21b6;
    }

.status-toggle {
    display: inline-flex;
    gap: 4px;
}

.btn-toggle {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: .8rem;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-toggle-off {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #e5e7eb;
}

    .btn-toggle-off:hover {
        background: #e5e7eb;
    }

.btn-toggle-on {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
    font-weight: 700;
}

.btn-toggle-on-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
    font-weight: 700;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    vertical-align: middle;
    margin-left: 6px;
}

    .toggle-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #ef4444;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s;
}

    .toggle-slider::before {
        content: "";
        position: absolute;
        width: 18px;
        height: 18px;
        right: 3px;
        top: 3px;
        background: #fff;
        border-radius: 50%;
        transition: transform .15s;
    }

/* توضیح: asp:CheckBox با CssClass، خودِ <input> را داخل یک <span> پیچیده رندر می‌کند،
   پس input و .toggle-slider خواهرِ مستقیمِ هم نیستند و از :has() استفاده می‌شود. */
.toggle-switch:has(input:checked) .toggle-slider {
    background: #16a34a;
}

    .toggle-switch:has(input:checked) .toggle-slider::before {
        transform: translateX(-20px);
    }

.toggle-switch:has(input:disabled) .toggle-slider {
    opacity: .5;
    cursor: not-allowed;
}

.toggle-state-text {
    font-size: .85rem;
    vertical-align: middle;
    color: #374151;
}

.form-control-sm {
    padding: 5px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
}

/* دراپ‌داونِ قابل‌جست‌وجو (enhanceSearchableSelect) */
.ss-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 500px;
    box-sizing: border-box;
}

.ss-hidden-select {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

.ss-input {
    width: 100%;
}

.ss-list {
    display: none;
    position: absolute;
    z-index: 30;
    top: 100%;
    right: 0;
    left: 0;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    margin-top: 2px;
}

.ss-item {
    padding: 6px 10px;
    font-size: .9rem;
    cursor: pointer;
}

    .ss-item:hover {
        background: #f0fdfa;
    }

/* جدول گرید */
.table.grid {
    width: 100%;
    border-collapse: collapse;
}

    .table.grid th, .table.grid td {
        border-bottom: 1px solid var(--surface-border);
        padding: 10px 12px;
        text-align: center;
        color: var(--text-primary);
    }

    .table.grid thead th {
        background: var(--accent);
        color: #fff;
        white-space: nowrap;
    }
/* لینک سرستون مرتب‌سازی: رنگ ثابت (تغییر نمی‌کند) + بدون خط زیر */
.sort-link,
.sort-link:link,
.sort-link:visited,
.sort-link:hover,
.sort-link:active {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}
/* دو مثلث بالا/پایین کنار عنوان ستون */
.sort-arrows {
    display: inline-flex;
    flex-direction: column;
    line-height: 0;
    gap: 2px;
    vertical-align: middle;
    margin-right: 6px;
}

    .sort-arrows .arrow {
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        opacity: .35;
    }

        .sort-arrows .arrow.up {
            border-bottom: 5px solid #fff;
        }

        .sort-arrows .arrow.down {
            border-top: 5px solid #fff;
        }

        .sort-arrows .arrow.on {
            opacity: 1;
        }

.table.grid tbody tr:nth-child(even) {
    background: var(--row-alt-bg);
}

.table.grid tbody tr:hover {
    background: var(--row-hover-bg);
}

.col-num {
    width: 48px;
    text-align: center;
    color: #6b7280;
}

.col-actions {
    width: 90px;
    text-align: center;
}

.link-action {
    color: var(--accent);
    text-decoration: none;
}

    .link-action:hover {
        text-decoration: underline;
    }

.icon-btn-group {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    color: var(--accent);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
}

    .icon-btn svg {
        width: 16px;
        height: 16px;
    }

    .icon-btn:hover {
        background: #f0fdfa;
    }

    .icon-btn.icon-btn-danger {
        color: #b91c1c;
    }

        .icon-btn.icon-btn-danger:hover {
            background: #fef2f2;
        }

    .icon-btn.icon-btn-disabled {
        color: #b0b0b0;
        cursor: not-allowed;
        pointer-events: none;
    }

        .icon-btn.icon-btn-disabled:hover {
            background: transparent;
        }

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
    border-radius: 12px;
    border: none;
    padding: 0;
    cursor: pointer;
    background: #cbd5e1;
    transition: background .15s;
    vertical-align: middle;
}

    .toggle-switch .knob {
        position: absolute;
        top: 2px;
        left: 2px;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 2px rgba(0,0,0,.3);
        transition: left .15s;
    }

    .toggle-switch.on {
        background: #16a34a;
    }

        .toggle-switch.on .knob {
            left: 22px;
        }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
}

.badge-pending-teacher {
    background: #fef3c7;
    color: #92400e;
}

.badge-rejected-teacher {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-pending-grouphead {
    background: #fef3c7;
    color: #92400e;
}

.badge-rejected-grouphead {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-pending-proposal {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-pending-parent {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-approved {
    background: #dcfce7;
    color: #15803d;
}

.badge-rejected {
    background: #fee2e2;
    color: #b91c1c;
}

.grid-empty {
    padding: 28px;
    text-align: center;
    color: #6b7280;
}

/* نوار صفحه‌بندی */
.grid-pagerbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
    font-size: .9rem;
}

.grid-count {
    color: #4b5563;
}

.grid-pagesize {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #4b5563;
}

.grid-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    display: inline-block;
    min-width: 34px;
    text-align: center;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: var(--accent);
    text-decoration: none;
    background: #fff;
}

    .page-btn:hover {
        background: #f0fdfa;
    }

    .page-btn.active {
        background: var(--accent);
        color: #fff;
        border-color: var(--accent);
    }

    .page-btn.disabled {
        color: #cbd5e1;
        background: #f8fafc;
        cursor: default;
    }

.page-dots {
    padding: 0 4px;
    color: #9ca3af;
}

/* ===== منوی مدیریت ===== */
.admin-nav {
    background: var(--accent-dark);
    border-top: 1px solid rgba(255,255,255,.1);
}

.admin-nav-inner {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.admin-nav a {
    color: #dbeafe;
    text-decoration: none;
    padding: 12px 16px;
    display: inline-block;
}

    .admin-nav a:hover {
        background: rgba(255,255,255,.1);
        color: #fff;
    }

/* ===== فرم‌ها ===== */
.form-row {
    margin-bottom: 16px;
    max-width: 560px;
}

    .form-row > label {
        display: block;
        margin-bottom: 6px;
        font-weight: bold;
        color: #374151;
    }

    .form-row .req {
        color: #b91c1c;
    }

.form-actions {
    margin-top: 22px;
    display: flex;
    gap: 10px;
}

.btn-cancel {
    background: #6b7280;
}

    .btn-cancel:hover {
        background: #4b5563;
    }

.field-error {
    color: #b91c1c;
    font-size: .85rem;
    margin-right: 6px;
}

textarea.form-control {
    min-height: 80px;
    direction: rtl;
    text-align: right;
}

select.form-control {
    direction: rtl;
    text-align: right;
}

.btn-del {
    background: transparent;
    color: #b91c1c;
    border: none;
    cursor: pointer;
    text-decoration: none;
    padding: 0 4px;
    font-family: inherit;
    font-size: inherit;
}

    .btn-del:hover {
        text-decoration: underline;
    }

/* واکنش‌گرا: اسکرول افقی جدول روی موبایل */
.card {
    overflow-x: auto;
}

@media (max-width: 640px) {
    .grid-toolbar, .grid-pagerbar {
        flex-direction: column;
        align-items: stretch;
    }

    .grid-search-input {
        min-width: 0;
        width: 100%;
    }
}

/* ===== پوسته‌ی پنل مدیریت (منوی کناری) ===== */
body.admin {
    background: var(--page-bg);
}

.admin-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.admin-sidebar {
    width: 234px;
    flex: 0 0 234px;
    background: var(--surface);
    border-left: 1px solid var(--surface-border);
    padding: 14px 12px 24px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 8px 18px;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 6px;
}

.brand-logo {
    height: 80px;
    width: auto;
    max-width: 100%;
}

.nav-group-title {
    font-size: .72rem;
    color: var(--text-muted);
    padding: 14px 10px 4px;
    letter-spacing: .02em;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: 9px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: .92rem;
    border-right: 3px solid transparent;
}

    .nav-item svg {
        width: 19px;
        height: 19px;
        flex: 0 0 19px;
    }

    .nav-item:hover {
        background: var(--nav-hover-bg);
        color: var(--nav-hover-text);
    }

    .nav-item.active {
        background: var(--accent-bg);
        color: var(--accent-darker);
        font-weight: bold;
        border-right-color: var(--accent);
    }

.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--surface-border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 20;
}

    .admin-topbar .crumb {
        font-size: .72rem;
        color: #9ca3af;
    }

    .admin-topbar .title {
        font-size: 1.05rem;
        font-weight: bold;
        color: #111827;
    }

.admin-topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-bg);
    color: var(--accent-darker);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .82rem;
    overflow: hidden;
    text-decoration: none;
}

    .admin-avatar .avatar-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.admin-topbar-user .uname {
    font-size: .88rem;
    color: #374151;
}

.role-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    color: #374151;
}

    .role-switcher select {
        padding: 4px 8px;
        border: 1px solid #cbd5e1;
        border-radius: 6px;
        font-family: inherit;
        font-size: .82rem;
        background: #fff;
    }

/* ===== انتخاب‌گر نقش (Account/SelectRole.aspx) ===== */
.role-pick-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.role-pick-item {
    display: block;
    padding: 14px 18px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-align: center;
    text-decoration: none;
    color: var(--accent-dark);
    font-weight: bold;
}

    .role-pick-item:hover {
        background: var(--accent-bg);
        border-color: var(--accent);
    }

.admin-logout {
    color: #9ca3af;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

    .admin-logout:hover {
        color: #b91c1c;
    }

    .admin-logout svg {
        width: 20px;
        height: 20px;
    }

.admin-content {
    padding: 22px;
    flex: 1;
}

    .admin-content .card {
        max-width: 100%;
    }

.admin-burger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: #374151;
    padding: 4px;
}

    .admin-burger svg {
        width: 24px;
        height: 24px;
    }

.admin-backdrop {
    display: none;
}

/* موبایل: منوی کناری کشویی */
@media (max-width: 860px) {
    .admin-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        transform: translateX(100%);
        transition: transform .2s ease;
        box-shadow: -4px 0 16px rgba(0,0,0,.12);
    }

    body.sidebar-open .admin-sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .admin-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 35;
        background: rgba(0,0,0,.4);
    }

    .admin-burger {
        display: inline-flex;
    }
}

/* ===== بخش تخصیص نقش در فرم کاربر ===== */
.role-add {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 6px;
}

    .role-add .form-control-sm {
        min-width: 160px;
    }

.hint {
    color: #6b7280;
    font-size: .85rem;
    margin: 4px 0 14px;
}

/* فیلدهای عددی (کد ملی، موبایل، تلفن، کد پستی، ظرفیت و...) چپ‌چین بمانند */
.form-control.ltr, .form-control-sm.ltr {
    direction: ltr;
    text-align: center;
}

/* ===== ردیف فیلتر بالای جدول ===== */
.grid-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
}

    .grid-filter .filter-item {
        display: flex;
        align-items: center;
        gap: 6px;
    }

        .grid-filter .filter-item > label {
            font-size: .85rem;
            color: #4b5563;
            white-space: nowrap;
        }

    .grid-filter select {
        min-width: 150px;
    }

    .grid-filter .meal-plan-export {
        margin-inline-start: auto;
    }

@media (max-width: 640px) {
    .grid-filter {
        flex-direction: column;
        align-items: stretch;
    }

        .grid-filter .filter-item {
            justify-content: space-between;
        }

        .grid-filter select {
            min-width: 0;
            flex: 1;
        }
}

/* نشان تعداد کنار عنوان بخش */
.count-badge {
    display: inline-block;
    background: var(--accent-bg);
    color: var(--accent-darker);
    font-size: .78rem;
    padding: 2px 10px;
    border-radius: 20px;
    margin-right: 8px;
    vertical-align: middle;
}

/* ===== ماتریس دسترسی ===== */
.perm-table th.perm-col, .perm-table td.perm-col {
    text-align: center;
    width: 108px;
}

    .perm-table td.perm-col input[type=radio] {
        width: 17px;
        height: 17px;
        cursor: pointer;
    }

.perm-table td.area-cell {
    color: #6b7280;
    font-size: .85rem;
}

.col-actions-wide {
    width: 150px;
}

.lvl {
    display: inline-block;
    font-size: .78rem;
    padding: 2px 10px;
    border-radius: 20px;
}

.lvl-full {
    background: #dcfce7;
    color: #166534;
}

.lvl-read {
    background: #fef9c3;
    color: #854d0e;
}

.lvl-none {
    background: #f1f5f9;
    color: #64748b;
}

.lvl-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* ===== CMS: ویرایشگر متن، تصویر شاخص، گالری ===== */
.form-row-wide {
    max-width: 100%;
}

.rich-editor {
    background: #fff;
}

    .rich-editor .ql-editor {
        direction: rtl;
        text-align: right;
        font-family: inherit;
        min-height: 260px;
        font-size: 1rem;
    }

    .rich-editor .ql-toolbar.ql-snow {
        direction: ltr; /* دکمه‌های ابزار همیشه چپ‌به‌راست باقی می‌مانند */
        border-radius: 8px 8px 0 0;
    }

    .rich-editor .ql-container.ql-snow {
        border-radius: 0 0 8px 8px;
    }

.ql-emoji-panel {
    position: fixed;
    z-index: 10000;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    padding: 10px;
    max-height: 260px;
    max-width: 300px;
    overflow-y: auto;
}

    .ql-emoji-panel button {
        border: none;
        background: none;
        font-size: 1.2rem;
        line-height: 1.6;
        cursor: pointer;
        border-radius: 4px;
        padding: 2px;
    }

        .ql-emoji-panel button:hover {
            background: #f1f5f9;
        }

.ql-image-resize-overlay {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid #0d9488;
    pointer-events: none;
    z-index: 5;
}

.ql-image-resize-handle {
    position: absolute;
    left: -7px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: #fff;
    border: 2px solid #000;
    border-radius: 50%;
    cursor: nesw-resize;
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

.ql-img-props-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ql-img-props-dialog {
    direction: rtl;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 20px 48px rgba(0,0,0,.25);
    padding: 16px 20px;
    width: 440px;
    max-width: 92vw;
    max-height: 88vh;
    overflow-y: auto;
}

    .ql-img-props-dialog h3 {
        margin: 0 0 12px;
        font-size: 1.05rem;
    }

.ql-img-props-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

    .ql-img-props-field .lbl {
        flex: 0 0 auto;
        font-size: .85rem;
        color: #475569;
        white-space: nowrap;
    }

    .ql-img-props-field input,
    .ql-img-props-field select {
        flex: 1 1 auto;
        min-width: 0;
        padding: 6px 8px;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        font-family: inherit;
        box-sizing: border-box;
        height: 34px;
    }

        .ql-img-props-field select[data-f="widthUnit"],
        .ql-img-props-field select[data-f="heightUnit"] {
            flex: 0 0 62px;
            padding: 2px;
        }

        .ql-img-props-field input[type="color"] {
            flex: 0 0 44px;
            padding: 2px;
        }

.ql-img-props-row {
    display: flex;
    gap: 12px;
}

    .ql-img-props-row .ql-img-props-field {
        flex: 1;
        min-width: 0;
    }

.ql-img-props-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

    .ql-img-props-actions button {
        flex: 1;
        padding: 8px;
        border-radius: 6px;
        border: 1px solid transparent;
        cursor: pointer;
        font-family: inherit;
    }

        .ql-img-props-actions button[data-act="apply"] {
            background: #0d9488;
            color: #fff;
        }

        .ql-img-props-actions button[data-act="cancel"] {
            background: #f1f5f9;
            color: #334155;
        }


.attachments-widget {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: .9rem;
}

    .attach-chip a {
        color: var(--accent);
        text-decoration: none;
    }

        .attach-chip a:hover {
            text-decoration: underline;
        }

.attach-chip-remove {
    border: none;
    background: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
}

    .attach-chip-remove:hover {
        color: #dc2626;
    }

.attach-add-btn {
    display: inline-block;
    cursor: pointer;
    color: var(--accent);
    border: 1px dashed var(--accent);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: .9rem;
    font-family: inherit;
}

    .attach-add-btn:hover {
        background: #f0fdfa;
    }

.audio-timer {
    font-family: monospace;
    font-size: 1rem;
    margin-inline-end: 10px;
    color: #374151;
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
}

    .checkbox-list label {
        font-weight: normal;
        margin-inline-start: 6px;
    }

.gallery-thumb {
    position: relative;
    display: inline-block;
    width: 96px;
    height: 96px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    margin: 0 6px 6px 0;
    vertical-align: top;
}

    .gallery-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .gallery-thumb.img-broken {
        display: flex;
        align-items: center;
        justify-content: center;
        background: #f3f4f6;
    }

        .gallery-thumb.img-broken img {
            display: none;
        }

        .gallery-thumb.img-broken::after {
            content: '🖼️';
            font-size: 28px;
            opacity: .6;
        }

.gallery-thumb-remove {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    line-height: 18px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    color: #fff;
    cursor: pointer;
    font-size: .9rem;
}

    .gallery-thumb-remove:hover {
        background: #dc2626;
    }

.gallery-thumb-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

.text-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 220px;
}

.iv-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    z-index: 9999;
}

    .iv-modal.open {
        display: block;
    }

.iv-modal-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    color: #fff;
}

.iv-modal-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.iv-modal-count {
    font-size: .9rem;
    opacity: .8;
    margin-inline-end: auto;
}

.iv-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
}

    .iv-modal-close:hover {
        color: #f87171;
    }

.iv-modal-download {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

    .iv-modal-download svg {
        width: 22px;
        height: 22px;
    }

    .iv-modal-download:hover {
        background: rgba(255,255,255,.15);
    }

.iv-modal-body {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    direction: ltr;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 70px 24px 24px;
    box-sizing: border-box;
}

.iv-modal-img {
    max-width: min(80vw, 900px);
    max-height: 80vh;
    border-radius: 8px;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform .2s ease;
}

    .iv-modal-img.zoomed {
        cursor: zoom-out;
    }

.iv-modal-nav {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    font-size: 1.6rem;
    cursor: pointer;
    flex-shrink: 0;
}

    .iv-modal-nav:hover {
        background: rgba(255,255,255,.3);
    }

.cover-preview {
    display: block;
    max-width: 260px;
    max-height: 160px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 10px;
    object-fit: cover;
}

.thumb-cell {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

/* پیش‌نمایش محتوای منتشرشده (بخش عمومی) */
.article-body {
    line-height: 2;
    font-size: 1.02rem;
}

    .article-body img {
        max-width: 100%;
        border-radius: 8px;
    }

    .article-body h1, .article-body h2, .article-body h3 {
        color: var(--accent-darker);
    }

    /* بازاستفاده از کلاس ql-editor فقط برای نمایش (نه ویرایش) روی خروجیِ ذخیره‌شده:
   کلاس‌های ql-align- /ql-indent- /ql-color- و... را همان‌طور که در ادیتور دیده شدند رندر می‌کند،
   ولی قوانین پایه‌ی خودِ ql-editor (چپ‌چین/ارتفاع ثابت/اسکرول) که برای جعبه‌ی ویرایش‌پذیر است را خنثی می‌کند. */
    .article-body.ql-editor,
    .msg-bubble-body.ql-editor {
        height: auto;
        overflow: visible;
        text-align: right;
        direction: rtl;
        padding: 0;
    }

/* ===== بخش عمومی: اخبار و گالری ===== */
.hero-card {
    text-align: center;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 28px 0 14px;
}

    .section-head h2 {
        margin: 0;
        color: var(--accent-darker);
        font-size: 1.15rem;
    }

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.news-card {
    display: block;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .15s ease, transform .15s ease;
}

    .news-card:hover {
        box-shadow: 0 4px 14px rgba(0,0,0,.08);
        transform: translateY(-2px);
    }

.news-card-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.news-card-body {
    padding: 14px 16px;
}

.news-card-cat {
    display: inline-block;
    background: var(--accent-bg);
    color: var(--accent-darker);
    font-size: .74rem;
    padding: 2px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.news-card-body h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    line-height: 1.6;
    color: #111827;
}

.news-card-date {
    color: #9ca3af;
    font-size: .8rem;
}

.public-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 24px 0 8px;
}

.public-pager-info {
    color: #6b7280;
    font-size: .9rem;
}

.article-cover {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    border-radius: 10px;
    margin: 14px 0;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.photo-item {
    position: relative;
    display: block;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    background: #000;
}

    .photo-item img {
        width: 100%;
        height: 150px;
        object-fit: cover;
        display: block;
        opacity: .95;
    }

    .photo-item:hover img {
        opacity: 1;
    }

.photo-caption {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    background: linear-gradient(to top, rgba(0,0,0,.65), transparent);
    color: #fff;
    font-size: .8rem;
    padding: 18px 10px 8px;
}

/* ===== پرتال کادر و پرتال دانش‌آموز/والدین ===== */
.child-block {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

    .child-block:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .child-block h3 {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 1rem;
        margin: 0 0 10px;
        color: #111827;
    }

/* ===== پیام‌رسانی ===== */
.nav-badge {
    display: inline-block;
    background: #dc2626;
    color: #fff;
    font-size: .7rem;
    line-height: 1;
    padding: 3px 7px;
    border-radius: 20px;
    margin-right: auto;
}

.msg-card {
    display: block;
    width: 100%;
    text-align: right;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

    .msg-card:hover {
        border-color: var(--accent);
    }

    .msg-card.unread {
        border-right: 4px solid var(--accent);
        background: #f0fdfa;
    }

.msg-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.msg-card-subject {
    font-weight: bold;
    color: #111827;
}

.msg-card-date {
    color: #9ca3af;
    font-size: .78rem;
    white-space: nowrap;
}

.msg-card-meta {
    color: #6b7280;
    font-size: .82rem;
    margin-bottom: 4px;
}

.msg-card-preview {
    color: #4b5563;
    font-size: .88rem;
    white-space: pre-wrap;
}

.msg-bubble {
    max-width: 640px;
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #f3f4f6;
}

    .msg-bubble.mine {
        background: var(--accent-bg);
        margin-right: auto;
    }

.msg-bubble-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: .78rem;
    color: #6b7280;
    margin-bottom: 6px;
}

.msg-bubble-body {
    line-height: 1.9;
}

.rich-content img {
    max-width: 100%;
    border-radius: 8px;
}

.rich-content p {
    margin: 0 0 8px;
}

    .rich-content p:last-child {
        margin-bottom: 0;
    }

.audience-group {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.audience-group-title {
    font-weight: bold;
    font-size: .88rem;
    color: var(--accent-darker);
    margin-bottom: 6px;
}

.audience-option {
    display: block;
    padding: 3px 0;
    font-size: .9rem;
}

    .audience-option input {
        margin-left: 6px;
    }

.rules-group-row td {
    background: #f8fafc;
    font-weight: bold;
    padding-top: 16px;
    color: var(--accent-darker);
}

.reach-select {
    min-width: 110px;
}

/* دیت‌پیکر شمسی */
.pdp-popup {
    position: absolute;
    z-index: 1100;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    padding: 10px;
    width: 260px;
    direction: rtl;
}

.pdp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

    .pdp-header button {
        border: none;
        background: none;
        cursor: pointer;
        font-size: 1.1rem;
        color: var(--accent);
        padding: 2px 8px;
    }

.pdp-month-select, .pdp-year-select {
    border: none;
    background: none;
    font-weight: bold;
    font-size: .85rem;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
}

.pdp-year-select {
    max-width: 60px;
}

.pdp-weekrow, .pdp-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}

    .pdp-weekrow span {
        font-size: .8rem;
        color: #94a3b8;
        padding-bottom: 4px;
    }

    .pdp-grid button {
        border: none;
        background: none;
        cursor: pointer;
        padding: 6px 0;
        border-radius: 6px;
        font-size: .9rem;
    }

        .pdp-grid button:hover {
            background: #f1f5f9;
        }

        .pdp-grid button.pdp-weekend {
            background: #e2e8f0;
            color: #475569;
        }

        .pdp-grid button.pdp-holiday {
            background: #fecaca;
            color: #991b1b;
            font-weight: 700;
        }

        .pdp-grid button.pdp-disabled {
            cursor: not-allowed;
            opacity: .6;
        }

        .pdp-grid button.pdp-selected {
            background: var(--accent) !important;
            color: #fff !important;
        }

.pdp-time {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 8px;
    direction: ltr;
}

    .pdp-time select {
        padding: 4px;
    }

.pdp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.meal-plan-holiday-row {
    background: #fef2f2;
    color: #b91c1c;
}

.pdp-today {
    border: none;
    background: none;
    color: var(--accent);
    cursor: pointer;
    font-size: .85rem;
    font-family: inherit;
}

/* ===== برنامه کلاسی ===== */
.col-actions-schedule {
    width: 190px;
    text-align: center;
}

.schedule-table-wrap {
    overflow-x: auto;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
}

    .schedule-table th,
    .schedule-table td {
        border: 1px solid #e5e7eb;
        padding: 8px 10px;
        text-align: center;
        white-space: pre-line;
        font-size: .85rem;
    }

    .schedule-table th {
    }



.schedule-table-wrap .day-date-sub {
    display: block;
    font-size: .75rem;
    color: #6b7280;
    margin-top: 2px;
}

.text-muted {
    color: #6b7280;
    margin-bottom: 12px;
}

/* ===== پروفایل کاربر ===== */
.profile-card {
    max-width: 640px;
    margin-bottom: 20px;
}

.profile-photo-wrap {
    position: relative;
    width: 120px;
    margin: 0 auto 24px;
    text-align: center;
}

.profile-photo-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: var(--accent-bg);
    color: var(--accent-darker);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    overflow: hidden;
    margin: 0 auto;
}

    .profile-photo-circle .profile-photo-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.profile-photo-pencil {
    position: absolute;
    bottom: 0;
    left: calc(50% - 90px);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .profile-photo-pencil svg {
        width: 16px;
        height: 16px;
    }

.profile-photo-menu {
    position: absolute;
    top: 130px;
    right: calc(50% - 90px);
    width: 180px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    z-index: 20;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

    .profile-photo-menu button,
    .profile-photo-menu a {
        border: none;
        background: none;
        padding: 10px 14px;
        text-align: right;
        cursor: pointer;
        font-family: inherit;
        font-size: .85rem;
        color: #111827;
        text-decoration: none;
    }

        .profile-photo-menu button:hover,
        .profile-photo-menu a:hover {
            background: #f3f4f6;
        }

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-info-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.profile-info-label {
    width: 160px;
    flex-shrink: 0;
    color: #6b7280;
    font-size: .88rem;
}

.profile-info-value {
    flex: 1;
    color: #111827;
    font-size: .9rem;
}

.role-badge {
    display: inline-block;
    background: var(--accent-bg);
    color: var(--accent-darker);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: .78rem;
    margin-inline-end: 6px;
    margin-bottom: 4px;
}

/* ===== دیالوگ برش عکس پروفایل ===== */
.crop-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crop-modal-body {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.crop-stage {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 12px auto;
    background: #111;
    border-radius: 8px;
    overflow: hidden;
}

#cropCanvas {
    display: block;
    cursor: move;
    touch-action: none;
}

.crop-circle-mask {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 2000px rgba(0,0,0,.55);
    pointer-events: none;
}

#cropZoom {
    width: 260px;
}

.crop-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
}

/* ===== صفحات خطا (400/500) ===== */
.error-page {
    text-align: center;
    padding: 36px 16px 20px;
}

.error-illustration {
    width: 170px;
    height: 170px;
    margin: 4px auto 18px;
}

.error-code {
    display: inline-block;
    font-size: 5.2rem;
    font-weight: 700;
    line-height: 1;
    margin: 0 0 8px;
    letter-spacing: 3px;
    color: var(--accent);
    transform: rotate(-2deg);
}

.error-code-500 {
    color: #b45309; /* amber-700 — هم‌راستا با تمِ «زنگ تفریح» */
    transform: rotate(2deg);
}

.error-code-404 {
    color: #475569; /* slate-600 — هم‌راستا با تمِ «گم‌شدن» */
    transform: rotate(0deg);
}

.error-title {
    font-size: 1.35rem;
    margin: 0 0 10px;
    color: #1f2937;
}

.error-desc {
    max-width: 460px;
    margin: 0 auto 26px;
    color: #4b5563;
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-outline {
    background: #fff;
    color: var(--accent-dark);
    border: 1px solid var(--accent);
}

    .btn-outline:hover {
        background: var(--accent-bg);
    }

/* ===== نشان فاصله‌ی تولد (لیست/ویجت تولدها) ===== */
.bday-interval {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: .85rem;
}

    .bday-interval.bday-soon {
        background: #ffedd5;
        color: #9a3412;
    }

    .bday-interval.bday-today {
        background: #dcfce7;
        color: #15803d;
        font-weight: 700;
    }

/* ===== پنل جشن تولد ===== */
.bday-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bdayFadeIn .35s ease;
}

@keyframes bdayFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.bday-panel {
    position: relative;
    background: linear-gradient(180deg, #fff 0%, var(--accent-bg) 100%);
    border-radius: 20px;
    padding: 40px 32px 32px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    overflow: hidden;
    animation: bdayPopIn .5s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes bdayPopIn {
    from {
        transform: scale(.6);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.bday-cake {
    font-size: 4.5rem;
    display: inline-block;
    animation: bdayBounce 1.4s ease-in-out infinite;
}

@keyframes bdayBounce {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-14px);
    }
}

.bday-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-darker);
    margin: 10px 0 6px;
}

.bday-message {
    color: #374151;
    margin-bottom: 6px;
}

.bday-balloons {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: 20px;
}

.bday-balloon {
    position: absolute;
    bottom: -60px;
    font-size: 2.4rem;
    animation-name: bdayFloat;
    animation-timing-function: ease-in;
    animation-iteration-count: infinite;
}

    .bday-balloon:nth-child(1) {
        left: 8%;
        animation-duration: 5s;
        animation-delay: 0s;
    }

    .bday-balloon:nth-child(2) {
        left: 24%;
        animation-duration: 6.5s;
        animation-delay: .8s;
    }

    .bday-balloon:nth-child(3) {
        left: 68%;
        animation-duration: 5.5s;
        animation-delay: .3s;
    }

    .bday-balloon:nth-child(4) {
        left: 84%;
        animation-duration: 7s;
        animation-delay: 1.2s;
    }

    .bday-balloon:nth-child(5) {
        left: 46%;
        animation-duration: 6s;
        animation-delay: .5s;
    }

@keyframes bdayFloat {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        transform: translateY(-420px) rotate(8deg);
        opacity: 0;
    }
}

.bday-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
}

.bday-panel-controls {
    position: absolute;
    top: 10px;
    left: 12px;
    display: flex;
    gap: 8px;
}

.bday-icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .8);
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

    .bday-icon-btn:hover {
        background: #fff;
    }

.bday-widget-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
}

    .bday-widget-row.bday-soon {
        background: #fff7ed;
    }

    .bday-widget-row.bday-today {
        background: #f0fdf4;
    }

.bday-widget-name {
    font-weight: 600;
    color: #1f2937;
}

.bday-widget-meta {
    font-size: .8rem;
    color: #6b7280;
}

/* ===== رنگ ردیفِ ویجتِ داشبورد: گذشته=قرمز، مانده=زرد، امروز=سبز ===== */
.bday-widget-row.bday-row-past {
    background: #fee2e2;
}

.bday-widget-row.bday-row-soon {
    background: #fef9c3;
}

.bday-widget-row.bday-row-today {
    background: #dcfce7;
}

.bday-interval.bday-row-past {
    background: #fecaca;
    color: #991b1b;
}

.bday-interval.bday-row-soon {
    background: #fef08a;
    color: #854d0e;
}

.bday-interval.bday-row-today {
    background: #dcfce7;
    color: #15803d;
    font-weight: 700;
}

.bday-group + .bday-group {
    margin-top: 16px;
}

/* ===== بخش‌های زمانیِ ویجتِ داشبورد (امروز/به‌زودی/به‌تازگی‌گذشته) ===== */
.bday-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 18px 0 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid;
}

    .bday-section-title.bday-section-today {
        color: #15803d;
        border-color: #bbf7d0;
    }

    .bday-section-title.bday-section-soon {
        color: #9a3412;
        border-color: #fed7aa;
    }

    .bday-section-title.bday-section-past {
        color: #6b7280;
        border-color: #e5e7eb;
    }

/* ===== کارتِ تولدِ فرزند (داشبورد والد) ===== */
.bday-child-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    color: #fff;
}

.bday-child-cake {
    font-size: 2.8rem;
    flex-shrink: 0;
}

.bday-child-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.bday-child-message {
    color: #f0fdfa;
}

/* ===== مناسبت‌ها: کارت (داشبورد) و پاپ‌آپ ===== */
.occ-card {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #fff;
}

.occ-card-icon {
    font-size: 2.8rem;
    flex-shrink: 0;
}

.occ-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.occ-card-message {
    color: rgba(255,255,255,.92);
}

.occ-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bdayFadeIn .35s ease;
}

.occ-panel {
    position: relative;
    border-radius: 20px;
    padding: 40px 32px 32px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    color: #fff;
    animation: bdayPopIn .5s cubic-bezier(.34, 1.56, .64, 1);
}

.occ-close-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255,255,255,.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

    .occ-close-btn:hover {
        background: rgba(255,255,255,.35);
    }

.occ-popup-icon {
    font-size: 3.5rem;
    line-height: 1;
}

.occ-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 10px 0 10px;
}

.occ-message {
    color: rgba(255,255,255,.92);
    margin-bottom: 18px;
}

.occ-actions .btn {
    background: #fff;
    color: #1f2937;
}

    .occ-actions .btn:hover {
        background: #f1f5f9;
    }

/* ===== انتخاب‌گرِ تمِ رنگی (Admin/OccasionEdit) ===== */
.occ-theme-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.occ-theme-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

    .occ-theme-swatch.selected {
        border-color: #b00abb;
    }

/* ===== انتخاب‌گرِ آیکن (Admin/OccasionEdit) ===== */
.occ-icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.occ-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid #e2e8f0;
    background: #fff;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .occ-icon-btn.selected {
        border-color: #0d9488;
        background: #f0fdfa;
    }

/* ===== دکمه‌ی توگلِ فعال/غیرفعال (Admin/Occasions) ===== */
.toggle-switch {
    display: inline-block;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: #cbd5e1;
    position: relative;
    cursor: pointer;
    border: none;
    vertical-align: middle;
    transition: background .2s;
}

    .toggle-switch.on {
        background: #0d9488;
    }

    .toggle-switch .toggle-knob {
        position: absolute;
        top: 2px;
        right: 2px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,.3);
        transition: right .2s;
    }

    .toggle-switch.on .toggle-knob {
        right: 22px;
    }

.bday-group-title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--accent-darker);
    margin: 0 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
}

/* ===== جزئیات ویدئوی آموزشی ===== */
.video-detail-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    margin: 16px 0 24px;
    background: #e5e7eb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.video-detail-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
}

    .video-detail-row.video-detail-row-wide {
        grid-column: 1 / -1;
    }

.video-detail-label {
    font-size: .8rem;
    font-weight: 700;
    color: #6b7280;
}

.video-detail-value {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

    .video-detail-value.rich-content {
        font-weight: 400;
        line-height: 1.9;
        color: #374151;
    }

@media (max-width: 640px) {
    .video-detail-list {
        grid-template-columns: 1fr;
    }
}

.video-player-wrap {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 24px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 6px 24px rgba(0,0,0,.18);
}

    .video-player-wrap video {
        display: block;
        width: 100%;
        aspect-ratio: 16 / 9;
        object-fit: cover;
        background: #000;
    }

    .video-player-wrap.playing video {
        object-fit: scale-down;
    }

    .video-player-wrap.video-error video {
        display: none;
    }

.video-player-error {
    display: none;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    color: #9ca3af;
    background: #111827;
    text-align: center;
    padding: 16px;
}

.video-player-wrap.video-error .video-player-error {
    display: flex;
}

.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    border: 3px solid #fff;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background .15s;
}

    .video-play-btn:hover {
        background: rgba(13,148,136,.85);
    }

    .video-play-btn svg {
        width: 30px;
        height: 30px;
        margin-right: -3px;
    }

.video-player-wrap.playing .video-play-btn,
.video-player-wrap.video-error .video-play-btn {
    display: none;
}

.video-skip-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(0,0,0,.45);
    border: 2px solid rgba(255,255,255,.85);
    color: #fff;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: background .15s;
}

    .video-skip-btn span:first-child {
        font-size: 1.1rem;
    }

    .video-skip-btn span:last-child {
        font-size: .65rem;
        font-weight: 700;
    }

    .video-skip-btn:hover {
        background: rgba(13,148,136,.85);
    }

.video-skip-back {
    left: 15%;
}

.video-skip-fwd {
    right: 15%;
}

.video-player-wrap.playing .video-skip-btn {
    display: flex;
}

.video-player-wrap.video-error .video-skip-btn {
    display: none;
}

/* ===== ردیف‌های دیده‌شده/ندیده‌ی لیست ویدئوها ===== */
.table.grid tbody tr.video-row-unseen {
    background: #fff7ed;
}

.table.grid tbody tr.video-row-seen {
    background: #f0fdf4;
}

.table.grid tbody tr.video-row-unseen:hover {
    background: #fef0dd;
}

.table.grid tbody tr.video-row-seen:hover {
    background: #e6fbec;
}

/* ===== رادیوباتنِ نمره‌ی عملکرد ===== */
.score-radio-list label {
    margin-left: 12px;
    white-space: nowrap;
}

.score-radio-list td {
    border: none !important;
}

.score-radio-list input[type="radio"] {
    transform: scale(2); /* 1.5 برابر بزرگتر */
    margin: 10px; /* برای فاصله بهتر */
}

/* ===== ردیفِ غایب در جدولِ ثبتِ حضور و غیاب ===== */
.table.grid tbody tr.attendance-row-absent {
    background: #fef2f2;
}

    .table.grid tbody tr.attendance-row-absent:hover {
        background: #fde3e3;
    }

/* ===== پنل هاورِ ستون دسترسی ===== */
.access-count-cell {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.access-tooltip {
    display: none;
    padding: 15px;
    position: fixed;
    z-index: 200;
    min-width: 260px;
    max-width: 370px;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    text-align: right;
    font-weight: 400;
}

    .access-tooltip.open {
        display: block;
    }

    .access-tooltip table {
        width: 100%;
        border-collapse: collapse;
        font-size: .8rem;
    }

    .access-tooltip th, .access-tooltip td {
        padding: 6px 8px;
        border-bottom: 1px solid #f0f0f0;
        white-space: nowrap;
    }

    .access-tooltip th {
        position: sticky;
        top: 0;
        background: #f8fafc;
        color: #374151;
    }

.bday-widget-row + .bday-widget-row {
    margin-top: 6px;
}

/* ===== تقویم (Portal/Calendar.aspx) ===== */
.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 10px 0;
}

.cal-nav-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 12px;
    font-size: .85rem;
    color: #555;
}

    .cal-legend span {
        display: inline-flex;
        align-items: center;
        gap: 5px;
    }

.cal-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.dot-birthday { background: #ec4899; }
.dot-occasion { background: #f59e0b; }
.dot-holiday { background: #ef4444; }
.dot-evaluation { background: #3b82f6; }
.dot-homework { background: #8b5cf6; }
.dot-gallery { background: #14b8a6; }
.dot-attendance { background: #22c55e; }

.cal-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

    .cal-table th {
        padding: 8px 4px;
        text-align: center;
        font-size: .85rem;
        color: #666;
        border-bottom: 1px solid #e5e7eb;
    }

.cal-day {
    height: 78px;
    vertical-align: top;
    border: 1px solid #eef0f2;
    padding: 6px;
    cursor: pointer;
    background: #fff;
    transition: background .15s;
}

    .cal-day:hover {
        background: #f8fafc;
    }

    .cal-day.empty {
        cursor: default;
        background: #fafafa;
    }

    .cal-day.weekend {
        background: #f1f5f9;
    }

        .cal-day.weekend:hover {
            background: #e7edf3;
        }

    .cal-day.has-item {
        background: var(--accent-bg);
    }

        .cal-day.has-item:hover {
            background: #b8f2e8;
        }

    .cal-day.is-today .cal-day-num {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
        border-radius: 50%;
        background: var(--accent);
        color: #fff;
    }

.cal-day-num {
    font-size: .9rem;
    font-weight: 600;
}

.cal-day-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 6px;
}

.cal-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.cal-popup {
    background: #fff;
    border-radius: 10px;
    width: 92%;
    max-width: 460px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cal-popup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.cal-popup-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.cal-popup-body {
    padding: 14px 16px;
    overflow-y: auto;
}

.cal-pop-item {
    padding: 8px 10px;
    border-radius: 6px;
    background: #f8fafc;
    margin-bottom: 6px;
    font-size: .9rem;
}

.cal-pop-owner {
    font-weight: 700;
    margin: 12px 0 6px;
    color: var(--accent-darker);
}

    .cal-pop-owner:first-child {
        margin-top: 0;
    }

.cal-pop-holiday { background: #fee2e2; }
.cal-pop-occasion { background: #fef3c7; }
.cal-pop-birthday { background: #fce7f3; }
.cal-pop-muted { background: #f1f5f9; color: #64748b; font-size: .85rem; }

/* ===== پیکرِ تم (Account/Profile.aspx) ===== */
.theme-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.theme-swatch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--surface-border);
    background: var(--surface);
    color: var(--text-primary);
    text-decoration: none;
    font-size: .85rem;
    cursor: pointer;
}

    .theme-swatch:hover {
        border-color: var(--text-muted);
    }

    .theme-swatch.active {
        border-color: var(--accent);
        background: var(--accent-bg);
        color: var(--accent-text);
        font-weight: bold;
    }

.theme-swatch-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 14px;
}

/* ===== نوارِ حالتِ «دیدن به‌جایِ کاربر» ===== */
.impersonation-bar {
    background: #7c2d12;
    color: #fff;
    padding: 10px 20px;
    text-align: center;
    font-size: .88rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

    .impersonation-bar a {
        color: #fed7aa;
        font-weight: bold;
        text-decoration: underline;
        margin-inline-start: 10px;
    }

/* ===== آمارِ مجموعه (Admin/OrgStats.aspx) ===== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--page-bg);
    border-radius: var(--radius, 10px);
    padding: 16px;
    text-align: center;
}

.stat-card-num {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent);
}

.stat-card-label {
    font-size: .82rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.stat-section h3 {
    margin: 0 0 10px;
    font-size: .95rem;
}

.stat-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-bar-row {
    display: grid;
    grid-template-columns: 110px 1fr 40px;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
}

.stat-bar-label {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-bar-track {
    background: var(--surface-border);
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
}

.stat-bar-fill {
    background: var(--accent);
    height: 100%;
    border-radius: 6px;
}

.stat-bar-count {
    text-align: left;
    font-weight: bold;
}
