/* CloudPanel — same visual language as the VPN panel, direction-agnostic so the
   one-file Persian translation flips to RTL without touching this stylesheet.
   Everything uses logical properties (inline-start/end) rather than left/right. */

@font-face{
  font-family:"Vazirmatn";
  src:url("/assets/fonts/vazirmatn/Vazirmatn.woff2") format("woff2");
  font-weight:100 900;
  font-display:swap;
}

:root{
  --base-font-size: 1rem;
  --brand: #6d5efc;
  --brand-2: #9b8cff;
  --bg: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f6f7fc;
  --text: #1f2430;
  --muted: #7a8194;
  --border: #e7e9f2;
  --sidebar-bg: #ffffff;
  --ok: #22b07d;
  --warn: #e0a92e;
  --danger: #e0454f;
  --info: #3b9bf0;
  --shadow-sm: 0 1px 2px rgba(28,30,60,.05), 0 4px 14px rgba(28,30,60,.05);
  --shadow-md: 0 8px 30px rgba(40,40,90,.10);
  --radius: 16px;
}
html[data-theme="dark"]{
  --bg:#0d0f16; --surface:#161a24; --surface-2:#1c2130; --text:#e8eaf2; --muted:#9aa2b8;
  --border:#262b38; --sidebar-bg:#12151f;
  --shadow-sm:0 1px 2px rgba(0,0,0,.3); --shadow-md:0 10px 34px rgba(0,0,0,.45);
}

*{box-sizing:border-box}
body{
  margin:0; font-family:"Vazirmatn",system-ui,-apple-system,"Segoe UI",sans-serif;
  font-size:var(--base-font-size); background:var(--bg); color:var(--text);
  -webkit-tap-highlight-color:transparent;
}
a{text-decoration:none;color:inherit}
code,pre,.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}

/* ===== Layout ===== */
.layout{display:flex;min-height:100vh}
.sidebar{width:250px;background:var(--sidebar-bg);border-inline-end:1px solid var(--border);
  padding:18px 12px;position:sticky;top:0;height:100vh;overflow-y:auto;z-index:60}
.content{flex:1;min-width:0;display:flex;flex-direction:column}
.brand{display:flex;align-items:center;gap:10px;margin-bottom:18px;padding:6px}
.brand-name{font-weight:800;color:var(--brand);font-size:1.15rem}
.brand-badge{width:42px;height:42px;border-radius:12px;background:linear-gradient(135deg,var(--brand),var(--brand-2));
  color:#fff;display:grid;place-items:center;font-size:1.1rem;box-shadow:0 6px 16px rgba(109,94,252,.35);flex-shrink:0}
.menu{display:flex;flex-direction:column;gap:4px}
.menu-item{display:flex;align-items:center;gap:12px;padding:11px 14px;border-radius:12px;
  color:var(--text);font-weight:600;min-height:44px;transition:.15s}
.menu-item i{width:28px;height:28px;display:grid;place-items:center;border-radius:9px;font-size:.9rem;flex-shrink:0}
.menu-item span{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.menu-item:hover{background:var(--surface-2)}
.menu-item.active{background:linear-gradient(135deg,var(--brand),var(--brand-2));color:#fff;
  box-shadow:0 8px 20px rgba(109,94,252,.38)}
.menu-item.active i{background:rgba(255,255,255,.22)!important;color:#fff!important}

.menu-item:nth-child(1) i{background:#e8f0ff;color:#3b82f6}
.menu-item:nth-child(2) i{background:#e6f9f0;color:#22b07d}
.menu-item:nth-child(3) i{background:#f0ecff;color:#8b7cff}
.menu-item:nth-child(4) i{background:#e0f5ff;color:#0ea5e9}
.menu-item:nth-child(5) i{background:#fff4e0;color:#e0a92e}
.menu-item:nth-child(6) i{background:#ffe9f3;color:#ec4899}
.menu-item:nth-child(7) i{background:#fdf0d5;color:#d97706}
.menu-item:nth-child(8) i{background:#e6f9f0;color:#10b981}
.menu-item:nth-child(9) i{background:#ffe6e6;color:#ef4444}
.menu-item:nth-child(10) i{background:#f0ecff;color:#7c3aed}
html[data-theme="dark"] .menu-item i{background:rgba(255,255,255,.08)}

.sidebar-backdrop{position:fixed;inset:0;background:rgba(15,17,25,.5);backdrop-filter:blur(2px);
  z-index:55;opacity:0;visibility:hidden;transition:.2s}
.sidebar-backdrop.show{opacity:1;visibility:visible}

/* ===== Topbar ===== */
.topbar{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:14px 22px;
  border-bottom:1px solid var(--border);background:var(--surface);flex-wrap:wrap;position:sticky;top:0;z-index:50}
.topbar-left{display:flex;align-items:center;gap:12px;min-width:0}
.topbar-title h1{font-size:1.25rem;margin:0;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.icon-btn{border:1px solid var(--border);background:var(--surface);color:var(--text);border-radius:10px;
  padding:8px 12px;cursor:pointer;min-height:44px;display:inline-flex;align-items:center;gap:6px;transition:.15s}
.icon-btn:hover{background:var(--surface-2);border-color:var(--brand)}
.logout{color:var(--danger);border-color:#f3c9cc}
.logout:hover{background:#fdeaec;border-color:var(--danger)}
html[data-theme="dark"] .logout:hover{background:#3a1518}
.fontctl{display:flex;gap:4px}
.nav-toggle{display:none}
.lang-select{min-height:44px;border-radius:10px;border:1px solid var(--border);
  background:var(--surface);color:var(--text);padding:0 10px}
.page{padding:22px}

/* ===== Cards & stats ===== */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-sm)}
.card-pad{padding:18px}
.card-title{font-weight:800;margin:0 0 14px;font-size:1.05rem;display:flex;align-items:center;gap:8px}
.stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:14px}
.stat-card{display:flex;align-items:center;gap:14px;background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius);padding:16px;box-shadow:var(--shadow-sm);transition:.18s}
.stat-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-md)}
.stat-ico{width:52px;height:52px;border-radius:14px;display:grid;place-items:center;font-size:1.3rem;color:#fff;flex-shrink:0}
.stat-body{min-width:0}
.stat-num{font-size:1.5rem;font-weight:800;white-space:nowrap}
.stat-lbl{color:var(--muted);font-size:.85rem}
.c-green .stat-ico{background:linear-gradient(135deg,#22b07d,#12805a)}
.c-blue .stat-ico{background:linear-gradient(135deg,#3b9bf0,#2563eb)}
.c-purple .stat-ico{background:linear-gradient(135deg,#8b7cff,#6d5efc)}
.c-gold .stat-ico{background:linear-gradient(135deg,#f0bd4a,#e0a92e)}
.c-red .stat-ico{background:linear-gradient(135deg,#f0636c,#e0454f)}

/* ===== Tables ===== */
.tbl-wrap{overflow-x:auto}
table.tbl{width:100%;border-collapse:collapse;font-size:.92rem}
table.tbl th{text-align:start;padding:11px 12px;color:var(--muted);font-weight:700;
  border-bottom:1px solid var(--border);white-space:nowrap}
table.tbl td{padding:11px 12px;border-bottom:1px solid var(--border);vertical-align:middle}
table.tbl tr:last-child td{border-bottom:0}
table.tbl tbody tr:hover{background:var(--surface-2)}
.num{font-variant-numeric:tabular-nums;white-space:nowrap}

/* ===== Badges ===== */
.badge-s{display:inline-flex;align-items:center;gap:5px;padding:4px 10px;border-radius:999px;
  font-size:.78rem;font-weight:700;white-space:nowrap}
.b-active{background:#d7f5e8;color:#12805a}
.b-suspended{background:#fdf0d5;color:#95620a}
.b-provisioning{background:#e0f0ff;color:#1d5fa8}
.b-terminated{background:#e9ebf2;color:#5c6478}
.b-error{background:#fbd9db;color:#b02a33}
html[data-theme="dark"] .b-active{background:#123a2c;color:#5fd7ab}
html[data-theme="dark"] .b-suspended{background:#3a2e12;color:#e5bf5f}
html[data-theme="dark"] .b-provisioning{background:#14283f;color:#7dbaf5}
html[data-theme="dark"] .b-terminated{background:#232733;color:#9aa2b8}
html[data-theme="dark"] .b-error{background:#3a1518;color:#f39098}

/* ===== Forms ===== */
.form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px}
.field label{display:block;font-weight:700;margin-bottom:6px;font-size:.9rem}
.field .hint{color:var(--muted);font-size:.82rem;margin-top:6px;line-height:1.6}
.field input,.field select,.field textarea{
  width:100%;min-height:44px;padding:10px 12px;border-radius:12px;
  border:1px solid var(--border);background:var(--surface);color:var(--text);font-family:inherit;font-size:1rem}
.field input:focus,.field select:focus,.field textarea:focus{
  outline:none;border-color:var(--brand);box-shadow:0 0 0 3px rgba(109,94,252,.18)}
.btn{border:0;border-radius:12px;padding:11px 18px;font-weight:700;cursor:pointer;min-height:44px;
  display:inline-flex;align-items:center;gap:8px;transition:.15s;font-family:inherit;font-size:.95rem}
.btn-primary{background:linear-gradient(135deg,var(--brand),var(--brand-2));color:#fff;
  box-shadow:0 6px 18px rgba(109,94,252,.32)}
.btn-primary:hover{filter:brightness(1.05)}
.btn-ghost{background:var(--surface);border:1px solid var(--border);color:var(--text)}
.btn-ghost:hover{background:var(--surface-2)}
.btn-danger{background:var(--danger);color:#fff}
.btn-danger:hover{filter:brightness(1.05)}
.btn-sm{padding:7px 12px;min-height:36px;font-size:.85rem}
.actions-row{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:18px}

/* ===== Alerts ===== */
.alert{border-radius:14px;padding:14px 16px;margin-bottom:16px;border:1px solid;
  display:flex;gap:10px;align-items:flex-start;line-height:1.7}
.alert i{margin-top:3px;flex-shrink:0}
.a-info{background:#e8f0ff;border-color:#c5daf8;color:#1d5fa8}
.a-ok{background:#d7f5e8;border-color:#a7e6cb;color:#12805a}
.a-warn{background:#fdf0d5;border-color:#f0d79a;color:#95620a}
.a-err{background:#fbd9db;border-color:#f0b8bc;color:#b02a33}
html[data-theme="dark"] .a-info{background:#14283f;border-color:#1f4470;color:#9ccbf7}
html[data-theme="dark"] .a-ok{background:#123a2c;border-color:#1c5a43;color:#7fdfb9}
html[data-theme="dark"] .a-warn{background:#3a2e12;border-color:#5c4a1c;color:#edcb77}
html[data-theme="dark"] .a-err{background:#3a1518;border-color:#5c2429;color:#f5a3aa}

/* ===== Login ===== */
.login-wrap{min-height:100vh;display:grid;place-items:center;padding:20px;
  background:linear-gradient(135deg,#6d5efc22,#9b8cff11),var(--bg)}
.login-card{width:100%;max-width:400px;background:var(--surface);border:1px solid var(--border);
  border-radius:22px;padding:32px;box-shadow:var(--shadow-md)}
.login-brand{display:flex;flex-direction:column;align-items:center;gap:10px;margin-bottom:24px}
.login-brand .brand-badge{width:56px;height:56px;font-size:1.4rem}
.login-brand h1{margin:0;font-size:1.3rem;font-weight:800}
.login-brand p{margin:0;color:var(--muted);font-size:.88rem}
.login-card .field{margin-bottom:14px}
.login-card .btn{width:100%;justify-content:center;margin-top:6px}
.login-foot{margin-top:18px;display:flex;justify-content:center;gap:8px}

/* ===== Misc ===== */
.kv{display:grid;grid-template-columns:auto 1fr;gap:10px 18px;font-size:.93rem}
.kv dt{color:var(--muted);font-weight:600}
.kv dd{margin:0;font-weight:600;word-break:break-word}
.secret{display:inline-flex;align-items:center;gap:8px;background:var(--surface-2);
  border:1px solid var(--border);border-radius:10px;padding:8px 12px;font-family:ui-monospace,monospace;
  font-size:.85rem;word-break:break-all}
.muted{color:var(--muted)}
.grid-2{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:16px}
.mt{margin-top:16px}

@media(max-width:900px){
  .sidebar{position:fixed;inset-block:0;inset-inline-start:0;transform:translateX(-100%);
    transition:transform .2s;box-shadow:var(--shadow-md)}
  html[dir="rtl"] .sidebar{transform:translateX(100%)}
  .sidebar.open{transform:translateX(0)}
  .nav-toggle{display:inline-flex}
  .page{padding:16px}
  .topbar{padding:12px 14px}
}
