/* ─────────────────────────────────────────────────────────────
   CloudBlur Panel — Design System
   Font: GT Eesti Pro Display
   Accent: #738AF8
   Background: #FFFFFF
   Weights: 300, 400, 500 only
───────────────────────────────────────────────────────────── */

/* ── Font ── */
@font-face {
  font-family: 'GTEestiProDisplay';
  src: url('../fonts/gteestiprodisplay_light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'GTEestiProDisplay';
  src: url('../fonts/gteestiprodisplay_regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'GTEestiProDisplay';
  src: url('../fonts/gteestiprodisplay_medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --accent: #738AF8;
  --accent-light: rgba(115, 138, 248, 0.1);
  --accent-hover: #5b72e8;
  --bg: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-hover: #f3f4f6;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --sidebar-w: 232px;
  --topbar-h: 64px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.07);
  --color-green: #10b981;
  --color-green-bg: #ecfdf5;
  --color-red: #ef4444;
  --color-red-bg: #fef2f2;
  --color-orange: #f59e0b;
  --color-orange-bg: #fffbeb;
  --color-purple: #8b5cf6;
  --color-purple-bg: #f5f3ff;
}

html, body {
  font-family: 'GTEestiProDisplay', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════ */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-wrap {
  width: 100%;
  max-width: 400px;
  padding: 24px 16px;
}

.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  box-shadow: var(--shadow);
}

/* Logo */
.login-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.login-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 16px;
}

.login-brand {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

/* Error */
.login-error {
  width: 100%;
  background: var(--color-red-bg);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  color: var(--color-red);
  font-size: 13px;
  font-weight: 400;
  padding: 10px 14px;
  margin-bottom: 20px;
  text-align: center;
}

/* Form */
.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 14px;
  pointer-events: none;
  flex-shrink: 0;
  z-index: 1;
}

.field-input {
  width: 100%;
  height: 44px;
  padding: 0 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-secondary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field-input::placeholder {
  color: var(--text-muted);
  font-weight: 300;
}

.field-input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(115, 138, 248, 0.12);
}

/* TOTP input styling */
.totp-input {
  letter-spacing: 6px;
  font-size: 18px;
  font-weight: 500;
  text-align: center;
  padding-left: 42px;
  padding-right: 48px;
}

.totp-input::placeholder {
  letter-spacing: 2px;
  font-size: 14px;
}

/* Eye button */
.field-eye {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  padding: 4px;
  display: flex;
  align-items: center;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.field-eye:hover { opacity: 1; }

/* TOTP timer ring */
.totp-timer {
  position: absolute;
  right: 12px;
  width: 24px;
  height: 24px;
}

.totp-ring {
  width: 24px;
  height: 24px;
  transform: rotate(-90deg);
}

.totp-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 3;
}

.totp-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s linear, stroke 0.3s;
}

/* Login button */
.login-btn {
  width: 100%;
  height: 46px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-top: 8px;
  transition: background 0.15s, transform 0.1s;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-btn:hover { background: var(--accent-hover); }
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.7; cursor: not-allowed; }

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Footer */
.login-footer {
  margin-top: 24px;
  font-size: 12px;
  font-weight: 300;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   PANEL LAYOUT
═══════════════════════════════════════════════════════════ */

.panel-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg-secondary);
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Sidebar Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.sidebar-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 400;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.nav-item.active .nav-icon {
  color: var(--accent);
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.12s;
}

.nav-item:hover .nav-icon {
  color: var(--text-secondary);
}

.nav-label {
  flex: 1;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 8px 20px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 400;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
}

.sidebar-logout:hover {
  background: var(--color-red-bg);
  color: var(--color-red);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.topbar-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.topbar-subtitle {
  font-size: 13px;
  font-weight: 300;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-time {
  font-size: 12px;
  font-weight: 300;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--color-green);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-text {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-green);
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 24px 28px 0;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.stat-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon--blue   { background: rgba(115,138,248,0.1); color: var(--accent); }
.stat-icon--green  { background: var(--color-green-bg); color: var(--color-green); }
.stat-icon--purple { background: var(--color-purple-bg); color: var(--color-purple); }
.stat-icon--orange { background: var(--color-orange-bg); color: var(--color-orange); }
.stat-icon--red    { background: var(--color-red-bg); color: var(--color-red); }

.stat-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.stat-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
}

.stat-value {
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.stat-value small {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

/* ── Chart ── */
.chart-section {
  padding: 20px 28px 28px;
  flex: 1;
}

.chart-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  height: 100%;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.chart-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.chart-subtitle {
  font-size: 12px;
  font-weight: 300;
  color: var(--text-muted);
}

.chart-badge {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}

.chart-wrap {
  flex: 1;
  position: relative;
  min-height: 260px;
}

/* ── Scrollbar global ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #d1d5db; }

/* ── Selection ── */
::selection { background: var(--accent-light); }

/* ═══════════════════════════════════════════════════════════
   COMMON COMPONENTS & FORM ELEMENTS
   Added for Unified Premium Style (Tables, Badges, Modals, Forms)
═══════════════════════════════════════════════════════════ */

/* Form Elements */
.fgroup { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.fgroup label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.fgroup input, .fgroup select, .fgroup textarea { 
  padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); 
  font-size: 13px; background: #fff; font-family: 'GTEestiProDisplay', sans-serif; color: var(--text-primary); outline: none; transition: border-color 0.15s; 
}
.fgroup input:focus, .fgroup select:focus, .fgroup textarea:focus { 
  border-color: var(--accent); 
}
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.form-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Toggles */
.toggle-wrap { display: flex; align-items: center; justify-content: space-between; background: var(--bg-secondary); border: 1px solid var(--border); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.toggle-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 22px; transition: .25s; }
.toggle-slider:before { content: ''; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .25s; }
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider:before { transform: translateX(18px); }

/* Custom Select Dropdowns */
.custom-select { position: relative; display: inline-block; font-family: 'GTEestiProDisplay', sans-serif; user-select: none; }
.custom-select-trigger { display: flex; align-items: center; justify-content: space-between; height: 40px; padding: 0 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-primary); cursor: pointer; transition: border-color .15s; gap: 10px; }
.custom-select-trigger:hover { border-color: var(--accent); }
.custom-select.open .custom-select-trigger { border-color: var(--accent); }
.custom-select-arrow { transition: transform .2s; color: var(--text-muted); flex-shrink: 0; }
.custom-select.open .custom-select-arrow { transform: rotate(180deg); }
.custom-select-options { position: absolute; top: calc(100% + 4px); left: 0; width: 100%; min-width: 140px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 4px 12px rgba(0,0,0,.08); z-index: 100; display: none; max-height: 200px; overflow-y: auto; }
.custom-select.open .custom-select-options { display: block; }
.custom-option { padding: 9px 14px; font-size: 13px; color: var(--text-secondary); cursor: pointer; transition: background .12s, color .12s; text-align: left; }
.custom-option:hover { background: var(--bg-hover); color: var(--text-primary); }
.custom-option.selected { background: var(--accent-light); color: var(--accent); font-weight: 500; }

/* Buttons */
.btn-prim { background: var(--accent); color: #fff; border: none; height: 40px; padding: 0 22px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; font-family: 'GTEestiProDisplay', sans-serif; cursor: pointer; transition: background 0.15s; display: inline-flex; align-items: center; justify-content: center; gap: 8px;}
.btn-prim:hover { background: var(--accent-hover); }
.btn-sec  { background: #fff; border: 1px solid var(--border); color: var(--text-secondary); height: 40px; padding: 0 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; font-family: 'GTEestiProDisplay', sans-serif; cursor: pointer; transition: background .12s; display: inline-flex; align-items: center; justify-content: center; }
.btn-sec:hover { background: var(--bg-hover); }

/* Premium Tables */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); margin-top: 14px; box-shadow: var(--shadow-sm); }
.servers-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.servers-table th { text-align: left; padding: 14px 16px; color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid var(--border); background: var(--bg-secondary); white-space: nowrap; }
.servers-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-primary); vertical-align: middle; }
.servers-table tr:hover td { background: var(--bg-secondary); }

/* Badges */
.badge { display: inline-block; padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 500; }
.badge-gray { background: var(--border-light); color: var(--text-secondary); }
.badge-blue { background: var(--accent-light); color: var(--accent); }
.badge-green { background: var(--color-green-bg); color: var(--color-green); }
.badge-red { background: var(--color-red-bg); color: var(--color-red); }

/* Actions */
.action-btns { display: flex; gap: 6px; }
.btn-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 8px; cursor: pointer; transition: .15s; font-size: 14px; }
.btn-edit { background: var(--accent-light); color: var(--accent); }
.btn-edit:hover { background: rgba(115,138,248,.18); }
.btn-del { background: var(--color-red-bg); color: var(--color-red); }
.btn-del:hover { background: rgba(239,68,68,.18); }

/* Premium Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); backdrop-filter: blur(2px); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-card { background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 28px; width: 480px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.12); color: #111827; }
.modal-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.mfooter { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 20px; }
