/* padlock admin — آینه‌ی دیزاین‌سیستم پاد (tn tokens) */

@font-face { font-family: 'Vazirmatn'; src: url('/assets/fonts/Vazirmatn-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('/assets/fonts/Vazirmatn-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('/assets/fonts/Vazirmatn-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('/assets/fonts/Vazirmatn-ExtraBold.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
    --tn-primary: #1565C0;
    --tn-primary-dark: #0D47A1;
    --tn-primary-light: #E3F2FD;
    --tn-primary-container: #BBDEFB;
    --tn-primary-50: #EEF4FC;
    --tn-surface: #F5F7FA;
    --tn-surface-card: #FFFFFF;
    --tn-surface-dim: #ECEEF2;
    --tn-on-surface: #12252E;
    --tn-on-surface-var: #6B7280;
    --tn-on-surface-faint: #8B92A0;
    --tn-outline: #DDE1E6;
    --tn-outline-light: #F0F2F5;
    --tn-success: #2E7D32;
    --tn-success-bg: #E8F5E9;
    --tn-error: #C62828;
    --tn-error-bg: #FFEBEE;
    --tn-warn: #E65100;
    --tn-warn-bg: #FFF3E0;
    --tn-r-sm: 10px;
    --tn-r-md: 14px;
    --tn-r-lg: 20px;
    --tn-r-full: 100px;
    --tn-s1: 0 1px 2px rgba(18,37,46,.05), 0 1px 3px rgba(18,37,46,.06);
    --tn-s2: 0 2px 6px rgba(18,37,46,.07), 0 4px 12px rgba(18,37,46,.06);
    --tn-s3: 0 6px 16px rgba(18,37,46,.1), 0 10px 28px rgba(18,37,46,.08);
    --tn-font: 'Vazirmatn', 'Vazir', Tahoma, system-ui, sans-serif;
    --topbar-height: 56px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--tn-font);
    font-size: 14px;
    line-height: 1.6;
    background: var(--tn-surface);
    color: var(--tn-on-surface);
}
a { color: var(--tn-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; font-weight: 800; margin: 0; }
h2 { font-size: 15px; font-weight: 700; margin: 0 0 12px; }

/* ── topbar ── */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: linear-gradient(180deg, #0D47A1 0%, #0B3D8A 100%);
    color: #fff;
    box-shadow: var(--tn-s2);
}
.topbar-inner {
    max-width: 1200px; margin: 0 auto;
    min-height: var(--topbar-height);
    padding: 6px 26px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.brand {
    font-weight: 800; font-size: 15px; color: #fff;
    margin-left: 14px; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; }
.topbar nav a {
    color: rgba(255,255,255,.85); font-size: 13px; font-weight: 500;
    padding: 6px 12px; border-radius: var(--tn-r-full);
}
.topbar nav a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.topbar nav a.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 700; }
.topbar .spacer { flex: 1; }
.admin-name { font-size: 12px; color: rgba(255,255,255,.75); margin-left: 8px; }
.logout-form { display: inline; }
.logout-form button {
    background: rgba(255,255,255,.12); color: #fff; border: none; cursor: pointer;
    font-family: inherit; font-size: 12px; font-weight: 700;
    padding: 6px 14px; border-radius: var(--tn-r-full);
}
.logout-form button:hover { background: rgba(255,255,255,.22); }

/* ── layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 22px 26px 48px; }
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin: 4px 0 18px;
}

/* ── flash / alerts ── */
.flash {
    padding: 12px 16px; margin-bottom: 16px;
    border-radius: var(--tn-r-sm);
    border-right: 3px solid var(--tn-success);
    background: var(--tn-success-bg); color: var(--tn-success);
    font-size: 13px; font-weight: 500;
}
.flash-error { border-right-color: var(--tn-error); background: var(--tn-error-bg); color: var(--tn-error); }
.flash-warn { border-right-color: var(--tn-warn); background: var(--tn-warn-bg); color: var(--tn-warn); }

/* ── cards ── */
.card {
    background: var(--tn-surface-card);
    border: 1px solid var(--tn-outline-light);
    border-radius: var(--tn-r-md);
    box-shadow: var(--tn-s1);
    padding: 20px 22px;
    margin-bottom: 18px;
}

/* ── stats ── */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 14px; margin-bottom: 18px;
}
.card.stat { text-align: center; padding: 16px 10px; margin-bottom: 0; }
.stat-num { font-size: 26px; font-weight: 800; color: var(--tn-primary); }
.stat-label { font-size: 12px; color: var(--tn-on-surface-var); margin-top: 2px; }

/* ── tables ── */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
    text-align: right; font-size: 11px; font-weight: 700;
    color: var(--tn-on-surface-var); background: var(--tn-surface);
    padding: 9px 12px; border-bottom: 1px solid var(--tn-outline);
    white-space: nowrap;
}
td {
    font-size: 13px; padding: 10px 12px;
    border-bottom: 1px solid var(--tn-outline-light);
    vertical-align: middle;
}
tbody tr:hover td { background: var(--tn-primary-50); }
tbody tr:last-child td { border-bottom: none; }
.detail-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--tn-on-surface-var); }

/* ── badges ── */
.badge {
    display: inline-block; padding: 3px 12px;
    border-radius: var(--tn-r-full);
    font-size: 11px; font-weight: 700; line-height: 1.7;
}
.badge-active { background: var(--tn-success-bg); color: var(--tn-success); }
.badge-suspended { background: var(--tn-warn-bg); color: var(--tn-warn); }
.badge-revoked { background: var(--tn-error-bg); color: var(--tn-error); }
.badge-expired { background: var(--tn-surface-dim); color: var(--tn-on-surface-var); }

/* ── buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; min-height: 40px;
    border-radius: var(--tn-r-full);
    border: 1px solid var(--tn-outline);
    background: var(--tn-surface-card); color: var(--tn-on-surface);
    font-family: inherit; font-size: 13px; font-weight: 700;
    cursor: pointer; text-decoration: none;
    transition: background .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: var(--tn-primary-50); text-decoration: none; box-shadow: var(--tn-s1); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--tn-primary); border-color: var(--tn-primary); color: #fff; }
.btn-primary:hover { background: var(--tn-primary-dark); }
.btn-danger { background: var(--tn-error); border-color: var(--tn-error); color: #fff; }
.btn-danger:hover { background: #A81F1F; }
.btn-warning { background: var(--tn-warn); border-color: var(--tn-warn); color: #fff; }
.btn-warning:hover { background: #C64500; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--tn-primary); }
.btn-sm { padding: 5px 14px; min-height: 30px; font-size: 12px; }
.btn-block { width: 100%; }

/* ── forms ── */
.form-row { margin-bottom: 16px; }
.form-row label {
    display: block; font-size: 12px; font-weight: 700;
    color: var(--tn-on-surface-var); margin-bottom: 6px;
}
.req { color: var(--tn-error); }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
    width: 100%; max-width: 480px;
    padding: 10px 14px;
    font-family: inherit; font-size: 13px; color: var(--tn-on-surface);
    background: var(--tn-surface-card);
    border: 1.5px solid var(--tn-outline);
    border-radius: var(--tn-r-sm);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--tn-primary);
    box-shadow: 0 0 0 3px rgba(21,101,192,.1);
}
input[type=checkbox] { width: auto; accent-color: var(--tn-primary); margin-left: 6px; }
.form-row label:has(input[type=checkbox]) { display: flex; align-items: center; font-size: 13px; color: var(--tn-on-surface); }
.form-row .muted { margin: 6px 0 0; }

/* ── login ── */
.login-box {
    max-width: 380px; margin: 10vh auto 0;
    background: var(--tn-surface-card);
    border: 1px solid var(--tn-outline-light);
    border-radius: var(--tn-r-lg);
    box-shadow: var(--tn-s3);
    padding: 32px 30px;
}
.login-box h1 { text-align: center; margin-bottom: 22px; }
.login-box label { display: block; font-size: 12px; font-weight: 700; color: var(--tn-on-surface-var); margin-bottom: 14px; }
.login-box input { max-width: none; margin-top: 6px; }
.login-box .btn { margin-top: 8px; }

/* ── tabs (segmented) ── */
.tabs {
    display: inline-flex; flex-wrap: wrap; gap: 0;
    border: 1px solid var(--tn-outline);
    border-radius: var(--tn-r-full);
    overflow: hidden; margin-bottom: 16px;
}
.tab-btn {
    padding: 8px 18px; border: none; cursor: pointer;
    background: var(--tn-surface-card); color: var(--tn-on-surface-var);
    font-family: inherit; font-size: 13px; font-weight: 700;
}
.tab-btn + .tab-btn { border-right: 1px solid var(--tn-outline); }
.tab-btn.active { background: var(--tn-primary-light); color: var(--tn-primary-dark); }

/* ── misc ── */
.muted { color: var(--tn-on-surface-faint); font-size: 12px; }
.ltr { direction: ltr; unicode-bidi: embed; text-align: left; }
pre.code {
    direction: ltr; text-align: left;
    background: var(--tn-surface-dim);
    border: 1px solid var(--tn-outline);
    border-radius: var(--tn-r-sm);
    padding: 12px 14px;
    font-size: 12px; line-height: 1.5;
    overflow-x: auto; white-space: pre-wrap; word-break: break-all;
    cursor: pointer;
}
pre.code:hover { border-color: var(--tn-primary); }

/* ── card section headings ── */
.card h2 { font-size: 15px; margin-bottom: 14px; }
.card h2:not(:first-child), .card h3 { margin-top: 22px; }
.section-sub { font-size: 12px; color: var(--tn-on-surface-faint); margin: -8px 0 14px; }

/* ── plugin status table (license_show) ── */
.plugin-table td { vertical-align: middle; }
.plugin-table .remaining { font-variant-numeric: tabular-nums; font-weight: 700; }
.plugin-table .remaining .unit { font-weight: 400; color: var(--tn-on-surface-faint); font-size: 11px; }
.plugin-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-end; justify-content: flex-start; }
.plugin-actions form { display: contents; }

/* compact labeled fields used inside tables / issue grid */
.field { display: inline-flex; flex-direction: column; gap: 3px; }
.field > span { font-size: 10px; font-weight: 700; color: var(--tn-on-surface-faint); }
.field input { padding: 6px 9px; min-width: 0; }
.field-num input { width: 68px; text-align: center; }
.field-notice { flex: 1 1 200px; }
.field-notice input { width: 100%; max-width: none; }

/* new-plugin issue grid — even cards instead of floating chips */
.issue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.issue-card {
    display: flex; flex-direction: column; gap: 10px;
    border: 1px solid var(--tn-outline-light);
    border-radius: var(--tn-r-md, 10px);
    background: var(--tn-surface);
    padding: 14px;
}
.issue-card .issue-name { font-size: 13px; font-weight: 700; color: var(--tn-on-surface); }
.issue-card .issue-fields { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.issue-card .field-notice { flex: 1 1 100%; }
.issue-card .btn { align-self: flex-start; }

@media (max-width: 720px) {
    .container { padding: 16px 14px 40px; }
    .topbar-inner { padding: 8px 14px; }
    .card { padding: 16px 14px; }
}
