/* ==========================================================================
   STATUSDECK CORE DESIGN SYSTEM & STYLESHEET (Midnight Glassmorphic Aesthetics)
   ========================================================================== */

:root {
  /* Fonts */
  --font-header: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;

  /* Premium Light-Mode HSL Color System */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-sidebar: #ffffff;
  
  --panel-glass: rgba(255, 255, 255, 0.7);
  --border-glass: rgba(226, 232, 240, 0.8);
  --border-glass-hover: rgba(13, 148, 136, 0.35);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dark: #64748b;
  
  /* Glowing Status Accents */
  --color-green: 170, 75%, 40%;     /* Teal Green */
  --color-yellow: 35, 92%, 47%;     /* Amber Orange */
  --color-red: 350, 89%, 60%;      /* Rose Red */
  --color-blue: 200, 95%, 48%;     /* Sky Blue */
  --color-grey: 215, 16%, 47%;     /* Slate Gray */
  
  /* Primary Brand Gradients (Turquoise / Sky-Blue theme matching Cloud Nine) */
  --grad-brand: linear-gradient(135deg, #0d9488 0%, #06b6d4 100%);
  --grad-hover: linear-gradient(135deg, #0f766e 0%, #0891b2 100%);
  
  /* Layout constraints */
  --sidebar-width: 250px;
  --header-height: 70px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset & Reset Scrollbars */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Custom Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Global Offline Banner */
.offline-banner {
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.95), rgba(192, 57, 43, 0.95));
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 8px 16px;
  text-align: center;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 500;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.offline-banner.hidden {
  transform: translateY(-100%);
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner-icon {
  animation: shake 1.5s infinite;
}

/* Web Mode Menu Bar Simulation */
.web-tray-sim {
  background-color: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  height: 32px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  user-select: none;
  z-index: 1000;
  position: relative;
}

.tray-sim-left {
  display: flex;
  align-items: center;
  font-weight: 600;
}

.tray-sim-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tray-dot-sim {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease;
}

.tray-dot-sim:hover {
  transform: scale(1.2);
}

.tray-dot-sim.green  { background-color: hsl(var(--color-green)); box-shadow: 0 0 8px hsl(var(--color-green)); }
.tray-dot-sim.yellow { background-color: hsl(var(--color-yellow)); box-shadow: 0 0 8px hsl(var(--color-yellow)); }
.tray-dot-sim.red    { background-color: hsl(var(--color-red)); box-shadow: 0 0 8px hsl(var(--color-red)); }
.tray-dot-sim.grey   { background-color: hsl(var(--color-grey)); box-shadow: 0 0 8px hsl(var(--color-grey)); }

.tray-dot-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid currentColor;
  animation: pulse-ring 2s infinite ease-out;
  opacity: 0.8;
  color: inherit;
}

.tray-sim-instruction {
  font-style: italic;
  font-size: 10px;
  opacity: 0.7;
}

/* Main Container Shell */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle at 70% 30%, rgba(6, 182, 212, 0.06) 0%, transparent 70%), radial-gradient(circle at 10% 80%, rgba(13, 148, 136, 0.05) 0%, transparent 50%);
}

/* Adjust layout height when Tray Simulation is visible */
body:has(.web-tray-sim:not(.hidden)) .app-container {
  height: calc(100vh - 32px);
}

/* ==========================================================================
   SIDEBAR NAVIGATION
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), padding 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.sidebar-toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  margin-left: auto;
  transition: var(--transition-smooth);
}

.sidebar-toggle-btn:hover {
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--text-main);
}

.sidebar.collapsed {
  width: 76px;
  padding: 24px 12px;
}

.sidebar.collapsed .brand-info,
.sidebar.collapsed .status-summary-title,
.sidebar.collapsed .status-summary-badge span,
.sidebar.collapsed .app-version {
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: absolute;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .brand {
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.sidebar.collapsed .brand-logo {
  width: 32px;
  height: 32px;
  margin: 0 auto;
}

.sidebar.collapsed .sidebar-toggle-btn {
  margin: 0 auto;
}

.sidebar.collapsed .sidebar-toggle-btn svg {
  transform: rotate(180deg);
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px;
  font-size: 0;
  gap: 0;
}

.sidebar.collapsed .nav-icon {
  margin: 0;
  width: 22px;
  height: 22px;
  opacity: 0.9;
}

.sidebar.collapsed .status-summary-badge {
  padding: 8px;
  justify-content: center;
  border: none;
  background: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.brand-logo {
  background: var(--grad-brand);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.35);
  transition: var(--transition-smooth);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-header);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.brand-tagline {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  transition: var(--transition-smooth);
}

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

.nav-item.active {
  background: rgba(13, 148, 136, 0.06);
  color: #0d9488;
  box-shadow: inset 3px 0 0 #0d9488;
}

.nav-icon {
  opacity: 0.7;
  transition: var(--transition-smooth);
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  opacity: 1;
  color: #06b6d4;
}

.sidebar-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 20px;
}

.status-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.status-summary-title {
  font-size: 11px;
  color: var(--text-dark);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.status-summary-badge {
  background-color: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
}

.app-version {
  font-size: 10px;
  color: var(--text-dark);
  text-align: center;
}

/* ==========================================================================
   MAIN CONTENT AREA & HEADER
   ========================================================================== */
.main-content {
  flex-grow: 1;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  gap: 24px;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.page-title {
  font-family: var(--font-header);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-main);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.25);
}

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

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

.btn-secondary:hover {
  background-color: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.btn-flat {
  background: none;
  color: var(--text-muted);
}

.btn-flat:hover {
  color: var(--text-main);
  background-color: rgba(0, 0, 0, 0.02);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-icon {
  transition: transform 0.5s ease;
}

.btn:active .btn-icon {
  transform: rotate(360deg);
}

/* ==========================================================================
   VIEW: TAB ROUTER SWITCHING
   ========================================================================== */
.tab-view {
  display: none;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.4s ease-out;
}

.tab-view.active {
  display: flex;
}

/* Glassmorphism Panel Wrapper */
.card {
  background: var(--panel-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  transition: var(--transition-smooth);
}

.card:hover {
  border-color: var(--border-glass-hover);
}

.card-title {
  font-family: var(--font-header);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ==========================================================================
   VIEW: DASHBOARD STATS & FILTERS
   ========================================================================== */
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  flex-shrink: 0;
}

.stat-card {
  background: var(--panel-glass);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: var(--transition-smooth);
}

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

.stat-val {
  font-family: var(--font-header);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background-color: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.04);
  padding: 8px 16px;
  border-radius: 10px;
  flex-shrink: 0;
}

.filter-label {
  font-size: 12px;
  color: var(--text-dark);
  font-weight: 600;
  text-transform: uppercase;
}

.filter-tags {
  display: flex;
  gap: 8px;
}

.filter-tag {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.filter-tag:hover {
  background-color: rgba(0, 0, 0, 0.03);
  color: var(--text-main);
}

.filter-tag.active {
  background-color: rgba(13, 148, 136, 0.08);
  color: #0d9488;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   STATUS GRID (SERVICE CARD)
   ========================================================================== */
.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 Columns by default on standard desktop viewports */
  gap: 16px;
}

@media (min-width: 1400px) {
  .status-grid {
    grid-template-columns: repeat(4, 1fr); /* 4 Columns on large desktop monitors */
  }
}

@media (max-width: 1200px) {
  .status-grid {
    grid-template-columns: repeat(2, 1fr) !important; /* Drop to 2 Columns to maximize card width & prevent title wrapping */
  }
}

@media (max-width: 800px) {
  .status-grid {
    grid-template-columns: 1fr !important; /* Single column vertical list stack */
  }
}

.service-card {
  background: var(--panel-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 0px;
  max-height: 100px; /* Sleek compact card, increased to 100px to fit 2-row layout */
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), gap 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.service-card.expanded {
  max-height: 250px;
  gap: 16px;
}

.service-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glass-hover);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.service-card-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  flex-shrink: 0;
}

.service-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

/* Adapted Service Icon */
.service-icon {
  background-color: rgba(13, 148, 136, 0.04);
  border: 1px solid rgba(13, 148, 136, 0.08);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #06b6d4;
  flex-shrink: 0;
}

.service-titles {
  display: flex;
  flex-direction: column;
}

.service-name {
  font-family: var(--font-header);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
  text-align: left;
}

.service-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 24px;
  flex-shrink: 0;
}

.service-category {
  font-size: 10px;
  color: var(--text-dark);
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 0;
}

/* Dynamic State Badges */
.status-badge {
  border-radius: 20px;
  padding: 4px 10px 4px 8px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 120px; /* Fixed width to prevent squeezing */
  justify-content: space-between;
  box-sizing: border-box;
  flex-shrink: 0;
}

.status-badge span {
  flex-grow: 1;
  text-align: center;
}

.expand-chevron {
  opacity: 0.5;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  margin-left: 2px;
  color: inherit;
}

.service-card.expanded .expand-chevron {
  transform: rotate(180deg);
  opacity: 0.95;
  color: #06b6d4;
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

/* Colors and Glow Effects */
.status-badge.green  { background: rgba(46, 204, 113, 0.1); border: 1px solid rgba(46, 204, 113, 0.2); color: hsl(var(--color-green)); }
.status-badge.green  .indicator-dot { background-color: hsl(var(--color-green)); box-shadow: 0 0 6px hsl(var(--color-green)); }

.status-badge.yellow { background: rgba(241, 196, 15, 0.1); border: 1px solid rgba(241, 196, 15, 0.2); color: hsl(var(--color-yellow)); }
.status-badge.yellow .indicator-dot { background-color: hsl(var(--color-yellow)); box-shadow: 0 0 6px hsl(var(--color-yellow)); }

.status-badge.red    { background: rgba(231, 76, 60, 0.1); border: 1px solid rgba(231, 76, 60, 0.2); color: hsl(var(--color-red)); }
.status-badge.red    .indicator-dot { background-color: hsl(var(--color-red)); box-shadow: 0 0 6px hsl(var(--color-red)); }

.status-badge.grey   { background: rgba(127, 140, 141, 0.1); border: 1px solid rgba(127, 140, 141, 0.2); color: hsl(var(--color-grey)); }
.status-badge.grey   .indicator-dot { background-color: hsl(var(--color-grey)); box-shadow: 0 0 6px hsl(var(--color-grey)); }

.status-badge.green .indicator-dot,
.status-badge.yellow .indicator-dot,
.status-badge.red .indicator-dot {
  animation: pulse-glow 2s infinite;
}

.indicator-dot.green  { background-color: hsl(var(--color-green)); box-shadow: 0 0 8px hsl(var(--color-green)); }
.indicator-dot.yellow { background-color: hsl(var(--color-yellow)); box-shadow: 0 0 8px hsl(var(--color-yellow)); }
.indicator-dot.red    { background-color: hsl(var(--color-red)); box-shadow: 0 0 8px hsl(var(--color-red)); }
.indicator-dot.grey   { background-color: hsl(var(--color-grey)); box-shadow: 0 0 8px hsl(var(--color-grey)); }

.service-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), margin-top 0.3s ease;
  pointer-events: none;
  margin-top: 0px;
}

.service-card.expanded .service-card-body {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  margin-top: 0px; /* Use grid/flex gap spacing instead of margins to prevent transition jitter */
}

.service-message {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  height: 36px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.service-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), margin-top 0.3s ease;
  pointer-events: none;
  margin-top: 0px;
}

.service-card.expanded .service-footer {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  margin-top: 0px; /* Use grid/flex gap spacing instead of margins to prevent transition jitter */
}

.service-latency {
  color: var(--text-dark);
  font-weight: 500;
}

.service-time {
  color: var(--text-dark);
}

/* Uptime History Miniature Spark Bars */
.uptime-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.uptime-title {
  font-size: 9.5px;
  color: var(--text-dark);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.uptime-spark-bars {
  display: flex;
  gap: 3px;
  height: 12px;
}

.spark-bar {
  flex-grow: 1;
  border-radius: 2px;
  background-color: rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.spark-bar:hover {
  transform: scaleY(1.2);
}

.spark-bar.green  { background-color: rgba(46, 204, 113, 0.7); }
.spark-bar.yellow { background-color: rgba(241, 196, 15, 0.7); }
.spark-bar.red    { background-color: rgba(231, 76, 60, 0.7); }
.spark-bar.grey   { background-color: rgba(127, 140, 141, 0.2); }

/* ==========================================================================
   VIEW: SERVICE CONFIG STYLES & INTERACTIVE UI ELEMENTS
   ========================================================================== */
.service-toggles-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-divider-title {
  font-size: 11.5px;
  color: var(--text-dark);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-top: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding-bottom: 6px;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.01);
  border: 1px solid rgba(0, 0, 0, 0.04);
  padding: 12px 20px;
  border-radius: 8px;
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-name {
  font-weight: 600;
  color: var(--text-main);
}

.toggle-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Switch Styles */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.1);
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: .3s;
}

input:checked + .slider {
  background: var(--grad-brand);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
}

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

.card-header-with-action .card-subtitle {
  margin-bottom: 0;
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-group.row-align-center {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  background-color: rgba(0, 0, 0, 0.01);
  border: 1px solid rgba(0, 0, 0, 0.04);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.switch-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.option-title {
  font-weight: 600;
  color: var(--text-main);
}

.option-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}

.form-input, .form-select {
  font-family: var(--font-body);
  background-color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-main);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
  transition: var(--transition-smooth);
}

.form-input:focus, .form-select:focus {
  border-color: #06b6d4;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.form-select option {
  background-color: #ffffff;
  color: var(--text-main);
}

.form-hint {
  font-size: 11px;
  color: var(--text-dark);
}

/* Custom Endpoints list */
.custom-endpoints-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
}

.custom-endpoint-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.01);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 10px 16px;
}

.custom-endpoint-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.custom-endpoint-name {
  font-weight: 600;
  color: var(--text-main);
}

.custom-endpoint-url {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-endpoint-actions {
  display: flex;
  gap: 8px;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-dark);
  font-style: italic;
}

/* ==========================================================================
   VIEW: ALERT HUB GRID & BADGES
   ========================================================================== */
.alert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 24px;
}

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

.badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 20px;
}

.badge-native { background-color: rgba(79, 70, 229, 0.15); border: 1px solid rgba(79, 70, 229, 0.3); color: #818cf8; }
.badge-webhook { background-color: rgba(6, 182, 212, 0.15); border: 1px solid rgba(6, 182, 212, 0.3); color: #22d3ee; }
.badge-custom  { background-color: rgba(241, 196, 15, 0.15); border: 1px solid rgba(241, 196, 15, 0.3); color: #fbbf24; }

.alert-test-action {
  margin-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 16px;
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   MODALS AND DIALOG OVERLAYS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: var(--transition-smooth);
}

.modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-dialog {
  width: 100%;
  max-width: 460px;
  animation: modalScale 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-title {
  font-family: var(--font-header);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* ==========================================================================
   KEYFRAMES AND ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}

@keyframes pulse-glow {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 4px currentColor; }
  50% { transform: scale(1.15); opacity: 0.7; box-shadow: 0 0 12px currentColor; }
  100% { transform: scale(1); opacity: 1; box-shadow: 0 0 4px currentColor; }
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  20%, 60% { transform: rotate(-8deg); }
  40%, 80% { transform: rotate(8deg); }
}

/* ==========================================================================
   JAPAN INFRASTRUCTURE MAP VIEW STYLES
   ========================================================================== */
.map-layout-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  height: calc(100vh - 180px);
  min-height: 520px;
}

.map-card-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px;
  height: 100%;
}

/* Dead abstract map styles removed to clean up code footprint. Map styles are managed interactively via Leaflet.js. */

/* Map Detail Container Panel */
.map-detail-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

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

.region-alerts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
  overflow-y: auto;
  margin-top: 12px;
}

.regional-incident-card {
  background-color: rgba(0, 0, 0, 0.015);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: var(--transition-smooth);
}

.regional-incident-card:hover {
  border-color: rgba(0, 0, 0, 0.08);
  background-color: rgba(0, 0, 0, 0.025);
}

.incident-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.incident-card-title {
  font-family: var(--font-header);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
}

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

.badge-dot.green  { background-color: hsl(var(--color-green)); box-shadow: 0 0 6px hsl(var(--color-green)); }
.badge-dot.yellow { background-color: hsl(var(--color-yellow)); box-shadow: 0 0 6px hsl(var(--color-yellow)); }
.badge-dot.red    { background-color: hsl(var(--color-red)); box-shadow: 0 0 6px hsl(var(--color-red)); }
.badge-dot.grey   { background-color: hsl(var(--color-grey)); box-shadow: 0 0 6px hsl(var(--color-grey)); }

.incident-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   LEAFLET REAL GEOGRAPHIC MAP & POPUP STYLING (Midnight Glow)
   ========================================================================== */
.real-japan-map {
  width: 100%;
  height: 100%;
  min-height: 440px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #ffffff !important;
}

/* Glassmorphism over leaflet tiles */
.leaflet-container {
  background: #f8fafc !important;
  font-family: var(--font-body);
}

/* Custom tooltips for regional marker labels */
.leaflet-custom-tooltip {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  color: var(--text-main) !important;
  font-family: var(--font-header) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
}

.leaflet-custom-tooltip::before {
  border-top-color: rgba(255, 255, 255, 0.95) !important;
}

/* Custom dark zoom controls */
.leaflet-bar {
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
  border-radius: 8px !important;
  overflow: hidden;
}

.leaflet-bar a {
  background-color: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(8px);
  color: var(--text-main) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
  transition: var(--transition-smooth);
}

.leaflet-bar a:hover {
  background-color: rgba(0, 0, 0, 0.04) !important;
  color: #06b6d4 !important;
}

/* Pulsing markers animations */
.leaflet-pulse-marker {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 4px currentColor);
}

/* ==========================================================================
   INTERMEDIATE TABLET & MEDIUM SCREEN LAYOUT ADAPTATION (max-width: 950px)
   ========================================================================== */
@media (max-width: 950px) {
  /* Prevent stat cards from squishing by dropping to a 2x2 grid */
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  /* Stack the interactive map and detail panel vertically for proper usability */
  .map-layout-grid {
    grid-template-columns: 1fr !important;
    height: auto !important;
    min-height: unset !important;
    gap: 20px !important;
  }
  
  .map-card-container {
    height: 400px !important;
  }
  
  /* Stack system configuration options and custom endpoints cards */
  .config-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
}

/* ==========================================================================
   ULTRA-COMPACT MOBILE LAYOUT OVERRIDES (max-width: 600px)
   ========================================================================== */
@media (max-width: 600px) {
  .app-container {
    flex-direction: column !important;
    overflow-y: auto !important;
  }

  .sidebar {
    width: 100% !important;
    height: auto !important;
    padding: 12px 16px !important;
    flex-direction: row !important;
    align-items: center !important;
    border-right: none !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
    background-color: var(--bg-sidebar) !important;
  }

  .sidebar .brand {
    margin-bottom: 0 !important;
    gap: 8px !important;
  }

  .sidebar .brand-logo {
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px !important;
  }

  .sidebar .brand-logo svg {
    width: 18px !important;
    height: 18px !important;
  }

  .sidebar .brand-info {
    display: flex !important;
  }

  .sidebar .brand-title {
    font-size: 14px !important;
  }

  .sidebar .brand-tagline, 
  .sidebar .sidebar-footer, 
  .sidebar #sidebar-toggle-btn {
    display: none !important;
  }

  .sidebar .nav-menu {
    flex-direction: row !important;
    margin-left: auto !important;
    flex-grow: 0 !important;
    gap: 4px !important;
  }

  .sidebar .nav-item {
    font-size: 0 !important;
    padding: 8px !important;
    gap: 0 !important;
    border-radius: 6px !important;
    background: none !important;
    box-shadow: none !important;
  }

  .sidebar .nav-icon {
    margin: 0 !important;
    width: 20px !important;
    height: 20px !important;
  }

  .main-content {
    padding: 16px !important;
    height: calc(100vh - 54px) !important;
    overflow-y: auto !important;
    gap: 16px !important;
  }

  .content-header {
    margin-bottom: 4px !important;
  }

  .page-title {
    font-size: 18px !important;
  }

  .page-subtitle {
    font-size: 11px !important;
  }

  .header-actions .btn {
    padding: 6px 12px !important;
    font-size: 11px !important;
    border-radius: 6px !important;
  }

  /* Compact Dashboard Stats grid on mobile */
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .stat-card {
    padding: 10px 12px !important;
    border-radius: 8px !important;
  }

  .stat-label {
    font-size: 9px !important;
  }

  .stat-val {
    font-size: 18px !important;
  }

  .filter-bar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 8px 12px !important;
  }

  .filter-label {
    font-size: 10px !important;
  }

  .filter-tags {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }

  .filter-tag {
    padding: 4px 8px !important;
    font-size: 11px !important;
    border-radius: 4px !important;
  }

  /* Status grid mobile compact layout */
  .status-grid {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)) !important;
    gap: 10px !important;
  }

  .service-card {
    width: 100% !important;
    height: 64px !important;
    max-height: 64px !important;
    padding: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    border-radius: 10px !important;
    cursor: default !important;
    transform: none !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  .service-card-header {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    position: relative !important;
    flex-direction: row !important;
    gap: 0 !important;
  }

  .service-sub-row {
    display: block !important;
    position: static !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
  }

  .service-meta {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0 !important;
  }

  .service-icon {
    width: 40px !important;
    height: 40px !important;
    border: none !important;
    background: none !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 !important;
  }

  .service-icon svg {
    width: 24px !important;
    height: 24px !important;
  }

  .service-titles, 
  .service-category, 
  .expand-chevron, 
  .service-card-body, 
  .service-footer {
    display: none !important;
  }

  /* Float status indicator dot at top-right of mobile status grid cards */
  .service-card .status-badge {
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    width: 10px !important;
    height: 10px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  .service-card .status-badge span {
    display: none !important;
  }

  .service-card .status-badge .indicator-dot {
    width: 8px !important;
    height: 8px !important;
    margin: 0 !important;
  }

  /* Infrastructure map layout on mobile */
  .map-layout-grid {
    grid-template-columns: 1fr !important;
    height: auto !important;
    min-height: unset !important;
    gap: 16px !important;
  }

  .map-card-container {
    height: 380px !important;
    padding: 16px !important;
  }

  .real-japan-map {
    min-height: 280px !important;
  }

  .map-detail-container {
    height: auto !important;
    min-height: 240px !important;
    padding: 16px !important;
  }

  /* Config panels & Alert hubs on mobile */
  .config-grid, 
  .alert-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .card {
    padding: 16px !important;
  }

  .toggle-row {
    padding: 10px 12px !important;
  }

  .toggle-name {
    font-size: 13px !important;
  }

  .toggle-desc {
    font-size: 10.5px !important;
  }
}

