/* ============================================================
   form_std.css  -  استایل استاندارد فرم‌های مدیریتی (تعریف/لیست)
   مسیر در پروژه: ~/rcs/css/form_std.css
   استفاده در هر فرم:
     <link href="~/rcs/css/form_std.css" rel="stylesheet" runat="server" />
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: #f1f5f9;
    min-height: 100vh; color: #0f172a; direction: rtl;
    -webkit-tap-highlight-color: transparent;
}

/* ===== چیدمان کلی (با رعایت safe-area برای موبایل) ===== */
.page-wrap {
    padding: 12px;
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.box {
    background: #ffffff;
    border-radius: 16px;
    padding: 22px 26px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05), 0 4px 12px -2px rgba(0, 0, 0, 0.02);
    max-width: 1100px;
    margin: 0 auto 20px;
    border: 1px solid #e2e8f0;
}

h2 {
    margin: 0 0 16px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}

h2::before {
    content: "";
    width: 5px;
    height: 20px;
    background: linear-gradient(180deg, #4f46e5, #6366f1);
    border-radius: 10px;
}

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

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #334155;
    font-size: 0.84rem;
}

/* font-size حداقل 16px تا مرورگر موبایل هنگام فوکوس زوم نکند */
input[type=text], input[type=password], input[type=time], select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 0.92rem;
    direction: rtl;
    text-align: right;
    background: #f8fafc;
    color: #1e293b;
    transition: all 0.25s ease-in-out;
}

textarea { min-height: 72px; resize: vertical; }

input[type=text]:focus, input[type=password]:focus, input[type=time]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #6366f1;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ===== دکمه‌ها ===== */
.btn-container {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.btn {
    padding: 8px 22px;
    min-height: 38px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
    transform: translateY(-2px);
}

.btn:focus-visible { outline: 3px solid rgba(99, 102, 241, 0.45); outline-offset: 2px; }

.validator {
    color: #ef4444;
    font-size: 0.76rem;
    display: block;
    margin-top: 3px;
    font-weight: 500;
}

.req { color: #ef4444; }

/* ===== پیام‌ها ===== */
.msg {
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 0.86rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.msg-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.msg-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ===== جدول (GridView) ===== */
.table-wrap { width: 100%; overflow-x: auto; }

.grid-style {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    direction: rtl;
    font-size: 0.86rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.grid-style th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 10px 14px;
    border-bottom: 2px solid #e2e8f0;
    text-align: right;
    white-space: nowrap;
}

.grid-style td {
    padding: 8px 14px;
    border-bottom: 1px solid #f1f5f9;
    text-align: right;
    vertical-align: middle;
    color: #334155;
    background: #ffffff;
    transition: background 0.2s ease;
}

.grid-style tr:hover td { background: #f8fafc; }
.grid-style tr:last-child td { border-bottom: none; }

/* ImageButton به صورت input[type=image] رندر می‌شود */
.grid-style img,
.grid-style input[type=image] {
    cursor: pointer;
    width: 32px;
    height: 32px;
    padding: 6px;
    border-radius: 8px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.grid-style img:hover,
.grid-style input[type=image]:hover { transform: scale(1.1); background: #eef2ff; }

.grid-style td.grid-act { width: 1%; white-space: nowrap; text-align: center; }
.grid-style tr.grid-empty td { text-align: center; color: #64748b; padding: 22px 14px; }

/* ===== ریسپانسیو ===== */
@media (max-width: 640px) {
    .page-wrap { padding-top: 8px; }
    .box { padding: 14px 12px; border-radius: 14px; margin-bottom: 14px; }
    h2 { font-size: 1.02rem; margin-bottom: 12px; }
    /* روی موبایل 16px تا مرورگر هنگام فوکوس زوم نکند */
    input[type=text], input[type=password], input[type=time], select, textarea { font-size: 16px; }
    .btn-container .btn { flex: 1; padding-left: 14px; padding-right: 14px; }

    /* تبدیل جدول به کارت در موبایل */
    .grid-style, .grid-style tbody, .grid-style tr, .grid-style td { display: block; width: 100%; }
    .grid-style { border: none; border-radius: 0; overflow: visible; }
    .grid-style thead { display: none; }
    .grid-style tr {
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        margin-bottom: 10px;
        overflow: hidden;
    }
    .grid-style td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        text-align: left;
        direction: rtl;
        border-bottom: 1px solid #f1f5f9;
    }
    .grid-style td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #64748b;
        flex-shrink: 0;
    }
    /* دکمه‌های ویرایش/حذف کنار هم و در بالای کارت */
    .grid-style td.grid-act {
        display: inline-flex; width: 50%; justify-content: center;
        border-bottom: 1px solid #e2e8f0; background: #f8fafc; padding: 6px;
    }
    .grid-style td.grid-act::before { content: none; }
    .grid-style tr.grid-empty td { display: block; text-align: center; }
    .grid-style tr.grid-empty td::before { content: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ===== پیام اطلاع‌رسانی (مثلاً توضیح فیلتر لیست) ===== */
.msg-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ===== اضافه‌شده برای فرم‌های چندستونه / فیلتر لیست ===== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }

.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; align-items: flex-end; }
.filter-row .form-group { margin-bottom: 0; flex: 1 1 200px; }
.filter-row .filter-btn { flex: 0 0 auto; }

/* فیلدهای لاتین (موبایل، ایمیل، کد ملی) */
input.ltr { direction: ltr !important; text-align: left !important; }

.hint { font-size: 0.74rem; color: #64748b; margin-top: 3px; }

@media (max-width: 900px) {
    .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .filter-row .filter-btn { flex: 1 1 100%; }
    .filter-row .filter-btn .btn { width: 100%; }
}

/* ===== صفحه‌بندی GridView (PagerStyle-CssClass="grid-pager") ===== */
.grid-style tr.grid-pager td { text-align: center; padding: 8px; background: #f8fafc; border-bottom: none; }
.grid-style tr.grid-pager:hover td { background: #f8fafc; }
.grid-style tr.grid-pager table { margin: 0 auto; border-collapse: separate; border-spacing: 4px; }
.grid-style tr.grid-pager td td { padding: 0; border: none; background: transparent; }
.grid-style tr.grid-pager a,
.grid-style tr.grid-pager span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 0 8px;
    border-radius: 8px; border: 1px solid #e2e8f0; background: #ffffff;
    color: #4f46e5; font-weight: 600; text-decoration: none;
}
.grid-style tr.grid-pager a:hover { background: #eef2ff; }
.grid-style tr.grid-pager span {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff; border-color: transparent;
}

/* ===== پیام چندخطی (لیست خطاهای فایل اکسل) و ورودی فایل ===== */
.msg.msg-block { display: block; }
.msg ul { margin: 6px 0 0; padding-right: 22px; }
.msg li { margin-bottom: 2px; line-height: 1.7; }

input[type=file] {
    width: 100%; padding: 8px 10px; border: 1.5px dashed #cbd5e1; border-radius: 10px;
    background: #f8fafc; font-family: 'Vazirmatn', Tahoma, sans-serif; font-size: 0.88rem;
}

@media (max-width: 640px) {
    /* دوباره‌سازی ساختار جدول داخل ردیف صفحه‌بندی (قاعده‌ی کارتی موبایل آن را خراب می‌کند) */
    .grid-style tr.grid-pager { border: none; border-radius: 0; margin-bottom: 0; overflow: visible; }
    .grid-style tr.grid-pager > td { display: block; width: 100%; padding: 8px 0; border: none; background: transparent; }
    .grid-style tr.grid-pager > td::before { content: none; }
    .grid-style tr.grid-pager table { display: table; width: auto; margin: 0 auto; }
    .grid-style tr.grid-pager table tbody { display: table-row-group; }
    .grid-style tr.grid-pager table tr { display: table-row; width: auto; border: none; margin: 0; border-radius: 0; overflow: visible; }
    .grid-style tr.grid-pager table td { display: table-cell; width: auto; padding: 0; border: none; }
    .grid-style tr.grid-pager table td::before { content: none; }
}

/* ===== جدول برنامه‌ی هفتگی (روز × ساعت) ===== */
.week-grid { width: 100%; border-collapse: separate; border-spacing: 0; direction: rtl; font-size: 0.84rem;
             border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; min-width: 520px; }
.week-grid th { background: #f8fafc; color: #475569; font-weight: 700; padding: 8px 10px; text-align: center;
                border-bottom: 1px solid #e2e8f0; border-left: 1px solid #e2e8f0; white-space: nowrap; }
.week-grid td { padding: 8px 10px; text-align: center; border-bottom: 1px solid #f1f5f9; border-left: 1px solid #f1f5f9;
                background: #ffffff; color: #94a3b8; }
.week-grid td.has { background: #eef2ff; color: #3730a3; font-weight: 600; }
.week-grid tr:last-child th, .week-grid tr:last-child td { border-bottom: none; }
.week-grid th small { display: block; font-weight: 400; color: #64748b; font-size: 0.72rem; }

/* فیلد فقط‌خواندنی (مثلاً اطلاعاتی که فقط مدیر می‌تواند تغییر دهد) */
input[readonly], input[readonly]:focus { background: #f1f5f9; color: #64748b; cursor: not-allowed; box-shadow: none; border-color: #cbd5e1; }

.badge-ok { color: #166534; font-weight: 600; }
.badge-no { color: #b45309; font-weight: 600; }

/* ===== تب‌های بالای فرم (جابه‌جایی بین بخش‌ها) ===== */
.tabs { display: flex; gap: 8px; max-width: 1100px; margin: 0 auto 14px; flex-wrap: wrap; }
.tab-btn { display: inline-block; padding: 8px 18px; border-radius: 10px; border: 1px solid #cbd5e1; background: #ffffff;
           color: #475569; font-weight: 600; font-size: 0.88rem; text-decoration: none; cursor: pointer; }
.tab-btn:hover { background: #eef2ff; color: #3730a3; }
.tab-btn.active { background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%); color: #ffffff; border-color: transparent; }

/* ===== رنگ‌بندی سلول جدول (GridColInfo.CellClass) و پیام هشدار ===== */
.grid-style tr td.cell-bad { background: #fef2f2; color: #b91c1c; font-weight: 700; }
.grid-style tr td.cell-warn { background: #fffbeb; color: #b45309; font-weight: 600; }
.msg-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

@media (max-width: 640px) {
    .tab-btn { flex: 1; text-align: center; }
}

/* ===== صفحه‌ی برنامه‌ی کلاسی (page_board) ===== */
.week-grid.board { min-width: 760px; }
.week-grid.board td { vertical-align: top; padding: 6px; background: #ffffff; color: #94a3b8; min-width: 120px; }
.week-grid th.today { background: #eef2ff; color: #3730a3; }
.week-grid td.today-col { background: #fafaff; }

.bd-item { text-align: right; background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; color: #1e293b; }
.bd-item:last-child { margin-bottom: 0; }
.bd-course { font-weight: 700; color: #3730a3; font-size: 0.9rem; }
.bd-meta { font-size: 0.76rem; color: #475569; margin-top: 2px; font-weight: 400; }
.bd-act { margin-top: 8px; padding-top: 6px; border-top: 1px dashed #c7d2fe; font-weight: 400; }
.bd-note { font-size: 0.74rem; color: #64748b; line-height: 1.7; }
.bd-count { font-size: 0.76rem; color: #166534; font-weight: 700; margin-top: 4px; }
.bd-link { display: inline-block; padding: 7px 14px; border-radius: 9px; color: #ffffff !important; font-weight: 700; font-size: 0.82rem;
           text-decoration: none; background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%); box-shadow: 0 3px 10px rgba(22, 163, 74, 0.3); }
.bd-link:hover { filter: brightness(0.95); }

/* ===== صفحه‌ی ورود (page_login) ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.box.login-box { width: 100%; max-width: 440px; margin: 0 auto; }

.captcha-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.captcha-row .captcha-img { height: 56px; border: 1px solid #cbd5e1; border-radius: 10px; background: #f8fafc; }
.captcha-row input[type=text] { flex: 1 1 140px; min-width: 120px; text-transform: uppercase; letter-spacing: 2px; }

.link-btn { background: none; border: none; padding: 0; color: #4f46e5; font-weight: 600; font-size: 0.86rem;
            text-decoration: none; cursor: pointer; font-family: 'Vazirmatn', Tahoma, sans-serif; }
.link-btn:hover { text-decoration: underline; }
.login-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

/* ===== فرم تعریف برنامه‌ی کلاسی (page_def_time_board) ===== */

/* انتخاب روزها به صورت دکمه‌های قرصی */
.days { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.days > span { position: relative; display: inline-block; }
/* کادر تیک فقط «بصری» پنهان است (۱ پیکسل و بدون دریافت کلیک)؛ انتخاب با کلیک روی برچسب انجام می‌شود */
.days input[type=checkbox] { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden;
                             clip: rect(0 0 0 0); clip-path: inset(50%); opacity: 0; pointer-events: none; }
.days label { margin: 0; display: inline-block; padding: 7px 16px; border: 1.5px solid #cbd5e1; border-radius: 999px;
              background: #ffffff; color: #475569; font-size: 0.86rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.days input:checked + label { background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%); color: #ffffff; border-color: transparent;
                              box-shadow: 0 3px 10px rgba(79, 70, 229, 0.3); }
.days input:focus-visible + label { outline: 3px solid rgba(99, 102, 241, 0.45); outline-offset: 2px; }

.count-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.count-row input[type=text] { width: 80px; text-align: center; direction: ltr; }
.count-row .lbl { font-weight: 600; color: #334155; font-size: 0.88rem; }

/* ردیف‌های ویرایش زنگ‌ها */
.tb-slots { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.tb-slot-row { display: grid; grid-template-columns: 128px minmax(120px, 1.6fr) minmax(110px, 1fr) minmax(110px, 1fr); gap: 8px 12px;
               align-items: start; padding: 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px;
               position: relative; transition: box-shadow 0.15s ease, border-color 0.15s ease; }
.tb-ctrl { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.tb-idx { min-width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
          background: #eef2ff; color: #3730a3; font-weight: 700; }
.tb-handle { width: 30px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: #94a3b8;
             cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; font-size: 1.1rem; letter-spacing: -3px; }
.tb-handle:hover { background: #eef2ff; color: #4f46e5; }
.tb-handle:active { cursor: grabbing; }
.tb-mvs { display: flex; flex-direction: column; gap: 2px; }
.tb-mv { width: 26px; height: 16px; padding: 0; border: 1px solid #cbd5e1; border-radius: 5px; background: #ffffff; color: #475569;
         font-size: 0.55rem; line-height: 1; cursor: pointer; }
.tb-mv:hover:not(:disabled) { background: #eef2ff; color: #4f46e5; }
.tb-mv:disabled { opacity: 0.35; cursor: default; }
.tb-slot-row.dragging { z-index: 20; box-shadow: 0 12px 28px rgba(15, 23, 42, 0.25); border-color: #6366f1; background: #ffffff; }
.tb-slot-row.drop-before { box-shadow: 0 -3px 0 0 #6366f1; }
.tb-slot-row.drop-after { box-shadow: 0 3px 0 0 #6366f1; }
.tb-f label { margin-bottom: 3px; font-size: 0.78rem; }
.tb-f.tb-def { grid-column: 2 / -1; }
.tb-f input.ltr, .tb-f input[type=time] { text-align: center; direction: ltr; }

/* نمودار هفته: هر زنگ یک ردیف هم‌اندازه (هرگز روی هم نمی‌افتد) + نوار نسبی مدت زنگ + ردیف استراحت */
.tb-chart { width: 100%; min-width: 660px; border-collapse: separate; border-spacing: 0; direction: rtl; font-size: 0.85rem;
            border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.tb-chart th, .tb-chart td { padding: 8px; border-bottom: 1px solid #f1f5f9; border-left: 1px solid #f1f5f9; vertical-align: middle; }
.tb-chart thead th { background: #f8fafc; color: #475569; font-weight: 700; text-align: center; border-bottom: 2px solid #e2e8f0; }
.tb-chart thead th.off { color: #94a3b8; background: #f1f5f9; }
.tb-chart tbody th.tb-time { background: #f8fafc; text-align: right; min-width: 150px; width: 170px; font-weight: 400; }
.tb-time b { display: block; color: #1e293b; font-size: 0.9rem; }
.tb-time small { display: block; direction: ltr; text-align: right; color: #64748b; margin-top: 2px; }
.tb-dur { display: inline-block; margin-top: 4px; font-size: 0.74rem; color: #3730a3; background: #eef2ff; border-radius: 6px; padding: 1px 8px; }
.tb-bar { height: 5px; background: #e2e8f0; border-radius: 4px; margin-top: 6px; overflow: hidden; }
.tb-bar i { display: block; height: 100%; background: linear-gradient(90deg, #4f46e5, #6366f1); border-radius: 4px; }
.tb-chart td.off { background: #f1f5f9; color: #cbd5e1; text-align: center; }
.tb-block { border-radius: 9px; color: #ffffff; padding: 8px; min-height: 48px; display: flex; flex-direction: column;
            justify-content: center; align-items: center; text-align: center; gap: 2px; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12); }
.tb-block .b-name { font-weight: 700; font-size: 0.85rem; }
.tb-block .b-time { font-size: 0.74rem; direction: ltr; opacity: 0.95; }
.tb-gap td { text-align: center; padding: 3px 8px; font-size: 0.74rem; color: #64748b; background: #fafafa; border-left: none; }
.tb-clash { display: inline-block; margin-top: 4px; font-size: 0.74rem; color: #b91c1c; background: #fef2f2; border-radius: 6px; padding: 1px 8px; font-weight: 700; }
.tb-summary { margin-top: 10px; font-size: 0.82rem; color: #475569; display: flex; gap: 8px 18px; flex-wrap: wrap; }

.grid-style a.act-link { margin-left: 12px; color: #4f46e5; font-weight: 600; text-decoration: none; }
.grid-style a.act-link:hover { text-decoration: underline; }
.grid-style a.act-del { color: #b91c1c; }

@media (max-width: 640px) {
    .tb-slot-row { grid-template-columns: 1fr 1fr; }
    .tb-ctrl { grid-column: 1 / -1; margin-top: 0; }
    .tb-slot-row .tb-f.tb-name { grid-column: 1 / -1; }
    .tb-f.tb-def { grid-column: 1 / -1; }
}

/* سلول «اجازه» (سبز) در جدول‌ها (GridColInfo.CellClass) */
.grid-style tr td.cell-ok { background: #f0fdf4; color: #166534; font-weight: 700; }

