/* ===================================================================
   KAMEENA IMMORTALS — PREMIUM iOS GLASSMORPHISM DESIGN SYSTEM
   Deep Black, Obsidian Charcoal, Crimson Red & Silver Accents
   =================================================================== */

:root {
  --bg-primary: #07070a;
  --bg-secondary: #0d0d14;
  --bg-tertiary: #14141f;

  /* Glassmorphism Variables */
  --glass-bg: rgba(18, 18, 26, 0.65);
  --glass-card: rgba(22, 22, 32, 0.75);
  --glass-elevated: rgba(30, 30, 44, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-focus: rgba(255, 42, 75, 0.4);
  --glass-highlight: rgba(255, 255, 255, 0.03);

  /* Brand Accents */
  --crimson-primary: #ff2a4b;
  --crimson-hover: #e01e3d;
  --crimson-glow: rgba(255, 42, 75, 0.25);
  --crimson-dark: #3a0a14;
  --crimson-gradient: linear-gradient(135deg, #ff2a4b 0%, #a80724 100%);

  /* Metal / Silver Accents */
  --silver-bright: #ffffff;
  --silver-light: #f1f5f9;
  --silver-muted: #94a3b8;
  --silver-dark: #475569;
  --silver-gradient: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);

  /* Status Colors */
  --status-online: #10b981;
  --status-online-glow: rgba(16, 185, 129, 0.25);
  --status-offline: #64748b;
  --status-warning: #f59e0b;
  --status-error: #ef4444;

  /* Typography & Layout */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "Fira Code", Menlo, monospace;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-full: 9999px;
  --nav-height: 72px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--silver-light);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + 24px);
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(255, 42, 75, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(168, 7, 36, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--crimson-primary);
}

/* Container */
.app-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 18px;
  position: relative;
}

/* Header */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--crimson-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 14px var(--crimson-glow);
  position: relative;
}

.brand-logo::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: var(--silver-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--crimson-primary);
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-badge:active {
  transform: scale(0.96);
  background: rgba(255, 42, 75, 0.15);
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: #334155;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--silver-light);
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tier-pill {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 700;
  text-transform: uppercase;
}

.tier-owner {
  background: rgba(255, 42, 75, 0.2);
  color: #ff2a4b;
  border: 1px solid rgba(255, 42, 75, 0.4);
}

.tier-premium {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.tier-free {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Glass Cards */
.glass-card {
  background: var(--glass-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--silver-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title span.title-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  background: var(--glass-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  position: relative;
}

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

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--silver-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-icon {
  font-size: 15px;
}

.metric-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--silver-bright);
}

.metric-sub {
  font-size: 10px;
  color: var(--silver-muted);
  margin-top: 4px;
}

.metric-sub.good { color: var(--status-online); }
.metric-sub.warning { color: var(--status-warning); }

/* Server Gauge Bars */
.resource-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  margin-top: 8px;
  overflow: hidden;
  position: relative;
}

.resource-fill {
  height: 100%;
  background: var(--crimson-gradient);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.resource-fill.green {
  background: linear-gradient(90deg, #10b981, #059669);
}

/* Quick Actions Row */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.btn-action {
  background: var(--glass-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--silver-light);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-action:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.08);
}

.btn-action.primary {
  background: var(--crimson-gradient);
  border: 1px solid rgba(255, 42, 75, 0.4);
  box-shadow: 0 4px 16px var(--crimson-glow);
  color: #fff;
}

.btn-action.primary:active {
  background: var(--crimson-hover);
}

/* Session Cards */
.session-card {
  background: var(--glass-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

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

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

.session-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-engine-badge {
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-wa {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-py {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.session-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--silver-bright);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.online {
  background: var(--status-online);
  box-shadow: 0 0 8px var(--status-online-glow);
}

.dot.offline {
  background: var(--status-offline);
}

.session-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 12px;
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 10px;
  color: var(--silver-muted);
  text-transform: uppercase;
}

.detail-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--silver-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-controls {
  display: flex;
  gap: 8px;
}

.btn-ctrl {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--silver-light);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-ctrl:active {
  transform: scale(0.96);
}

.btn-ctrl.start {
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}
.btn-ctrl.start:hover { background: rgba(16, 185, 129, 0.15); }

.btn-ctrl.stop {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-ctrl.stop:hover { background: rgba(239, 68, 68, 0.15); }

.btn-ctrl.restart {
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}
.btn-ctrl.restart:hover { background: rgba(59, 130, 246, 0.15); }

.btn-ctrl.logs {
  color: #e2e8f0;
}
.btn-ctrl.logs:hover { background: rgba(255, 255, 255, 0.1); }

.btn-ctrl.danger {
  color: #f87171;
}
.btn-ctrl.danger:hover { background: rgba(239, 68, 68, 0.15); }

/* Live Log Terminal */
.log-terminal {
  background: #030305;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #94a3b8;
  height: 380px;
  overflow-y: auto;
  line-height: 1.6;
}

.log-entry {
  display: flex;
  margin-bottom: 2px;
  word-break: break-all;
}

.log-time {
  color: #64748b;
  margin-right: 8px;
  flex-shrink: 0;
  user-select: none;
}

.log-text {
  color: #e2e8f0;
}

.log-text.err {
  color: #f87171;
  font-weight: 600;
}

.log-text.success {
  color: #34d399;
}

.log-text.info {
  color: #60a5fa;
}

/* Floating iOS Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 600px;
  height: var(--nav-height);
  background: rgba(14, 14, 20, 0.85);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  z-index: 1000;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--silver-muted);
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 16px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex: 1;
}

.nav-item .nav-icon {
  font-size: 19px;
  transition: transform 0.2s ease;
}

.nav-item.active {
  color: #fff;
  background: rgba(255, 42, 75, 0.15);
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
  color: var(--crimson-primary);
}

/* Form Controls */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--silver-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--silver-bright);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--crimson-primary);
  background: rgba(255, 255, 255, 0.06);
}

.form-select option {
  background: #121218;
  color: #fff;
}

/* File Drop Zone */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.2s ease;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--crimson-primary);
  background: rgba(255, 42, 75, 0.05);
}

/* Tabs */
.tab-pills {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
  margin-bottom: 16px;
}

.tab-pill {
  flex: 1;
  text-align: center;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  color: var(--silver-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-pill.active {
  background: var(--glass-elevated);
  color: var(--silver-bright);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2000;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #111118;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  position: relative;
  animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  background: rgba(18, 18, 26, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--silver-bright);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.2s ease-out;
}

.toast.success { border-left: 4px solid var(--status-online); }
.toast.error { border-left: 4px solid var(--status-error); }
.toast.info { border-left: 4px solid var(--crimson-primary); }

@keyframes toastIn {
  from { transform: translateY(-12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Animations & Screen transitions */
.screen {
  display: none;
  animation: screenFade 0.2s ease;
}

.screen.active {
  display: block;
}

@keyframes screenFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}


@keyframes pulseGlow {
  from { transform: scale(0.96); box-shadow: 0 0 20px rgba(255, 42, 75, 0.3); }
  to { transform: scale(1.04); box-shadow: 0 0 45px rgba(255, 42, 75, 0.6); }
}
