/* ---------------------------------------------
   style.css  |  ظاهر سامانه ثبت اضافه‌کار
--------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;700;800&display=swap');

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --success: #16a34a;
    --danger: #dc2626;
    --bg: #eef2ff;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(79, 70, 229, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 50%, #e0e7ff 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.8;
}

/* ---------- صفحات وسط‌چین (ورود، غیرفعال) ---------- */
.center-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* ---------- کارت ---------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 28px;
    width: 100%;
}

.login-card { max-width: 420px; }

.card h1 { font-size: 1.4rem; font-weight: 800; }
.card h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 16px; }

.brand { text-align: center; margin-bottom: 24px; }
.brand h1 { margin-top: 10px; }

.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px; height: 56px;
    border-radius: 16px;
    font-size: 26px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    box-shadow: 0 8px 20px rgba(79, 70, 229, .35);
}
.brand-badge.small { width: 40px; height: 40px; font-size: 18px; }

/* ---------- فرم ---------- */
.field-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin: 14px 0 6px;
}

.input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: .95rem;
    background: #f8fafc;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
}

.role-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 6px;
}
.role-switch label { cursor: pointer; }
.role-switch input { display: none; }
.role-switch span {
    display: block;
    text-align: center;
    padding: 10px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-weight: 600;
    color: var(--muted);
    transition: all .2s;
}
.role-switch input:checked + span {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(79, 70, 229, .08);
}

/* ---------- دکمه‌ها ---------- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, .12); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-block { width: 100%; margin-top: 20px; }
.btn-sm { padding: 6px 14px; font-size: .82rem; }

/* ---------- پیام‌ها ---------- */
.alert {
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-weight: 600;
    animation: fadeUp .4s ease;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ---------- نوار بالا ---------- */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.topbar-title { display: flex; align-items: center; gap: 12px; }

/* ---------- صفحه اصلی ---------- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}
.container .card { margin-bottom: 24px; }

/* ---------- تب‌ها ---------- */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.tab {
    padding: 10px 22px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--muted);
    font-weight: 700;
    font-size: .92rem;
    text-decoration: none;
    transition: all .2s;
}
.tab:hover { color: var(--primary); border-color: var(--primary); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- فیلتر و فرم شبکه‌ای ---------- */
.filters, .grid-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    align-items: end;
}
.filters-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.grid-form .full { grid-column: 1 / -1; }

/* ---------- آمار ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--muted);
    font-size: .88rem;
}
.stat-num { font-size: 1.7rem; font-weight: 800; color: var(--primary); }

/* ---------- جدول ---------- */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    min-width: 640px;
}
.table th, .table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}
.table th {
    background: #f1f5f9;
    font-weight: 700;
    color: var(--muted);
    position: sticky;
    top: 0;
}
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: #f8fafc; }

/* ---------- ردیف اپراتور (فرم داینامیک) ---------- */
.op-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 10px;
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    animation: fadeUp .3s ease;
}

/* ---------- سایر ---------- */
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.warn { color: #b45309; background: #fef3c7; border-radius: 8px; padding: 10px 14px; margin: 14px 0; }
code { background: #f1f5f9; padding: 2px 8px; border-radius: 6px; font-size: .88em; }
.install-log { margin: 18px 0; padding-right: 20px; }
.install-log li { margin-bottom: 6px; }

.locked-card { max-width: 480px; text-align: center; }
.locked-card h1 { margin: 14px 0 10px; }
.locked-icon { font-size: 52px; }

/* ---------- انیمیشن ---------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .5s ease; }

/* ---------- واکنش‌گرا ---------- */
@media (max-width: 640px) {
    .card { padding: 20px; }
    .op-row { grid-template-columns: 1fr; }
    .topbar-inner { flex-direction: column; align-items: stretch; text-align: center; }
    .topbar-title { justify-content: center; }
    .tabs { justify-content: center; }
}

/* ---------- کلاس‌های پنل سرپرست ---------- */
.btn-light { background: #e2e8f0; color: var(--text); }
.btn-icon { padding: 10px 14px; }
.topbar-sub { color: var(--muted); font-size: .85rem; }
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.card-head h2 { margin-bottom: 0; }
.badge {
    background: rgba(79, 70, 229, .1);
    color: var(--primary);
    border: 1px solid rgba(79, 70, 229, .25);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: .8rem;
    font-weight: 700;
}
.row-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}
