/* ================================================
   MegaDNS - Main Stylesheet
   Meganet Sistemas
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
  --bg-primary: #050810;
  --bg-secondary: #0a0f1e;
  --bg-card: rgba(10, 15, 30, 0.7);
  --bg-card-hover: rgba(15, 22, 40, 0.8);
  --accent: #00d4ff;
  --accent-hover: #33ddff;
  --accent-glow: rgba(0, 212, 255, 0.25);
  --success: #00ff88;
  --success-bg: rgba(0, 255, 136, 0.1);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --danger: #ff4d6a;
  --danger-bg: rgba(255, 77, 106, 0.1);
  --info: #22d3ee;
  --info-bg: rgba(34, 211, 238, 0.1);
  --text-primary: #e8f0ff;
  --text-secondary: #8899bb;
  --text-muted: #556688;
  --border: rgba(0, 212, 255, 0.08);
  --border-active: rgba(0, 212, 255, 0.4);
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.4);
  --transition: all 0.2s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; }

/* ---- Custom Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: #2a3550; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a4a6b; }
* { scrollbar-width: thin; scrollbar-color: #2a3550 var(--bg-secondary); }

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p { color: var(--text-secondary); margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

.gradient-text {
  background: linear-gradient(135deg, #00d4ff, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Button System ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  outline: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, #0055cc, #00d4ff);
  color: #fff;
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #00aaff, #33ddff);
  border-color: rgba(0, 212, 255, 0.6);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.35), 0 0 40px rgba(0, 212, 255, 0.15);
  color: #fff;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.25);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover {
  background: #059669;
  border-color: #059669;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
  color: #fff;
}

.btn-warning {
  background: var(--warning);
  color: #000;
  border-color: var(--warning);
}
.btn-warning:hover {
  background: #d97706;
  border-color: #d97706;
  color: #000;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-full { width: 100%; }

.btn-icon {
  padding: 8px;
  min-width: 36px;
  width: 36px;
  height: 36px;
}

/* ---- Form Elements ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1.25rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input,
.form-select,
.form-textarea {
  background: rgba(10, 15, 30, 0.6);
  border: 1.5px solid rgba(0, 212, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 10px 14px;
  width: 100%;
  transition: var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: rgba(0, 212, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12), 0 0 12px rgba(0, 212, 255, 0.08);
  background: rgba(5, 8, 16, 0.6);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Toggle / Switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(0, 212, 255, 0.15);
  border-radius: 24px;
  transition: var(--transition);
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Range Slider */
.form-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 212, 255, 0.15);
  outline: none;
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0066ff, #00d4ff);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.form-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0066ff, #00d4ff);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

/* ---- Cards ---- */
.card {
  background: rgba(10, 15, 30, 0.7);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: var(--transition);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.card:hover { border-color: rgba(0, 212, 255, 0.18); box-shadow: 0 0 12px rgba(0, 212, 255, 0.06); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Stat Cards */
.stat-card {
  background: rgba(10, 15, 30, 0.6);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--accent);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.stat-card.accent::before { background: var(--accent); box-shadow: 0 0 10px rgba(0, 212, 255, 0.5); }
.stat-card.success::before { background: var(--success); box-shadow: 0 0 10px rgba(0, 255, 136, 0.5); }
.stat-card.warning::before { background: var(--warning); box-shadow: 0 0 10px rgba(251, 191, 36, 0.5); }
.stat-card.danger::before { background: var(--danger); box-shadow: 0 0 10px rgba(255, 77, 106, 0.5); }
.stat-card.info::before { background: var(--info); box-shadow: 0 0 10px rgba(34, 211, 238, 0.5); }

.stat-card:hover {
  border-color: rgba(0, 212, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.08), var(--shadow-card);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-change {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ---- Grid Layouts ---- */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ---- Table Styles ---- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead {
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 1;
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr {
  background: rgba(10, 15, 30, 0.5);
  transition: var(--transition);
}

.table tbody tr:nth-child(even) {
  background: rgba(5, 10, 20, 0.5);
}

.table tbody tr:hover {
  background: rgba(0, 212, 255, 0.04);
}

.table-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ---- Badge System ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-accent { background: var(--accent-glow); color: var(--accent); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }

.integration-meta {
  background: rgba(10, 15, 30, 0.6);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.84rem;
  padding: 0.85rem 0.95rem;
}

.empty-state {
  background: rgba(10, 15, 30, 0.4);
  border: 1px dashed rgba(0, 212, 255, 0.15);
  border-radius: var(--radius);
  color: var(--text-muted);
  padding: 1.25rem;
  text-align: center;
}

.table-row-selected {
  outline: 1px solid rgba(0, 212, 255, 0.35);
  background: rgba(0, 212, 255, 0.06) !important;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* ---- Modal System ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 22, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: rgba(10, 15, 30, 0.9);
  border: 1px solid rgba(0, 212, 255, 0.12);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.2s ease;
  position: relative;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.06), 0 25px 50px -15px rgba(0, 0, 0, 0.6);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-lg { max-width: 720px; }
.modal-sm { max-width: 380px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  line-height: 1;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.modal-body { padding: 1.5rem; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ---- Toast Notifications ---- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(10, 15, 30, 0.9);
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 300px;
  max-width: 400px;
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.06), var(--shadow);
  pointer-events: all;
  animation: toastIn 0.3s ease forwards;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: var(--accent);
  animation: toastBar 4s linear forwards;
}

.toast.toast-success::after { background: var(--success); }
.toast.toast-warning::after { background: var(--warning); }
.toast.toast-danger::after { background: var(--danger); }

.toast.removing { animation: toastOut 0.3s ease forwards; }

.toast-icon { font-size: 1.25rem; flex-shrink: 0; margin-top: 1px; }

.toast-content { flex: 1; }

.toast-title {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px;
  flex-shrink: 0;
  transition: var(--transition);
}

.toast-close:hover { color: var(--text-primary); }

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

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

@keyframes toastBar {
  from { width: 100%; }
  to { width: 0%; }
}

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

.sidebar {
  width: var(--sidebar-width);
  background: rgba(10, 15, 30, 0.95);
  border-right: 1px solid rgba(0, 212, 255, 0.08);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sidebar-logo {
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.08);
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.04) 0%, transparent 60%);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0055cc, #00d4ff);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.3);
}

.logo-text { flex: 1; }

.logo-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.75rem 0.5rem 0.4rem;
  margin-top: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
  position: relative;
  text-decoration: none;
  border: 1px solid transparent;
  user-select: none;
}

.nav-item:hover {
  background: rgba(0, 212, 255, 0.06);
  color: var(--text-primary);
  border-color: rgba(0, 212, 255, 0.12);
}

.nav-item.active {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent);
  border-color: rgba(0, 212, 255, 0.3);
  font-weight: 600;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.08);
}

.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--warning);
  color: #000;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.3);
}

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

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(10, 15, 30, 0.6);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0055cc, #00d4ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1rem;
  transition: var(--transition);
  flex-shrink: 0;
}

.logout-btn:hover { color: var(--danger); }

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

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: linear-gradient(90deg, rgba(10, 15, 30, 0.95) 0%, rgba(10, 20, 40, 0.95) 100%);
  border-bottom: 1px solid rgba(0, 212, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(0, 212, 255, 0.06), 0 4px 20px rgba(0, 0, 0, 0.3);
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-content {
  padding: 1.5rem;
  flex: 1;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ---- Sections / Views ---- */
.section-view { display: none; }
.section-view.active { display: block; }

/* ---- Tabs System ---- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 7px 16px;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  background: none;
  border: none;
  font-family: var(--font);
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-primary); background: var(--bg-card); }

.tab-btn.active {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.1);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Progress Bars ---- */
.progress-wrap { margin-bottom: 0.75rem; }
.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.8rem;
}
.progress-name { color: var(--text-secondary); font-weight: 500; }
.progress-pct { color: var(--text-muted); }

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(0, 212, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, #0066ff, #00d4ff);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger { background: var(--danger); }

/* ---- Loading Spinner ---- */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.spinner-lg { width: 40px; height: 40px; }
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }

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

/* Pulse dot */
.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--success);
  opacity: 0.4;
  animation: pulse 1.5s ease-out infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.4; }
  100% { transform: scale(2); opacity: 0; }
}

/* ---- SVG Metric Rings (Gauges) ---- */
.gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
}

.gauge-svg {
  transform: rotate(-90deg);
  overflow: visible;
}

.gauge-bg {
  fill: none;
  stroke: rgba(0, 212, 255, 0.1);
  stroke-width: 10;
}

.gauge-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease, stroke 0.4s ease;
  filter: drop-shadow(0 0 6px rgba(0, 212, 255, 0.4));
}

.gauge-label {
  text-align: center;
  margin-top: 12px;
}

.gauge-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.gauge-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* ---- Update Banner ---- */
.update-banner {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(251, 191, 36, 0.05));
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.update-banner-icon { font-size: 1.5rem; flex-shrink: 0; }

.update-banner-content { flex: 1; min-width: 200px; }

.update-banner-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--warning);
  margin-bottom: 2px;
}

.update-banner-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.update-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---- AI Chat Interface ---- */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 500px;
  background: rgba(10, 15, 30, 0.6);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
}

.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.chat-msg.bot .chat-avatar { background: rgba(0, 212, 255, 0.15); border-color: rgba(0, 212, 255, 0.3); }

.chat-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.chat-msg.bot .chat-bubble {
  background: rgba(10, 15, 30, 0.7);
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-radius: 2px 12px 12px 12px;
}

.chat-msg.user .chat-bubble {
  background: var(--accent);
  border-radius: 12px 2px 12px 12px;
}

.chat-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
}

.chat-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.2s ease-in-out infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-4px); opacity: 1; }
}

.chat-suggestions {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-suggestion-btn {
  padding: 5px 12px;
  background: rgba(10, 15, 30, 0.6);
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-radius: 100px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
}

.chat-suggestion-btn:hover {
  border-color: rgba(0, 212, 255, 0.3);
  color: var(--accent);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.1);
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.chat-input {
  flex: 1;
  background: rgba(10, 15, 30, 0.6);
  border: 1.5px solid rgba(0, 212, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.875rem;
  padding: 9px 14px;
  outline: none;
  transition: var(--transition);
}

.chat-input:focus {
  border-color: rgba(0, 212, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12), 0 0 12px rgba(0, 212, 255, 0.08);
}

/* ---- Landing Page Styles ---- */

/* Navbar */
.landing-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 212, 255, 0.08);
  gap: 2rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #0055cc, #00d4ff);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.3);
}

.nav-logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  padding: 7px 14px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-decoration: none;
}

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

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 100px 2rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  max-width: 760px;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: var(--accent);
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: 0.04em;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.1);
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  line-height: 1.15;
  margin-bottom: 1.25rem;
  font-weight: 800;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Plans Section */
.landing-section {
  padding: 5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 1rem;
}

.section-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 560px;
}

.section-header {
  margin-bottom: 3rem;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.plan-card {
  background: rgba(10, 15, 30, 0.7);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.plan-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1), 0 16px 48px rgba(0, 0, 0, 0.3);
  border-color: rgba(0, 212, 255, 0.25);
}

.plan-card.featured {
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.3), 0 0 25px rgba(0, 212, 255, 0.12), 0 16px 48px rgba(0, 0, 0, 0.3);
  transform: scale(1.02);
}

.plan-card.featured:hover {
  transform: scale(1.02) translateY(-4px);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.2), 0 0 50px rgba(0, 212, 255, 0.1), 0 20px 50px rgba(0, 0, 0, 0.4);
}

.plan-featured-badge {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #0055cc, #00d4ff);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: 0 0 10px 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

.plan-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.plan-price {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.plan-price span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
}

.plan-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.plan-features {
  list-style: none;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.plan-feature::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Install Section */
.install-section {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.install-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 600px;
  margin: 0 auto;
}

.code-output-wrap {
  margin-top: 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.code-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #0a0e1a;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.code-output-dots {
  display: flex;
  gap: 6px;
}

.code-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.code-dot:nth-child(1) { background: #ff5f56; }
.code-dot:nth-child(2) { background: #ffbd2e; }
.code-dot:nth-child(3) { background: #27c93f; }

.code-output {
  background: rgba(5, 8, 16, 0.8);
  padding: 1.25rem 1.5rem;
  max-height: 320px;
  overflow-y: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  line-height: 1.7;
  color: #00ff88;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid rgba(0, 255, 136, 0.1);
}

.code-run-cmd {
  background: rgba(0, 212, 255, 0.06);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 1rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.875rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.code-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.code-actions {
  display: flex;
  gap: 8px;
  margin-top: 1rem;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.feature-card {
  background: rgba(10, 15, 30, 0.7);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: var(--transition);
}

.feature-card:hover {
  border-color: rgba(0, 212, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.08), var(--shadow-card);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.feature-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.feature-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Footer */
.landing-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 3rem 2rem 2rem;
  text-align: center;
}

.footer-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.footer-links {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.footer-link {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: none;
  transition: var(--transition);
}

.footer-link:hover { color: var(--text-primary); }

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Login Overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 800;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.login-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.login-card {
  background: rgba(10, 15, 30, 0.85);
  border: 1px solid rgba(0, 212, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  transform: translateY(20px);
  transition: transform 0.25s ease;
  position: relative;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.06), 0 25px 50px -15px rgba(0, 0, 0, 0.6);
}

.login-overlay.active .login-card {
  transform: translateY(0);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #0055cc, #00d4ff);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.25), 0 0 40px rgba(0, 212, 255, 0.1);
}

.login-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #fff 0%, #00d4ff 50%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.35);
}

.login-hint {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Progress Bar (Update modal) */
.update-progress-modal {
  text-align: center;
}

.update-progress-step {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.update-progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #1a2540;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.update-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.update-progress-pct {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
}

/* ---- Dashboard Charts ---- */
.chart-card {
  background: rgba(10, 15, 30, 0.7);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.chart-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.chart-canvas-wrap {
  position: relative;
  height: 220px;
}

/* ---- Info / Alert Boxes ---- */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.alert-info { background: rgba(34, 211, 238, 0.08); border-color: rgba(34, 211, 238, 0.25); color: var(--info); }
.alert-success { background: rgba(0, 255, 136, 0.08); border-color: rgba(0, 255, 136, 0.25); color: var(--success); }
.alert-warning { background: rgba(251, 191, 36, 0.08); border-color: rgba(251, 191, 36, 0.25); color: var(--warning); }
.alert-danger { background: rgba(255, 77, 106, 0.08); border-color: rgba(255, 77, 106, 0.25); color: var(--danger); }

/* ---- Utility Classes ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.hidden { display: none !important; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-primary { color: var(--text-primary) !important; }
.text-accent { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* Dynamic list items */
.dynamic-list { display: flex; flex-direction: column; gap: 8px; }
.dynamic-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(10, 15, 30, 0.6);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: var(--radius-sm);
}

.dynamic-list-item input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.875rem;
  outline: none;
}

.remove-item-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: var(--transition);
  flex-shrink: 0;
}

.remove-item-btn:hover { background: var(--danger-bg); }

/* DNS Log table */
.log-row-new {
  animation: rowFade 0.4s ease;
}

@keyframes rowFade {
  from { background: rgba(26, 92, 255, 0.12); }
  to { background: transparent; }
}

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 15, 30, 0.6);
  border: 1.5px solid rgba(0, 212, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: var(--transition);
}

.search-bar:focus-within {
  border-color: rgba(0, 212, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12), 0 0 12px rgba(0, 212, 255, 0.08);
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.875rem;
  flex: 1;
}

.search-bar input::placeholder { color: var(--text-muted); }

/* Token blur */
.token-blur {
  filter: blur(6px);
  transition: filter 0.3s ease;
  user-select: none;
}

.token-blur.revealed { filter: none; user-select: text; }

/* Danger zone */
.danger-zone {
  border: 1px solid rgba(255, 77, 106, 0.25);
  border-radius: var(--radius);
  padding: 1.5rem;
  background: rgba(255, 77, 106, 0.04);
}

.danger-zone-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .plans-grid { grid-template-columns: 1fr 1fr; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

  .main-content {
    margin-left: 0;
  }

  .plans-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }

  .plan-card.featured { transform: none; }

  .hero h1 { font-size: 2rem; }
  .hero-desc { font-size: 0.95rem; }

  .landing-section { padding: 3rem 1rem; }
  .landing-nav { padding: 0 1rem; }

  .nav-links { display: none; }

  .topbar { padding: 0 1rem; }
  .page-content { padding: 1rem; }

  .form-row { grid-template-columns: 1fr; }

  .chat-container { height: 420px; }

  .modal { max-width: calc(100vw - 2rem); }
  .modal-lg { max-width: calc(100vw - 2rem); }
}

@media (max-width: 480px) {
  h1 { font-size: 1.75rem; }
  .stat-value { font-size: 1.5rem; }
  .grid-4 { grid-template-columns: 1fr; }
  .tabs { flex-direction: column; }
  .update-banner { flex-direction: column; }
  .hero-actions { flex-direction: column; align-items: center; }
}
