/* =====================================================================
   responsive.css — قواعد ریسپانسیو (موبایل / تبلت / دسکتاپ)
   در هر دو صفحه index.html و admin/index.html بارگذاری می‌شود
===================================================================== */

    /* ---------- ریسپانسیو ---------- */
    @media (max-width: 1220px) {
        .main-nav { display: none; }
        .hamburger { display: flex; }
    }
    @media (max-width: 1220px) {
        .main-nav.mobile-open {
            display: flex; flex-direction: column; position: absolute; top: 100%; right: 0; left: 0; background: #fff;
            box-shadow: 0 12px 20px rgba(0,0,0,0.08); padding: 10px; gap: 2px; z-index: 700;
        }
    }
    /* دور ۲۸: بین ۱۲۲۱ تا ۱۴۰۰ پیکسل (منو هنوز افقی است) اگر نام مدرسه بلند باشد دکمه‌های سمت چپ هدر بیرون می‌زد؛ کمی فشرده‌تر می‌شود */
    @media (min-width: 1221px) and (max-width: 1400px) {
        .nav-bar { padding-left: 14px; padding-right: 14px; gap: 8px; }
        .main-nav a { padding: 9px 7px; font-size: 13px; }
        .nav-actions { gap: 6px; }
        .brand { font-size: 17px; gap: 8px; }
        .nav-actions .btn-sm { padding: 8px 11px; }
    }
    @media (max-width: 992px) {
        .quick-grid { grid-template-columns: repeat(2,1fr); margin-top: -60px; }
        .hero-dots { bottom: 80px; }
        .card-grid { grid-template-columns: repeat(2,1fr); }
        .gallery-grid { grid-template-columns: repeat(3,1fr); }
        .footer-grid { grid-template-columns: 1fr 1fr; }
        .dash-shell { grid-template-columns: minmax(0, 1fr); }
        .dash-shell > * { min-width: 0; }
        .dash-main .card { overflow-x: auto; }
        .dash-side { position: static; }
        .admin-shell { grid-template-columns: 1fr; }
        .admin-side { position: static; height: auto; }
        .admin-stat-grid { grid-template-columns: repeat(2,1fr); }
    }
    @media (max-width: 640px) {
        .quick-grid { grid-template-columns: 1fr 1fr; margin-top: -40px; gap: 10px; }
        .hero-dots { bottom: 58px; }
        .card-grid { grid-template-columns: 1fr; }
        .gallery-grid { grid-template-columns: repeat(2,1fr); }
        .footer-grid { grid-template-columns: 1fr; }
        .form-row { grid-template-columns: 1fr; }
        .hero-stats { display: none; }
        .stat-mini-grid { grid-template-columns: 1fr 1fr; }
        .admin-stat-grid { grid-template-columns: 1fr; }
        #hero { min-height: 560px; }
        .section { padding: 54px 0; }
    }

/* ===== سازگاری با سافاری قدیمی (iOS < 15) و موبایل ===== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@supports not (aspect-ratio: 1 / 1) {
    .gallery-item { height: 170px; }
    .sp-thumb { height: 110px; }
}

/* ===== داشبورد اولیا/دانش‌آموز روی موبایل: نوار تب افقی + محتوا بلافاصله زیر آن ===== */
@media (max-width: 992px) {
    .dash-side { padding: 10px 10px 4px; }
    .dash-side .who { display: flex; align-items: center; gap: 12px; text-align: right; padding: 4px 4px 10px; margin-bottom: 6px; }
    .dash-side .who .student-photo-wrap { width: 64px; height: 64px; margin: 0; flex: none; }
    .dash-side .who .student-photo-wrap__initial { font-size: 24px; }
    .dash-side .who b { display: inline; }
    .dash-side .who > span { display: inline; }
    .dash-nav { display: flex; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 6px; padding-bottom: 8px; scrollbar-width: thin; }
    .dash-nav a { flex: none; white-space: nowrap; margin-bottom: 0; min-height: 44px; display: flex; align-items: center; padding: 8px 14px; background: #f3f6f4; }
    .dash-nav a.active { background: var(--color-primary-light); box-shadow: inset 0 -3px 0 var(--color-primary); }
}
/* ===== برنامه هفتگی روزبه‌روز (موبایل) ===== */
.sched-mobile { display: none; }
@media (max-width: 760px) {
    .sched-desktop { display: none; }
    .sched-mobile { display: block; }
    .sched-daytabs { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }
    .sched-daytab { flex: 1 0 auto; min-height: 44px; padding: 8px 14px; border-radius: 12px; border: 1.5px solid var(--color-border); background: #fff; font-family: inherit; font-size: 14px; font-weight: 700; color: var(--color-ink-soft); cursor: pointer; }
    .sched-daytab.is-on { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
    .sched-daypane { display: none; }
    .sched-daypane.is-on { display: block; }
    .sched-card { display: flex; gap: 12px; align-items: stretch; margin: 8px 0; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 12px; background: #fff; }
    .sched-card.has-hw { background: #fffbeb; border-color: #fde68a; }
    .sched-card__t { flex: none; width: 74px; font-weight: 700; font-size: 13px; color: var(--color-primary-dark); display: flex; align-items: center; }
    .sched-card__b { flex: 1; min-width: 0; text-align: right; }
    .sched-break { text-align: center; font-size: 12.5px; color: var(--color-ink-soft); background: #faf8f2; border-radius: 10px; padding: 6px; margin: 6px 0; }
}
/* موبایل: فرم‌ها و مودال‌های سایت */
@media (max-width: 640px) {
    input, select, textarea { font-size: 16px; }
    .btn, .dash-main .btn { min-height: 44px; }
    .modal-box { max-height: 92vh; max-height: 92dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .header-inner, .site-header { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}

/* ===== هدر سایت روی موبایل: نام مدرسه نباید دکمه‌ها (منو/ورود) را از صفحه بیرون بیندازد ===== */
@media (max-width: 640px) {
    .nav-bar { padding: 8px 12px; gap: 8px; padding-left: calc(12px + env(safe-area-inset-left)); padding-right: calc(12px + env(safe-area-inset-right)); }
    .brand { white-space: normal; flex-shrink: 1; min-width: 0; font-size: 14.5px; line-height: 1.35; gap: 8px; }
    .brand .leaf { width: 30px; height: 30px; flex: none; }
    .nav-actions { flex-wrap: nowrap; flex: none; gap: 6px; }
    .nav-actions .btn { padding: 8px 10px; font-size: 12.5px; }
}
/* موبایل: ردیف اول = نام مدرسه + منو؛ ردیف دوم = سه دکمه‌ی هم‌اندازه (کارکنان / ورود اولیا / پیش‌ثبت‌نام) */
@media (max-width: 640px) {
    .nav-bar { flex-wrap: wrap; row-gap: 8px; }
    .nav-actions { display: contents; }
    .brand { order: 1; flex: 1 1 calc(100% - 64px); max-width: calc(100% - 56px); }
    .hamburger { order: 2; width: 44px; height: 44px; flex: none; }
    .staff-login-wrap, .nav-actions > .btn { order: 3; flex: 1 1 0; min-width: 0; margin: 0 3px; }
    .staff-login-wrap { position: static; }
    .staff-login-wrap > .btn, .nav-actions > .btn { width: 100%; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; padding-left: 6px; padding-right: 6px; box-sizing: border-box; }
    .staff-login-menu { left: 12px; right: 12px; width: auto; }
    .nav-actions .btn .lbl-full { display: none; }
    .nav-actions .btn .lbl-short { display: inline; }
    .hero-actions .btn-parent { flex: 1 1 100%; justify-content: center; text-align: center; }
}
/* دسکتاپ: لینک متنیِ «ورود اولیا» داخل منوی اصلی تکراری است (دکمه کنار پیش‌ثبت‌نام هست) */
@media (min-width: 1221px) {
    .main-nav a.nav-parent-link { display: none; }
    .nav-actions { flex-wrap: nowrap; }
}
@media (max-width: 1220px) {
    .main-nav.mobile-open a.nav-parent-link { background: #1e56b8; color: #fff; font-weight: 800; min-height: 44px; display: flex; align-items: center; margin: 4px 0; }
    .main-nav.mobile-open a { min-height: 44px; display: flex; align-items: center; }
}
@media (max-width: 400px) {
    .nav-actions .btn-ghost, .nav-actions .staff-login-wrap > .btn { padding-left: 8px; padding-right: 8px; }
}

/* ===== CMS روی موبایل/تبلت: منوی کشویی (☰) و محتوای تمام‌عرض ===== */
.admin-menu-btn { display: none; flex: none; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--color-border); background: #fff; font-size: 22px; line-height: 1; cursor: pointer; margin-left: 10px; }
.admin-overlay { display: none; }
@media (max-width: 992px) {
    .admin-shell { display: block; }
    .admin-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
    .admin-side {
        position: fixed; top: 0; right: 0; bottom: 0; height: 100%; width: min(86vw, 300px); z-index: 1500;
        transform: translateX(100%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s;
        padding-top: calc(22px + env(safe-area-inset-top)); -webkit-overflow-scrolling: touch;
    }
    .admin-side.is-open { transform: translateX(0); visibility: visible; transition: transform .22s ease, visibility 0s; box-shadow: -8px 0 30px rgba(0,0,0,.35); }
    .admin-side nav a { min-height: 44px; }
    .admin-overlay.is-on { display: block; position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(15,23,42,.5); z-index: 1400; }
    body.drawer-open { overflow: hidden; }
    .admin-main { padding: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); min-width: 0; }
    .admin-topbar { gap: 8px; margin-bottom: 14px; }
    .admin-topbar h2 { font-size: 18px; flex: 1; min-width: 0; }
    .admin-topbar .badge-role { display: none; }
    .admin-card { padding: 14px; overflow-x: auto; }
    table.admin-table { min-width: 0; }
}
