/* ==================================================
   Syrian Cloud — Portal
   Dark theme on Invent Cub foundations
   Accent: cyan #22D3EE
   ================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');
@import url('https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css');

:root {
  /* Backgrounds — Vercel/Linear-ish dark */
  --bg-canvas:        #0A0A0B;       /* page */
  --bg-sidebar:       #0E0F11;       /* sidebar */
  --bg-surface:       #131416;       /* cards */
  --bg-surface-2:     #1A1B1E;       /* nested / hover */
  --bg-surface-3:     #232428;       /* row hover */
  --bg-elevated:      #1C1D20;       /* modals / drawers */
  --bg-input:         #131416;
  --bg-mask:          rgba(0,0,0,0.65);

  /* Borders */
  --border:           #232428;
  --border-strong:    #2E3033;
  --border-faint:     #1A1B1E;

  /* Text */
  --text:             #EDEEF0;
  --text-secondary:   #A4A7AE;
  --text-tertiary:    #6E7177;
  --text-quaternary:  #4B4D52;

  /* Accent — cyan */
  --accent:           #22D3EE;
  --accent-hover:     #67E8F9;
  --accent-active:    #06B6D4;
  --accent-bg:        rgba(34, 211, 238, 0.10);
  --accent-bg-hover:  rgba(34, 211, 238, 0.16);
  --accent-border:    rgba(34, 211, 238, 0.25);
  --accent-text:      #67E8F9;

  /* Semantic */
  --success:          #34D399;
  --success-bg:       rgba(52, 211, 153, 0.10);
  --success-border:   rgba(52, 211, 153, 0.25);
  --success-text:     #6EE7B7;

  --warning:          #FBBF24;
  --warning-bg:       rgba(251, 191, 36, 0.10);
  --warning-border:   rgba(251, 191, 36, 0.25);
  --warning-text:     #FCD34D;

  --error:            #F87171;
  --error-bg:         rgba(248, 113, 113, 0.10);
  --error-border:     rgba(248, 113, 113, 0.25);
  --error-text:       #FCA5A5;

  --neutral-bg:       rgba(164, 167, 174, 0.10);
  --neutral-border:   rgba(164, 167, 174, 0.20);

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Radius */
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Spacing scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 48px;

  /* Motion */
  --motion: 0.18s cubic-bezier(0.215, 0.61, 0.355, 1);
  --motion-slow: 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 18px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}

#root { min-height: 100vh; }

/* ============================================
   App shell
   ============================================ */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.brand-mark {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent) 0%, #0891B2 100%);
  display: grid; place-items: center;
  color: #051014;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.brand-region {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
}

.nav-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-quaternary);
  padding: 12px 12px 6px;
  font-weight: 500;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--motion), color var(--motion);
  border: 1px solid transparent;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item i { width: 16px; text-align: center; font-size: 13px; opacity: 0.85; }
.nav-item:hover { background: var(--bg-surface-2); color: var(--text); }
.nav-item.active {
  background: var(--bg-surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.nav-item.active i { color: var(--accent); opacity: 1; }
.nav-item .nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-surface-3);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.nav-item.active .nav-badge { background: var(--accent-bg); color: var(--accent-text); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}

.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4B5563, #1F2937);
  display: grid; place-items: center;
  font-weight: 600; font-size: 11px;
  color: var(--text);
  flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 500; line-height: 1.3; }
.user-email { font-size: 11px; color: var(--text-tertiary); line-height: 1.3; }

/* Main column */
.main {
  display: flex; flex-direction: column;
  min-width: 0;
}

/* Top bar */
.topbar {
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 11, 0.7);
  backdrop-filter: blur(8px);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 10;
}
.topbar-title {
  font-size: 14px; font-weight: 600;
  letter-spacing: -0.01em;
}
.topbar-crumb {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-tertiary); font-size: 13px;
}
.topbar-crumb i { font-size: 10px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search-input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px 6px 30px;
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-sans);
  width: 220px;
  height: 30px;
  position: relative;
  transition: border-color var(--motion), background var(--motion);
}
.search-wrap { position: relative; }
.search-wrap i {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-tertiary); font-size: 11px;
  pointer-events: none;
}
.search-input::placeholder { color: var(--text-tertiary); }
.search-input:focus {
  outline: none;
  border-color: var(--accent-border);
  background: var(--bg-surface-2);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* Page content */
.page {
  padding: 28px 28px 48px;
  max-width: 1400px;
  width: 100%;
}
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-title {
  font-size: 22px; font-weight: 600; letter-spacing: -0.02em;
  margin: 0;
}
.page-subtitle {
  font-size: 13px; color: var(--text-secondary);
  margin-top: 4px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: background var(--motion), border-color var(--motion), color var(--motion);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-surface-3); border-color: #3A3D42; }
.btn:active { background: var(--bg-surface-2); }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; }
.btn i { font-size: 11px; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #051014;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); border-color: var(--accent-active); }

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

.btn-danger {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--error-text);
}
.btn-danger:hover { background: var(--error-bg); border-color: var(--error-border); color: var(--error); }

.btn-sm { height: 26px; padding: 0 9px; font-size: 11px; }
.btn-lg { height: 38px; padding: 0 16px; font-size: 13px; }
.btn-icon { width: 30px; padding: 0; }

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-pad { padding: 20px; }
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 13px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--text-secondary); }

/* KPI / stat tile */
.stat {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 10px;
  position: relative;
  overflow: hidden;
}
.stat-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-tertiary); font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.stat-label i { font-size: 11px; }
.stat-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}
.stat-meta { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.stat-meta .delta-up { color: var(--success-text); }
.stat-meta .delta-down { color: var(--error-text); }

/* ============================================
   Status badges
   ============================================ */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px 2px 7px;
  height: 20px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid var(--neutral-border);
  background: var(--neutral-bg);
  color: var(--text-secondary);
  white-space: nowrap;
}
.status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
}
.status.running, .status.open, .status.success {
  background: var(--success-bg); border-color: var(--success-border); color: var(--success-text);
}
.status.running .dot, .status.open .dot, .status.success .dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
  animation: pulse 2s ease-in-out infinite;
}
.status.stopped, .status.closed {
  background: var(--neutral-bg); border-color: var(--neutral-border); color: var(--text-secondary);
}
.status.stopped .dot, .status.closed .dot { background: var(--text-tertiary); }
.status.warning, .status.pending {
  background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text);
}
.status.warning .dot, .status.pending .dot { background: var(--warning); }
.status.error, .status.critical {
  background: var(--error-bg); border-color: var(--error-border); color: var(--error-text);
}
.status.error .dot, .status.critical .dot { background: var(--error); }
.status.resolved {
  background: var(--accent-bg); border-color: var(--accent-border); color: var(--accent-text);
}
.status.resolved .dot { background: var(--accent); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Priority pill (smaller) */
.priority {
  display: inline-flex; align-items: center;
  padding: 1px 7px; height: 18px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.priority.low    { background: var(--neutral-bg); color: var(--text-secondary); }
.priority.normal { background: var(--accent-bg); color: var(--accent-text); }
.priority.high   { background: var(--warning-bg); color: var(--warning-text); }
.priority.urgent { background: var(--error-bg); color: var(--error-text); }

/* ============================================
   Resource bars
   ============================================ */
.resource {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 100px;
}
.resource-row { display: flex; justify-content: space-between; font-size: 11px; }
.resource-label { color: var(--text-tertiary); font-weight: 500; }
.resource-value { font-family: var(--font-mono); color: var(--text-secondary); }
.bar {
  height: 4px;
  background: var(--bg-surface-3);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width var(--motion-slow);
}
.bar-fill.warn { background: var(--warning); }
.bar-fill.crit { background: var(--error); }

/* ============================================
   Tables
   ============================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.table th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-faint);
  color: var(--text);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--motion); }
.table tbody tr:hover { background: var(--bg-surface-2); }
.mono { font-family: var(--font-mono); font-size: 12px; }
.muted { color: var(--text-secondary); }
.dim { color: var(--text-tertiary); }

/* ============================================
   Form controls
   ============================================ */
.input, .select, .textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 18px;
  transition: border-color var(--motion), box-shadow var(--motion), background var(--motion);
}
.input::placeholder, .textarea::placeholder { color: var(--text-tertiary); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='%23A4A7AE'><path d='M3 5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.textarea { resize: vertical; min-height: 100px; }

.label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field { margin-bottom: 16px; }

/* ============================================
   Modal / Drawer
   ============================================ */
.scrim {
  position: fixed; inset: 0;
  background: var(--bg-mask);
  backdrop-filter: blur(4px);
  z-index: 50;
  animation: fadeIn 0.18s ease-out;
}
.modal {
  position: fixed;
  z-index: 51;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.03) inset;
  display: flex; flex-direction: column;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  max-height: 86vh;
  animation: modalIn 0.22s cubic-bezier(0.215, 0.61, 0.355, 1);
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.modal-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.modal-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
.modal-close {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--text-secondary);
  background: transparent; border: none;
  cursor: pointer;
  transition: background var(--motion), color var(--motion);
}
.modal-close:hover { background: var(--bg-surface-3); color: var(--text); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ============================================
   Empty state
   ============================================ */
.empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 60px 20px;
  gap: 14px;
}
.empty-icon {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 20px;
}
.empty-title { font-size: 15px; font-weight: 600; }
.empty-text { font-size: 13px; color: var(--text-secondary); max-width: 340px; line-height: 1.5; }

/* ============================================
   Misc utilities
   ============================================ */
.grid { display: grid; gap: var(--s-4); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: var(--s-3); }
.col { display: flex; flex-direction: column; gap: var(--s-3); }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: none; }
.kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-tertiary);
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-surface-3); border-radius: 5px; border: 2px solid var(--bg-canvas); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* Selection */
::selection { background: var(--accent-bg); color: var(--accent-text); }

/* Login page */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-canvas);
}
.login-pane {
  display: grid; place-items: center;
  padding: 40px;
}
.login-form {
  width: 100%;
  max-width: 360px;
}
.login-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 32px;
}
.login-side {
  background:
    radial-gradient(800px 500px at 80% 10%, rgba(34,211,238,0.12), transparent 60%),
    radial-gradient(600px 400px at 20% 90%, rgba(34,211,238,0.06), transparent 60%),
    var(--bg-sidebar);
  border-left: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
  padding: 40px;
}
.login-side::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 70%);
}

/* accent-shift utility for tweaks */
[data-accent="teal"] {
  --accent: #14B8A6;
  --accent-hover: #2DD4BF;
  --accent-active: #0D9488;
  --accent-bg: rgba(20, 184, 166, 0.10);
  --accent-bg-hover: rgba(20, 184, 166, 0.16);
  --accent-border: rgba(20, 184, 166, 0.25);
  --accent-text: #2DD4BF;
}
[data-accent="blue"] {
  --accent: #3B82F6;
  --accent-hover: #60A5FA;
  --accent-active: #2563EB;
  --accent-bg: rgba(59, 130, 246, 0.10);
  --accent-bg-hover: rgba(59, 130, 246, 0.16);
  --accent-border: rgba(59, 130, 246, 0.25);
  --accent-text: #60A5FA;
}
[data-accent="green"] {
  --accent: #10B981;
  --accent-hover: #34D399;
  --accent-active: #059669;
  --accent-bg: rgba(16, 185, 129, 0.10);
  --accent-bg-hover: rgba(16, 185, 129, 0.16);
  --accent-border: rgba(16, 185, 129, 0.25);
  --accent-text: #34D399;
}
[data-accent="violet"] {
  --accent: #A78BFA;
  --accent-hover: #C4B5FD;
  --accent-active: #8B5CF6;
  --accent-bg: rgba(167, 139, 250, 0.10);
  --accent-bg-hover: rgba(167, 139, 250, 0.16);
  --accent-border: rgba(167, 139, 250, 0.25);
  --accent-text: #C4B5FD;
}
