/* ==========================================================================
   Malik Consults Cloud Control — Premium Design System
   ========================================================================== */

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

:root {
  --bg-primary: #070913;
  --bg-secondary: #0d121f;
  --bg-card: rgba(18, 24, 38, 0.7);
  --bg-card-hover: rgba(28, 36, 56, 0.85);
  --bg-card-solid: #111726;
  --bg-input: rgba(15, 23, 42, 0.8);
  --bg-overlay: rgba(3, 7, 18, 0.85);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);
  --border-accent: rgba(6, 182, 212, 0.4);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-blue: #3b82f6;
  --accent-purple: #a855f7;

  --status-success: #10b981;
  --status-success-bg: rgba(16, 185, 129, 0.15);
  --status-warning: #f59e0b;
  --status-warning-bg: rgba(245, 158, 11, 0.15);
  --status-danger: #ef4444;
  --status-danger-bg: rgba(239, 68, 68, 0.15);
  --status-info: #0ea5e9;
  --status-info-bg: rgba(14, 165, 233, 0.15);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  --shadow-cyan-glow: 0 0 25px rgba(6, 182, 212, 0.25);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
}

/* Background Ambient Glows */
body::before,
body::after {
  content: '';
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(140px);
  opacity: 0.18;
}

body::before {
  top: -200px;
  left: -200px;
  background: radial-gradient(circle, var(--accent-indigo), transparent 70%);
}

body::after {
  bottom: -200px;
  right: -200px;
  background: radial-gradient(circle, var(--accent-cyan), transparent 70%);
}

/* Layout Shell */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Sidebar (Desktop) */
.sidebar {
  width: 280px;
  background: rgba(13, 18, 31, 0.85);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
  text-decoration: none;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: white;
  box-shadow: var(--shadow-glow);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-info span {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.925rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  position: relative;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.15);
}

.nav-item .icon {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.25);
  color: var(--accent-cyan);
  font-weight: 600;
}

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

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b, #334155);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--accent-cyan);
}

.user-meta .name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-meta .role {
  font-size: 0.75rem;
  color: var(--status-success);
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-meta .role::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-success);
  box-shadow: 0 0 8px var(--status-success);
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 90px; /* Space for mobile nav */
}

/* Top Header */
.top-header {
  height: 76px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(13, 18, 31, 0.6);
  backdrop-filter: blur(15px);
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-title h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-title p {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Content Body */
.content-body {
  padding: 32px;
  flex: 1;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: var(--status-danger-bg);
  color: var(--status-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-success {
  background: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.25);
}

.btn-warning {
  background: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* Glass Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Stats Metric Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition-fast);
}

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

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.cyan {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.stat-icon.emerald {
  background: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.stat-icon.amber {
  background: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.stat-icon.rose {
  background: var(--status-danger-bg);
  color: var(--status-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.stat-content .stat-val {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.stat-content .stat-lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Control Bar (Search, Filters, Bulk Actions) */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 480px;
}

.search-box input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 18px 12px 44px;
  color: #fff;
  font-size: 0.925rem;
  outline: none;
  transition: var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.search-box .icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.filter-chip:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.filter-chip.active {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(6, 182, 212, 0.3);
}

/* Badges & Statuses */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.badge-success {
  background: var(--status-success-bg);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-success .badge-dot { background: #34d399; box-shadow: 0 0 8px #34d399; }

.badge-warning {
  background: var(--status-warning-bg);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-warning .badge-dot { background: #fbbf24; box-shadow: 0 0 8px #fbbf24; }

.badge-danger {
  background: var(--status-danger-bg);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-danger .badge-dot { background: #f87171; box-shadow: 0 0 8px #f87171; }

.badge-info {
  background: var(--status-info-bg);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
}
.badge-info .badge-dot { background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }

/* Ampelsystem Pill */
.ampel-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}
.ampel-green { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid #10b981; }
.ampel-yellow { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid #f59e0b; }
.ampel-red { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid #ef4444; }

/* Desktop Data Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 16px 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.5);
}

.data-table td {
  padding: 16px 20px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.domain-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.domain-name-link {
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
}

.domain-name-link:hover {
  color: var(--accent-cyan);
}

.domain-sub {
  font-size: 0.775rem;
  color: var(--text-dim);
}

/* Mobile Domain Cards (Shown on mobile, hidden on desktop) */
.mobile-cards-grid {
  display: none;
  grid-template-columns: 1fr;
  gap: 16px;
}

.mobile-domain-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mobile-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mobile-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.775rem;
}

.mobile-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mobile-stat-item .lbl {
  color: var(--text-dim);
  font-size: 0.7rem;
}

.mobile-stat-item .val {
  font-weight: 700;
  color: var(--text-main);
}

.mobile-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 68px;
  background: rgba(13, 18, 31, 0.95);
  backdrop-filter: blur(25px);
  border-top: 1px solid var(--border-subtle);
  z-index: 200;
  justify-content: space-around;
  align-items: center;
  padding: 0 10px;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.725rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.mobile-nav-item .icon {
  font-size: 1.3rem;
}

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

/* Forms & Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #fff;
  font-size: 0.925rem;
  outline: none;
  transition: var(--transition-fast);
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

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

/* Code & Terminal Blocks */
.code-block {
  background: #090d16;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: #38bdf8;
  position: relative;
  overflow-x: auto;
}

.code-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.code-copy-btn:hover {
  background: var(--accent-cyan);
  color: #000;
}

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

.toast {
  background: rgba(18, 24, 38, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glow);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  max-width: 380px;
}

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modal Popup */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-fast);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  padding: 28px;
  transform: scale(0.95);
  transition: var(--transition-fast);
}

.modal-backdrop.open .modal-content {
  transform: scale(1);
}

/* Reachability Indicators */
.ping-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.ping-online { background: #10b981; box-shadow: 0 0 10px #10b981; }
.ping-warn { background: #f59e0b; box-shadow: 0 0 10px #f59e0b; }
.ping-offline { background: #ef4444; box-shadow: 0 0 10px #ef4444; }
.ping-checking { background: #06b6d4; animation: pingPulse 1s infinite alternate; }

@keyframes pingPulse {
  0% { opacity: 0.3; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.2); }
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .sidebar {
    display: none;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .top-header {
    padding: 0 20px;
  }

  .content-body {
    padding: 20px;
  }

  .table-container {
    display: none;
  }

  .mobile-cards-grid {
    display: grid;
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 14px 16px;
    gap: 12px;
  }

  .stat-icon {
    width: 42px;
    height: 42px;
    font-size: 1.25rem;
  }

  .stat-content .stat-val {
    font-size: 1.4rem;
  }

  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: 100%;
  }
}
