/* ظاهرِ مشترکِ برنامه‌ی هفتگی: public/weekly-plan.php و adm_allClassesSchedule.php
   (جدول خروجیِ load_schedule.php است و داخلِ #scheduleTable قرار می‌گیرد)
   رنگ‌ها همان رنگ‌های قالبِ سایت (media/attachment/assets/css/main2.css) */
:root {
    --accent: #08915e;
    --accent-dark: #067549;
    --accent-soft: #e8f5ef;
    --accent-softer: #f4faf7;
    --heading: #2d465e;
    --text: #212529;
    --muted: #6b7a86;
    --bg: #f1f5f4;
    --surface: #ffffff;
    --line: #e4ebe8;
    --line-strong: #cfdbd5;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-family: "Vazirmatn FD", Vazirmatn, Tahoma, sans-serif;
}
html[lang="en"] body { font-family: system-ui, sans-serif, Arial, Helvetica; }
.wp-page { max-width: 1280px; margin: 0 auto; padding: 28px 16px 48px; }

/* سربرگ */
.wp-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.wp-logo {
    width: 56px; height: 56px; flex: none; object-fit: contain;
    background: var(--surface); border-radius: 16px; padding: 6px;
    box-shadow: 0 1px 2px rgba(16, 48, 36, .08);
}
.wp-heading { flex: 1; min-width: 0; }
.wp-heading h1 { margin: 0; font-size: 1.6rem; line-height: 1.3; font-weight: 800; color: var(--heading); }
.wp-heading p { margin: 2px 0 0; color: var(--muted); font-size: .95rem; }
.wp-print {
    display: inline-flex; align-items: center; gap: 8px; flex: none;
    font: inherit; font-weight: 600; font-size: .95rem; color: var(--heading);
    background: var(--surface); border: 1px solid var(--line-strong);
    padding: 8px 16px; border-radius: 12px; cursor: pointer;
    transition: border-color .15s, color .15s;
}
.wp-print:hover { border-color: var(--accent); color: var(--accent); }
.wp-print svg { width: 18px; height: 18px; }

/* انتخابِ کلاس: دکمه (button.wp-chip با aria-pressed) یا چک‌باکس (label.wp-check > input + span.wp-chip) */
.wp-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 16px; }
.wp-filter[hidden] { display: none; }
.wp-filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wp-filter-base { font: inherit; font-size: .85rem; font-weight: 700; color: var(--muted); margin-inline-end: 2px; }
button.wp-filter-base { background: none; border: 0; padding: 0; cursor: pointer; }
button.wp-filter-base:hover { color: var(--accent); }
.wp-chip {
    display: inline-block;
    font: inherit; font-size: .9rem; line-height: 1.5; color: var(--text);
    background: var(--surface); border: 1px solid var(--line-strong);
    padding: 4px 14px; border-radius: 999px; cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.wp-chip:hover { border-color: var(--accent); color: var(--accent); }
.wp-chip[aria-pressed="true"],
.wp-check input:checked + .wp-chip { background: var(--accent); border-color: var(--accent); color: #fff; }
.wp-check { position: relative; display: inline-flex; }
.wp-check input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.wp-chip:focus-visible, .wp-print:focus-visible, button.wp-filter-base:focus-visible,
.wp-check input:focus-visible + .wp-chip { outline: 3px solid rgba(8, 145, 94, .35); outline-offset: 2px; }

/* جدول */
.wp-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
    box-shadow: 0 1px 3px rgba(16, 48, 36, .05), 0 10px 30px rgba(16, 48, 36, .06);
}
.wp-scroll { overflow-x: auto; transition: opacity .2s; }
.wp-card.is-loading .wp-scroll { opacity: .45; }
.wp-empty { margin: 0; padding: 48px 16px; text-align: center; color: var(--muted); }
#scheduleTable table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .95rem; }
#scheduleTable th, #scheduleTable td { border: 0; padding: 11px 12px; text-align: center; vertical-align: middle; }

#scheduleTable thead th {
    background: var(--accent); color: #fff; font-weight: 700; white-space: nowrap;
    border-inline-start: 1px solid rgba(255, 255, 255, .2);
}
#scheduleTable thead tr:last-child th { min-width: 104px; }
#scheduleTable thead .base-row th { background: var(--accent-dark); font-size: .85rem; font-weight: 600; padding: 7px 12px; }
#scheduleTable thead tr:first-child th:first-child {
    border-inline-start: 0; min-width: 0; width: 1%;
    position: sticky; inset-inline-start: 0; z-index: 2;
}

#scheduleTable tbody td { border-top: 1px solid var(--line); border-inline-start: 1px solid var(--line); font-weight: 500; }
#scheduleTable tbody td:first-child { border-inline-start: 0; }
#scheduleTable tbody td:empty::after { content: "–"; color: #c3cfc9; }
#scheduleTable tbody tr:not(.day-separator) td:first-child {
    position: sticky; inset-inline-start: 0; z-index: 1;
    width: 1%; white-space: nowrap;
    background: var(--accent-softer); color: var(--muted); font-size: .85rem;
}
#scheduleTable tbody tr:not(.day-separator) td:first-child strong { font-weight: 600; }
#scheduleTable tbody tr:not(.day-separator):hover td { background: var(--accent-soft); }

#scheduleTable tr.day-separator td {
    background: var(--accent-soft); color: var(--accent-dark);
    text-align: start; padding: 9px 16px; border-top: 1px solid var(--line-strong);
}
#scheduleTable tbody tr.day-separator:first-child td { border-top: 0; }
#scheduleTable tr.day-separator strong {
    position: sticky; inset-inline-start: 16px;
    display: inline-flex; align-items: center; gap: 8px; font-weight: 800;
}
#scheduleTable tr.day-separator strong::before {
    content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor;
}

/* امروز */
@media screen {
    #scheduleTable tr.day-separator.is-today td { background: var(--accent); color: #fff; border-top-color: var(--accent); }
    #scheduleTable tr.is-today:not(.day-separator) td { background: var(--accent-softer); }
    #scheduleTable tr.is-today:not(.day-separator) td:first-child { background: var(--accent-soft); color: var(--accent-dark); }
}
.wp-today-badge {
    font-size: .75rem; font-weight: 700; line-height: 1.7;
    background: #fff; color: var(--accent); padding: 0 9px; border-radius: 999px;
}

@media (max-width: 640px) {
    .wp-page { padding-top: 18px; }
    .wp-header { gap: 12px; }
    .wp-logo { width: 46px; height: 46px; border-radius: 13px; }
    .wp-heading h1 { font-size: 1.3rem; }
    .wp-heading p { font-size: .85rem; }
    .wp-print { padding: 9px; }
    .wp-print span { display: none; }
    .wp-filter {
        flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
        margin-inline: -16px; padding: 2px 16px 4px;
    }
    .wp-filter::-webkit-scrollbar { display: none; }
    .wp-filter-group { flex-wrap: nowrap; }
    .wp-chip, .wp-filter-base { white-space: nowrap; flex: none; }
    .wp-card { border-radius: 14px; }
    #scheduleTable table { font-size: .88rem; }
    #scheduleTable th, #scheduleTable td { padding: 9px 10px; }
    #scheduleTable thead tr:last-child th { min-width: 92px; }
    /* جدول در موبایل به‌هرحال افقی اسکرول می‌شود؛ شکستنِ خط فقط سطرها را بلند می‌کند */
    #scheduleTable td { white-space: nowrap; }
}

@media print {
    @page { margin: 8mm; }
    body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .wp-page { max-width: none; padding: 0; }
    .wp-header { margin-bottom: 10px; }
    .wp-logo { width: 40px; height: 40px; box-shadow: none; padding: 0; }
    .wp-heading h1 { font-size: 16pt; }
    .wp-print, .wp-filter, .wp-today-badge { display: none !important; }
    .wp-card { box-shadow: none; border-radius: 0; border-color: var(--line-strong); overflow: visible; }
    .wp-scroll { overflow: visible; opacity: 1 !important; }
    #scheduleTable table { font-size: 10.5pt; }
    #scheduleTable th, #scheduleTable td { padding: 5px 6px; }
    #scheduleTable thead tr:last-child th { min-width: 0; }
    #scheduleTable thead { display: table-header-group; }
    #scheduleTable tr { break-inside: avoid; }
    #scheduleTable td, #scheduleTable th { position: static !important; }
}
