/* InboxDNS AI — Modern SaaS Dashboard */
:root {
  --sidebar-width: 260px;
  --sidebar-collapsed: 78px;
  --topbar-height: 64px;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #4f46e5;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: #1f2937;
  --sidebar-bg: #020617;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

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

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* Layout */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: width var(--transition), transform var(--transition);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section { opacity: 0; width: 0; overflow: hidden; }

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-brand .logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0;
}
.brand-text { font-weight: 700; color: #fff; white-space: nowrap; transition: opacity var(--transition); }
.brand-text small { display: block; font-weight: 400; font-size: 11px; color: var(--sidebar-text); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 24px;
  scrollbar-width: thin;
}
.nav-section {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: #64748b; padding: 14px 14px 6px; white-space: nowrap;
}
.sidebar .nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin: 2px 0; border-radius: 10px;
  color: var(--sidebar-text); font-size: 14px; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.sidebar .nav-link i { width: 20px; text-align: center; font-size: 16px; flex-shrink: 0; }
.sidebar .nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar .nav-link.active {
  background: var(--sidebar-active); color: #fff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  transition: margin-left var(--transition);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.sidebar.collapsed ~ .main-wrap,
body.sidebar-collapsed .main-wrap { margin-left: var(--sidebar-collapsed); }
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }

.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 1020;
  box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.btn-icon {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center;
  cursor: pointer; transition: background var(--transition);
}
.btn-icon:hover { background: var(--bg); }
.breadcrumb { margin: 0; background: transparent; font-size: 13px; }
.breadcrumb-item + .breadcrumb-item::before { content: "›"; }

.page-content { padding: 24px; flex: 1; }

/* Cards */
.card-soft {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-soft .card-header {
  background: transparent; border-bottom: 1px solid var(--border);
  padding: 16px 20px; font-weight: 600;
}
.card-soft .card-body { padding: 20px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  height: 100%;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15,23,42,.08); }
.stat-card .stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center; font-size: 20px; color: #fff;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 12px; }
.stat-card .stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.bg-grad-1 { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.bg-grad-2 { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.bg-grad-3 { background: linear-gradient(135deg, #10b981, #34d399); }
.bg-grad-4 { background: linear-gradient(135deg, #f59e0b, #f97316); }

.score-ring {
  width: 88px; height: 88px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--primary) calc(var(--score) * 1%), var(--border) 0);
  position: relative;
}
.score-ring::before {
  content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface);
}
.score-ring span { position: relative; font-weight: 700; font-size: 20px; }

/* Forms */
.form-control, .form-select {
  border-radius: 10px; border-color: var(--border);
  background: var(--surface); color: var(--text); padding: 10px 14px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15);
  background: var(--surface); color: var(--text);
}
.form-label { font-weight: 500; font-size: 13px; margin-bottom: 6px; }
.btn { border-radius: 10px; font-weight: 550; padding: 10px 18px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }

/* Tables */
.table-modern { margin: 0; color: var(--text); }
.table-modern thead th {
  background: var(--bg); border-bottom: 1px solid var(--border);
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600; padding: 12px 16px; white-space: nowrap;
}
.table-modern td { padding: 14px 16px; border-color: var(--border); vertical-align: middle; }
.table-modern tbody tr:hover { background: rgba(79,70,229,.03); }

.badge-soft {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.badge-soft.success { background: rgba(16,185,129,.12); color: #059669; }
.badge-soft.warning { background: rgba(245,158,11,.12); color: #d97706; }
.badge-soft.danger { background: rgba(239,68,68,.12); color: #dc2626; }
.badge-soft.info { background: rgba(59,130,246,.12); color: #2563eb; }
.badge-soft.secondary { background: rgba(100,116,139,.12); color: #475569; }

/* Code / zone preview */
.zone-preview {
  background: #0b1020; color: #e2e8f0; border-radius: 12px;
  padding: 16px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.55; max-height: 520px; overflow: auto;
  white-space: pre; border: 1px solid #1e293b;
}

/* Auth */
.auth-page {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(ellipse at top, #312e81 0%, #0f172a 55%, #020617 100%);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 440px; background: #fff; border-radius: 20px;
  padding: 36px 32px; box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
[data-theme="dark"] .auth-card { background: #111827; color: var(--text); }
.auth-logo {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; color: #fff; font-size: 22px; font-weight: 800;
}

/* Toast container */
#toast-container {
  position: fixed; top: 80px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 10px; max-width: 360px;
}
.toast-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start;
  animation: slideIn .25s ease;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.loading-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 3000;
  display: none; place-items: center; backdrop-filter: blur(2px);
}
.loading-overlay.show { display: grid; }
.spinner-lg {
  width: 48px; height: 48px; border: 4px solid rgba(255,255,255,.25);
  border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Status pills for reports */
.status-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.status-dot.pass { background: var(--success); }
.status-dot.fail { background: var(--danger); }
.status-dot.warn, .status-dot.warning { background: var(--warning); }
.status-dot.missing, .status-dot.optional, .status-dot.manual { background: #94a3b8; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state i { font-size: 40px; opacity: .5; margin-bottom: 12px; }

/* Mobile */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035;
}
.sidebar-backdrop.show { display: block; }

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrap, body.sidebar-collapsed .main-wrap { margin-left: 0 !important; }
  .page-content { padding: 16px; }
}

/* Print */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-wrap { margin: 0 !important; }
  .zone-preview { max-height: none; color: #000; background: #fff; border: 1px solid #ccc; }
}
