/**
 * CyberHunter SaaS - Pure Cyber Emerald Matrix Green Design System
 * Engineered for maximum compactness, ultra-density, and glassmorphism.
 */

:root {
  --saas-bg: #060b08;
  --saas-sidebar-bg: #0a130f;
  --saas-card-bg: rgba(10, 20, 15, 0.85);
  --saas-card-border: rgba(0, 255, 157, 0.16);
  --saas-card-hover: rgba(15, 30, 22, 0.95);
  
  --saas-cyan: #00ff9d;       /* Primary Cyber Neon Green */
  --saas-purple: #10b981;     /* Emerald Accent */
  --saas-green: #00ff9d;      /* Verified Matrix Green */
  --saas-red: #ff2d55;        /* Alert / Fail-Closed Red */
  --saas-yellow: #ffcc00;     /* Warning Gold */
  --saas-orange: #ff6b00;

  --saas-text: #ecfdf5;       /* Crisp Emerald White */
  --saas-text-muted: #6ee7b7; /* Muted Mint */
  --saas-border: rgba(0, 255, 157, 0.14);
  --sidebar-width: 54px;      /* Ultra-compact icon dock by default */
  --sidebar-expanded-width: 210px;
  --header-height: 42px;
}

/* ─── Global App Layout ─────────────────────────────────────────────────── */
body.saas-app {
  margin: 0;
  padding: 0;
  background: var(--saas-bg);
  color: var(--saas-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  font-size: 12px;
}

/* ─── Sidebar Navigation (Ultra-Compact Slim Icon Dock) ─────────────────── */
.saas-sidebar {
  width: var(--sidebar-width);
  background: var(--saas-sidebar-bg);
  border-right: 1px solid var(--saas-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.5);
}

.saas-sidebar:hover,
.saas-sidebar.expanded {
  width: var(--sidebar-expanded-width);
}

.sidebar-brand {
  height: var(--header-height);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--saas-border);
  background: rgba(6, 11, 8, 0.95);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--saas-text);
  overflow: hidden;
  white-space: nowrap;
}

.brand-logo-icon {
  font-size: 19px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(0, 255, 157, 0.6));
}

.brand-name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.2px;
  background: linear-gradient(135deg, #00ff9d 0%, #10b981 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 9px;
  font-weight: 700;
  color: var(--saas-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.btn-sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--saas-text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-sidebar-toggle:hover {
  color: var(--saas-cyan);
  background: rgba(0, 255, 157, 0.1);
}

.sidebar-nav {
  padding: 6px 4px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-section-title {
  font-size: 8.5px;
  font-weight: 700;
  color: rgba(110, 231, 183, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 6px 8px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.saas-sidebar:hover .nav-section-title,
.saas-sidebar.expanded .nav-section-title {
  opacity: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(0, 255, 157, 0.08);
  color: #ffffff;
  border-color: rgba(0, 255, 157, 0.2);
}

.nav-item.active {
  background: rgba(0, 255, 157, 0.15);
  color: var(--saas-cyan);
  border-color: rgba(0, 255, 157, 0.4);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(0, 255, 157, 0.15);
}

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

.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.saas-sidebar:hover .nav-label,
.saas-sidebar.expanded .nav-label {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 255, 157, 0.15);
  color: var(--saas-cyan);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.saas-sidebar:hover .nav-badge,
.saas-sidebar.expanded .nav-badge {
  opacity: 1;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--saas-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(6, 11, 8, 0.95);
  overflow: hidden;
}

.user-snippet {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00ff9d 0%, #059669 100%);
  color: #04140b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(0, 255, 157, 0.4);
}

.user-meta {
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.saas-sidebar:hover .user-meta,
.saas-sidebar.expanded .user-meta {
  opacity: 1;
}

.user-name {
  font-size: 11px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.1;
}

.user-role {
  font-size: 9px;
  color: var(--saas-cyan);
  text-transform: uppercase;
}

.btn-sidebar-logout {
  background: transparent;
  border: 1px solid rgba(255, 45, 85, 0.3);
  color: #fca5a5;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  opacity: 0;
}

.saas-sidebar:hover .btn-sidebar-logout,
.saas-sidebar.expanded .btn-sidebar-logout {
  opacity: 1;
}

.btn-sidebar-logout:hover {
  background: rgba(255, 45, 85, 0.15);
  border-color: var(--saas-red);
}

/* ─── Main Content Area ─────────────────────────────────────────────────── */
.saas-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--saas-bg);
  min-width: 0;
}

/* ─── Compact Header Bar (42px) ─────────────────────────────────────────── */
.saas-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--saas-border);
  background: rgba(6, 11, 8, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  position: sticky;
  top: 0;
  z-index: 900;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--saas-text);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-status {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 20, 15, 0.85);
  border: 1px solid var(--saas-border);
  padding: 3px 9px;
  border-radius: 14px;
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--saas-cyan);
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--saas-green);
  box-shadow: 0 0 6px var(--saas-green);
}

.pill-dot.pulse {
  animation: dotPulse 1.5s infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Header Action Buttons (Quick Access to SaaS Features) */
.header-action-btn {
  background: rgba(0, 255, 157, 0.08);
  border: 1px solid rgba(0, 255, 157, 0.25);
  color: var(--saas-cyan);
  font-size: 10.5px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.header-action-btn:hover {
  background: var(--saas-cyan);
  color: #021a0f;
  box-shadow: 0 0 12px rgba(0, 255, 157, 0.35);
  transform: translateY(-1px);
}

.header-action-btn.btn-danger {
  background: rgba(255, 45, 85, 0.12);
  border-color: rgba(255, 45, 85, 0.35);
  color: #fca5a5;
}

.header-action-btn.btn-danger:hover {
  background: var(--saas-red);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 45, 85, 0.35);
}

/* ─── View Container ────────────────────────────────────────────────────── */
.view-container {
  padding: 8px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.saas-view {
  display: none;
  width: 100%;
}

.saas-view.active {
  display: block;
}

/* ─── Compact Cards Grid ────────────────────────────────────────────────── */
.saas-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.saas-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.saas-card {
  background: var(--saas-card-bg);
  border: 1px solid var(--saas-border);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all 0.15s ease;
}

.saas-card:hover {
  border-color: rgba(0, 255, 157, 0.4);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 255, 157, 0.08);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.card-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--saas-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-value-hero {
  font-size: 18px;
  font-weight: 800;
  color: var(--saas-text);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 3px;
}

.card-subtext {
  font-size: 10.5px;
  color: #94a3b8;
}

/* ─── Compact Tables ────────────────────────────────────────────────────── */
.saas-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--saas-border);
  border-radius: 6px;
  background: rgba(6, 11, 8, 0.7);
}

.saas-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 11px;
}

.saas-table th {
  padding: 7px 10px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--saas-text-muted);
  background: rgba(0, 255, 157, 0.05);
  border-bottom: 1px solid var(--saas-border);
}

.saas-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--saas-text);
}

.saas-table tr:hover td {
  background: rgba(0, 255, 157, 0.04);
}

/* ─── Cleanup Categories ────────────────────────────────────────────────── */
.cleanup-category-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 20, 15, 0.7);
  border: 1px solid var(--saas-border);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 6px;
  transition: all 0.15s ease;
}

.cleanup-category-card:hover {
  background: rgba(15, 30, 22, 0.9);
  border-color: rgba(0, 255, 157, 0.35);
}

.category-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-name {
  font-size: 11.5px;
  font-weight: 600;
  color: #ffffff;
}

.category-desc {
  font-size: 10px;
  color: #94a3b8;
}

.category-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--saas-cyan);
}

/* ─── Action Buttons (Ultra-Compact) ────────────────────────────────────── */
.btn-saas-primary {
  background: linear-gradient(135deg, #00ff9d 0%, #059669 100%);
  color: #021a0f;
  font-weight: 800;
  font-size: 11px;
  padding: 6px 14px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 14px rgba(0, 255, 157, 0.35);
}

.btn-saas-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(0, 255, 157, 0.55);
}

.btn-saas-danger {
  background: rgba(255, 45, 85, 0.15);
  border: 1px solid rgba(255, 45, 85, 0.4);
  color: #fca5a5;
  font-weight: 700;
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-saas-danger:hover {
  background: var(--saas-red);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 45, 85, 0.4);
}

.btn-saas-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--saas-border);
  color: var(--saas-text-muted);
  font-weight: 600;
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-saas-secondary:hover {
  background: rgba(0, 255, 157, 0.1);
  color: var(--saas-cyan);
  border-color: var(--saas-cyan);
}

/* Override .btn-launch-glow with Cyber Green */
.btn-launch-glow {
  background: linear-gradient(135deg, #00ff9d 0%, #059669 100%) !important;
  color: #021a0f !important;
  font-weight: 800 !important;
  box-shadow: 0 0 16px rgba(0, 255, 157, 0.4) !important;
}

.btn-launch-glow:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(0, 255, 157, 0.65) !important;
}

/* Modals */
.cyber-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.cyber-modal {
  background: rgba(8, 16, 12, 0.95);
  border: 1px solid rgba(0, 255, 157, 0.35);
  border-radius: 10px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 255, 157, 0.15);
}

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

.modal-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--saas-cyan);
  font-family: 'JetBrains Mono', monospace;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--saas-text-muted);
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
}

.btn-modal-close:hover {
  color: #ffffff;
}

.cyber-modal-body {
  padding: 14px 16px;
}

.cyber-modal-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--saas-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Toast Notifications ───────────────────────────────────────────────── */
#saasToastContainer {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saas-toast {
  background: rgba(8, 16, 12, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 255, 157, 0.4);
  border-radius: 6px;
  padding: 8px 14px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(0, 255, 157, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
}

.saas-toast.error {
  border-color: rgba(255, 45, 85, 0.6);
  color: #fca5a5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(255, 45, 85, 0.2);
}

/* ─── Responsive Media Queries ──────────────────────────────────────────── */
@media (max-width: 1200px) {
  .saas-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .saas-sidebar {
    transform: translateX(-100%);
  }
  .saas-sidebar.mobile-open {
    transform: translateX(0);
    width: var(--sidebar-expanded-width);
  }
  .saas-main {
    margin-left: 0 !important;
  }
}
