/* ==========================================================================
   Modern Minimalist Bento Grid Dashboard
   Clean SaaS Engineering Architecture & Aesthetics
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-app: #0A0D14;
  --bg-sidebar: #0D111A;
  --bg-card: #121824;
  --bg-card-hover: #151D2C;
  --bg-subtle: #182030;
  --bg-input: #0F1420;

  --border-card: #1E293B;
  --border-card-hover: #334155;
  --border-subtle: #1E293B80;

  /* Contextual Accents (No Tacky Neons) */
  --accent-emerald: #10B981;
  --accent-emerald-subtle: rgba(16, 185, 129, 0.12);
  --accent-blue: #2563EB;
  --accent-blue-hover: #1D4ED8;
  --accent-blue-subtle: rgba(37, 99, 235, 0.12);
  --accent-amber: #F59E0B;
  --accent-rose: #EF4444;

  /* Typography Colors */
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-dim: #475569;

  /* Dimensions & Spacing */
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 68px;
  --topbar-height: 60px;
  --card-radius: 12px;
  --card-padding: 22px;
  --grid-gap: 16px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Layout Frame */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* --------------------------------------------------------------------------
   1. Left Collapsible Thin Navigation Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-card);
  display: flex;
  flex-direction: column;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 50;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-card);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.2px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #1E293B;
  border: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
  flex-shrink: 0;
}

.brand-name {
  white-space: nowrap;
  transition: opacity 0.2s;
}

.sidebar.collapsed .brand-name {
  display: none;
}

.sidebar-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.sidebar-toggle-btn:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

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

.nav-category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  padding: 12px 10px 6px;
}

.sidebar.collapsed .nav-category {
  display: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

.nav-link.active {
  background-color: var(--accent-blue-subtle);
  color: #60A5FA;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-card);
  object-fit: cover;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.sidebar.collapsed .user-info {
  display: none;
}

/* --------------------------------------------------------------------------
   2. Main Container & Top Search Bar
   -------------------------------------------------------------------------- */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-height);
  background-color: var(--bg-app);
  border-bottom: 1px solid var(--border-card);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.breadcrumb-area {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb-area a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumb-area a:hover {
  color: var(--text-primary);
}

.breadcrumb-sep {
  color: var(--text-dim);
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

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

.search-command-input {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-secondary);
  font-size: 13px;
  width: 260px;
  transition: border-color 0.15s;
}

.search-command-input:focus-within {
  border-color: var(--accent-blue);
}

.search-command-input input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  width: 100%;
  outline: none;
}

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

.kbd-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-card);
  border-radius: 4px;
  padding: 2px 5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}

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

.notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
}

.btn-primary {
  background-color: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
  text-decoration: none;
}

.btn-primary:hover {
  background-color: var(--accent-blue-hover);
}

/* --------------------------------------------------------------------------
   3. Content Header (Title + Live Control Filters)
   -------------------------------------------------------------------------- */
.dashboard-content {
  padding: 28px;
  flex: 1;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-title-group h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.4px;
}

.dashboard-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

/* Time-Range Selector Pills */
.time-range-group {
  display: flex;
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 3px;
}

.time-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.time-btn:hover {
  color: var(--text-primary);
}

.time-btn.active {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Live Feed Toggle */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--accent-emerald-subtle);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: #34D399;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* --------------------------------------------------------------------------
   4. Asymmetric Bento Grid Engine (2x2, 2x1, 1x2, 1x1)
   -------------------------------------------------------------------------- */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(170px, auto);
  gap: var(--grid-gap);
}

/* Base Bento Card */
.bento-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.bento-card:hover {
  border-color: var(--border-card-hover);
  background-color: var(--bg-card-hover);
  box-shadow: 0 10px 25px -8px rgba(0, 0, 0, 0.4);
}

/* Grid Span Utilities */
.card-2x2 {
  grid-column: span 2;
  grid-row: span 2;
}

.card-2x1 {
  grid-column: span 2;
  grid-row: span 1;
}

.card-1x2 {
  grid-column: span 1;
  grid-row: span 2;
}

.card-1x1 {
  grid-column: span 1;
  grid-row: span 1;
}

/* Card Header */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.card-menu-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
}

.card-menu-btn:hover {
  color: var(--text-primary);
}

/* Card Metrics Hierarchy */
.metric-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.metric-value-lg {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.6px;
  line-height: 1.15;
}

.metric-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.metric-change {
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.change-positive {
  color: var(--accent-emerald);
}

.change-neutral {
  color: var(--text-muted);
}

.metric-caption {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   5. Interactive SVG Chart Component (Main 2x2 Card)
   -------------------------------------------------------------------------- */
.chart-container {
  flex: 1;
  width: 100%;
  min-height: 180px;
  position: relative;
  margin-top: 14px;
}

.interactive-svg-chart {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-grid-line {
  stroke: var(--border-subtle);
  stroke-dasharray: 4 4;
  stroke-width: 1;
}

.chart-area {
  fill: url(#latencyGradient);
  transition: d 0.3s ease;
}

.chart-path {
  fill: none;
  stroke: #3B82F6;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: d 0.3s ease;
}

/* Chart Tooltip Overlay */
.chart-crosshair {
  stroke: #475569;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.chart-tooltip-marker {
  fill: #3B82F6;
  stroke: #0A0D14;
  stroke-width: 2.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.chart-tooltip-card {
  position: absolute;
  background-color: #1E293B;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-primary);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -120%);
  transition: opacity 0.15s, transform 0.1s ease-out;
  white-space: nowrap;
  z-index: 20;
}

.tooltip-time {
  color: var(--text-muted);
  font-size: 10.5px;
  margin-bottom: 2px;
}

.tooltip-metric {
  font-weight: 600;
  color: #60A5FA;
}

/* --------------------------------------------------------------------------
   6. Sub-card Modules: Cluster SLA, Deployments, Resources
   -------------------------------------------------------------------------- */

/* Progress Bar */
.progress-bar-track {
  width: 100%;
  height: 6px;
  background-color: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0 8px;
}

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

/* Mini Sparkline */
.sparkline-svg {
  width: 100%;
  height: 36px;
  margin-top: auto;
}

.sparkline-path {
  fill: none;
  stroke: var(--accent-emerald);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Cluster SLA Table Rows */
.cluster-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.cluster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background-color: var(--bg-subtle);
  border-radius: 6px;
  font-size: 12.5px;
}

.cluster-name-col {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.cluster-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
}

.cluster-metrics-col {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-secondary);
}

.cluster-sla {
  color: var(--accent-emerald);
  font-weight: 600;
}

/* Event Feed (1x2 Card) */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
  flex: 1;
  overflow-y: auto;
}

.feed-item {
  display: flex;
  gap: 10px;
  font-size: 12.5px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.feed-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.feed-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background-color: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-top: 2px;
}

.feed-content {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.feed-header-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.feed-title {
  font-weight: 500;
  color: var(--text-primary);
}

.feed-time {
  font-size: 11px;
  color: var(--text-dim);
}

.feed-commit {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #60A5FA;
  margin-top: 2px;
}

/* Resources 2x1 Card */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 10px;
}

.resource-cell {
  background-color: var(--bg-subtle);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.resource-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.resource-val {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 12px;
}

.status-pill-success {
  background-color: var(--accent-emerald-subtle);
  color: #34D399;
}

.status-pill-blue {
  background-color: var(--accent-blue-subtle);
  color: #60A5FA;
}

/* Return to Portfolio Banner */
.portfolio-back-banner {
  margin-top: 24px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--card-radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portfolio-back-banner span {
  font-size: 13px;
  color: var(--text-secondary);
}

.banner-link {
  color: #60A5FA;
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.banner-link:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   7. Responsive Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .card-2x2 {
    grid-column: span 2;
    grid-row: span 2;
  }
  .card-2x1 {
    grid-column: span 2;
  }
  .card-1x2 {
    grid-column: span 1;
    grid-row: span 2;
  }
  .card-1x1 {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    height: 100vh;
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .bento-grid {
    grid-template-columns: 1fr;
  }
  .card-2x2, .card-2x1, .card-1x2, .card-1x1 {
    grid-column: span 1;
    grid-row: auto;
  }
  .resource-grid {
    grid-template-columns: 1fr;
  }
  .search-command-input {
    display: none;
  }
}
