/* ─────────────────────────────────────────────────────────────────────────────
   Weyzo Admin — style.css
   Design: dark premium glassmorphism, Inter font, CSS custom properties
───────────────────────────────────────────────────────────────────────────── */

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

:root {
  --bg:           #0d0f14;
  --surface:      #13161e;
  --surface-2:    #1a1e2a;
  --surface-3:    #222638;
  --border:       rgba(255,255,255,0.07);
  --border-focus: rgba(99,102,241,0.6);

  --accent:       #6366f1;
  --accent-h:     #4f51c8;
  --accent-glow:  rgba(99,102,241,0.2);

  --green:        #22c55e;
  --green-bg:     rgba(34,197,94,0.12);
  --red:          #f43f5e;
  --red-bg:       rgba(244,63,94,0.12);
  --yellow:       #f59e0b;
  --yellow-bg:    rgba(245,158,11,0.12);

  --text:         #e2e8f0;
  --text-2:       #94a3b8;
  --text-3:       #64748b;

  --sidebar-w:    240px;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:    0 8px 48px rgba(0,0,0,0.6);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.green  { color: var(--green); }
.red    { color: var(--red); }
.yellow { color: var(--yellow); }

/* ── Screen containers ────────────────────────────────────────────────────── */
.screen { min-height: 100vh; }

/* ── Login ────────────────────────────────────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 20%, rgba(99,102,241,0.12) 0%, transparent 60%),
              var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.4s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  box-shadow: 0 0 24px var(--accent-glow);
}
.logo-icon.sm { width: 32px; height: 32px; font-size: 14px; border-radius: 8px; margin: 0; }
.login-title { font-size: 22px; font-weight: 700; }
.login-subtitle { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-group label { font-size: 12px; font-weight: 500; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; }
.field-group input,
.field-group select,
.field-group textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field-group input:focus,
.field-group select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.field-group input::placeholder { color: var(--text-3); }
.field-hint { font-size: 11px; color: var(--text-3); }
.required { color: var(--red); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid rgba(244,63,94,0.2); }
.btn-danger:hover { background: rgba(244,63,94,0.22); }
.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Dashboard layout ─────────────────────────────────────────────────────── */
#dashboard-screen {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand { font-size: 16px; font-weight: 700; }
.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
  width: 100%;
  transition: all 0.15s;
}
.nav-item svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav-item:hover, .nav-item.active { background: var(--surface-2); color: var(--text); }
.nav-item.active { color: var(--accent); background: var(--accent-glow); }
.nav-item.logout:hover { background: var(--red-bg); color: var(--red); }

/* Main */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px;
  max-width: calc(100vw - var(--sidebar-w));
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.page-title { font-size: 24px; font-weight: 700; }
.page-subtitle { color: var(--text-2); font-size: 13px; margin-top: 3px; }

/* ── Stats row ────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-2); margin-top: 4px; }

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.clients-table {
  width: 100%;
  border-collapse: collapse;
}
.clients-table th {
  text-align: left;
  padding: 12px 18px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.clients-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.clients-table tr:last-child td { border-bottom: none; }
.clients-table tbody tr { transition: background 0.15s; }
.clients-table tbody tr:hover { background: var(--surface-2); }

.client-name { font-weight: 600; font-size: 14px; }
.client-id   { font-size: 11px; color: var(--text-3); margin-top: 1px; }

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--text-2);
}

/* Toggle switch */
.toggle { display: inline-flex; cursor: pointer; align-items: center; }
.toggle input { display: none; }
.toggle-track {
  width: 40px; height: 22px;
  background: var(--surface-3);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
  border: 1px solid var(--border);
}
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle-thumb {
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px; left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.toggle-label { font-weight: 500; font-size: 14px; }
.toggle-desc  { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}
.status-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-ok     { color: var(--green); background: var(--green-bg); }
.badge-error  { color: var(--red);   background: var(--red-bg);   }
.badge-unknown{ color: var(--text-3);background: var(--surface-3);}

.last-check-time { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Row actions */
.row-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--text-2);
  transition: all 0.15s;
}
.btn-icon svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-icon:hover { background: var(--surface-2); color: var(--text); border-color: rgba(255,255,255,0.15); }
.btn-icon.danger:hover { background: var(--red-bg); color: var(--red); border-color: rgba(244,63,94,0.2); }

/* ── States ───────────────────────────────────────────────────────────────── */
.loading-state, .error-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 24px;
  color: var(--text-2);
  font-size: 14px;
}
.empty-icon { font-size: 40px; }
.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.error-state { color: var(--red); }

/* ── Error banner ─────────────────────────────────────────────────────────── */
.error-banner {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(244,63,94,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.18s ease;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.22s ease;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-sm { max-width: 420px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 17px; font-weight: 600; }
.modal-close {
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-2);
  transition: all 0.15s;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-close svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); flex-shrink: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.confirm-text { color: var(--text-2); font-size: 14px; }

/* ── Error toast ──────────────────────────────────────────────────────────── */
.error-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--surface);
  border: 1px solid rgba(244,63,94,0.3);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  color: var(--red);
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 999;
  max-width: 360px;
  animation: slideIn 0.2s ease;
}

/* ── Animations ───────────────────────────────────────────────────────────── */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .form-row { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 16px; max-width: 100vw; }
}
