/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --sidebar-width: 260px;
  --sidebar-bg: #0f1623;
  --sidebar-border: #1e2d42;
  --sidebar-text: #a0aec0;
  --sidebar-active-bg: #1a2942;
  --sidebar-active-text: #fff;
  --sidebar-hover-bg: #182235;
  --topbar-height: 60px;
  --brand-color: #3b82f6;
  --brand-color-dark: #2563eb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text-primary: #1a202c;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --radius: 10px;
  --radius-sm: 6px;
}

/* ── Reset / Base ─────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  background: var(--surface-alt);
  color: var(--text-primary);
  margin: 0;
  overflow-x: hidden;
}

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

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 1000;
  transition: transform 0.3s ease;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2d3748 transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #2d3748; border-radius: 2px; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-icon {
  width: 34px; height: 34px;
  background: var(--brand-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 17px;
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
  color: white;
  letter-spacing: -0.3px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--sidebar-border);
}

.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--brand-color), var(--brand-color-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name {
  color: white;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #4a5568;
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 450;
  transition: all 0.15s;
  margin-bottom: 2px;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: white;
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: white;
  font-weight: 500;
}

.nav-item i { font-size: 16px; width: 20px; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
}

.nav-item-logout { color: #fc8181 !important; }
.nav-item-logout:hover { background: rgba(252,129,129,.1) !important; }

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

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.topbar-breadcrumb {
  font-size: 13px;
  color: var(--text-secondary);
}
.topbar-breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.topbar-breadcrumb a:hover { color: var(--text-primary); }

.credit-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

/* ── Page Content ─────────────────────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px 28px;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header .card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

/* ── Stats Cards ──────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue { background: #eff6ff; color: #3b82f6; }
.stat-icon.green { background: #f0fdf4; color: #22c55e; }
.stat-icon.orange { background: #fff7ed; color: #f97316; }
.stat-icon.red { background: #fef2f2; color: #ef4444; }
.stat-icon.purple { background: #faf5ff; color: #a855f7; }
.stat-icon.teal { background: #f0fdfa; color: #14b8a6; }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table {
  font-size: 13.5px;
}
.table th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  background: var(--surface-alt);
  border-bottom: 2px solid var(--border);
  padding: 10px 16px;
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}
.table tbody tr:hover { background: #f8fafc; }
.table-responsive { border-radius: var(--radius); }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-active    { background: #dcfce7; color: #15803d; }
.status-pending   { background: #fef9c3; color: #92400e; }
.status-error     { background: #fee2e2; color: #b91c1c; }
.status-deleted   { background: #f1f5f9; color: #64748b; }
.status-transfer  { background: #e0f2fe; color: #0369a1; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  transition: all 0.15s;
}
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

.btn-primary {
  background: var(--brand-color);
  border-color: var(--brand-color);
}
.btn-primary:hover { background: var(--brand-color-dark); border-color: var(--brand-color-dark); }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-label {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.form-control, .form-select {
  font-size: 13.5px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-color);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* ── Page Headers ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Loading Spinner ──────────────────────────────────────────────────────── */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ── DNS Record Types ─────────────────────────────────────────────────────── */
.dns-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: monospace;
}
.dns-A     { background: #dbeafe; color: #1d4ed8; }
.dns-AAAA  { background: #e0e7ff; color: #4338ca; }
.dns-MX    { background: #fce7f3; color: #9d174d; }
.dns-CNAME { background: #d1fae5; color: #065f46; }
.dns-TXT   { background: #fef3c7; color: #92400e; }
.dns-NS    { background: #f3e8ff; color: #6b21a8; }
.dns-SRV   { background: #ffedd5; color: #9a3412; }
.dns-CAA   { background: #ecfdf5; color: #047857; }
.dns-PTR   { background: #f0f9ff; color: #075985; }

/* ── Import UI ────────────────────────────────────────────────────────────── */
.import-domain-row {
  transition: background 0.1s;
}
.import-domain-row.selected { background: #eff6ff; }
.import-domain-row input[type=checkbox] { cursor: pointer; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert { border-radius: var(--radius-sm); font-size: 13.5px; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info    { background: #f0f9ff; border-color: #bae6fd; color: #075985; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-content { border-radius: var(--radius); border: none; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); }

/* ── Auth Pages ───────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f1623 0%, #1a2942 100%);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  overflow: hidden;
}

.auth-header {
  background: linear-gradient(135deg, var(--brand-color), var(--brand-color-dark));
  padding: 32px 32px 28px;
  text-align: center;
  color: white;
}

.auth-header .logo-icon {
  width: 56px; height: 56px;
  background: rgba(255,255,255,.2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 26px;
}

.auth-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.auth-header p {
  font-size: 13px;
  opacity: 0.85;
  margin: 0;
}

.auth-body { padding: 32px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
  }
  .sidebar-overlay.active {
    display: block;
  }
  .topbar-menu-btn { display: block !important; }
}

/* ── Utilities ────────────────────────────────────────────────────────────── */
.font-mono { font-family: 'SFMono-Regular', Menlo, Monaco, Consolas, monospace; }
.text-truncate-200 { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer { cursor: pointer; }

/* ── Toasts ───────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast-item {
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-left: 4px solid;
  animation: slideIn 0.3s ease;
}

.toast-item.success { border-color: #22c55e; }
.toast-item.error   { border-color: #ef4444; }
.toast-item.info    { border-color: #3b82f6; }
.toast-item.warning { border-color: #f97316; }
.toast-item-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-item.success .toast-item-icon { color: #22c55e; }
.toast-item.error   .toast-item-icon { color: #ef4444; }
.toast-item.info    .toast-item-icon { color: #3b82f6; }
.toast-item.warning .toast-item-icon { color: #f97316; }
.toast-item-text { font-size: 13px; line-height: 1.4; }
.toast-item-close { margin-left: auto; cursor: pointer; color: #94a3b8; font-size: 14px; background: none; border: none; padding: 0; }

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
