/* =====================
   Base & Reset
===================== */
@keyframes blink-fault {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.2;
    transform: scale(1.15);
  }
}

.blink-fault {
  color: var(--status-critical, #e53935) !important;
  animation: blink-fault 1.2s infinite ease-in-out;
  display: inline-block;
  vertical-align: middle;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

/* =====================
   Header (Spectra Header - Seamless, No Lining)
===================== */
.spectra-header {
  height: 60px;
  background: var(--bg-header);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  width: 100%;
  padding: 0 1rem;
  box-shadow: none;
  border-bottom: none;
  z-index: 1000;
}

.header-right-avatar {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: var(--bg-surface-variant);
  border: 1px solid var(--primary-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--shadow-color);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.header-right-avatar:hover {
  transform: translateY(-50%) scale(1.05);
  border-color: var(--primary-hover);
}

.avatar-initials {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 0.5px;
}

.header-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 auto;
}

.burger {
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--primary-color);
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.header-nova-logo {
  height: 16px;
  width: auto;
  filter: invert(1) brightness(1.8);
  display: inline-block;
  vertical-align: middle;
  transition: filter 0.3s ease;
}

:root.light-mode .header-nova-logo {
  filter: none;
}



.burger:hover {
  background: rgba(77, 208, 255, 0.1);
}


.header-actions {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: var(--primary-color);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}

.header-btn:hover {
  color: var(--primary-hover);
  background: rgba(77, 208, 255, 0.1);
}

/* =====================
   Gemini-Style Side Menu & Draggable Resizer Edge
===================== */
/* =====================
   Gemini-Style Side Menu & Draggable Resizer Edge
===================== */
.side-menu {
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  width: 240px;
  background: var(--bg-header);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 950;
  box-shadow: none;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Resizer Handle with Hover Color Accent */
.sidebar-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: ew-resize;
  z-index: 990;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-resizer:hover,
body.is-resizing-sidebar .sidebar-resizer {
  background: var(--primary-color, #4dd0ff) !important;
  box-shadow: 0 0 10px rgba(77, 208, 255, 0.6);
  opacity: 1;
}

body.is-resizing-sidebar {
  cursor: ew-resize !important;
  user-select: none !important;
}

.menu-brand {
  padding: 1.2rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-color);
  background: rgba(0,0,0,0.15);
  border-bottom: none;
  white-space: nowrap;
}

.menu-nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.85rem 1.2rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-item:hover {
  background: var(--bg-surface-variant);
  color: var(--primary-color);
}

.nav-item i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  color: var(--primary-color);
}

/* Desktop View Settings */
@media (min-width: 992px) {
  .burger {
    display: none !important;
  }

  .side-menu .menu-brand {
    display: none !important;
  }

  body .summary-container,
  body .grid-container,
  body .wallboard,
  body .site-header-container,
  body .site-header-box,
  body .back-btn-container,
  body main {
    margin-left: var(--sidebar-width, 240px);
  }


  /* Collapsed (Mini Rail Mode) */
  body.sidebar-collapsed .side-menu {
    width: 64px !important;
  }

  body.sidebar-collapsed .menu-brand .brand-text,
  body.sidebar-collapsed .nav-text {
    display: none;
  }

  body.sidebar-collapsed .side-menu .nav-item {
    justify-content: center;
    padding: 0.85rem 0;
  }

  body.sidebar-collapsed .menu-footer {
    justify-content: center !important;
    padding: 0.8rem 0 !important;
  }

  body.sidebar-collapsed .summary-container,
  body.sidebar-collapsed .grid-container,
  body.sidebar-collapsed .wallboard,
  body.sidebar-collapsed .site-header-container,
  body.sidebar-collapsed .site-header-box,
  body.sidebar-collapsed .back-btn-container,
  body.sidebar-collapsed main {
    margin-left: 64px !important;
  }
}




/* Mobile Drawer Mode */
@media (max-width: 991.98px) {
  .sidebar-resizer {
    display: none !important;
  }

  .side-menu {
    top: 0;
    left: 0;
    width: 270px !important;
    height: 100vh;
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  }

  .side-menu.mobile-open {
    transform: translateX(0);
  }

  .side-menu .menu-brand {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
  }

  .side-menu .closebtn {
    font-size: 1.6rem;
    color: var(--primary-color);
    cursor: pointer;
  }

  body .summary-container,
  body .grid-container,
  body .wallboard,
  body .site-header-container,
  body .site-header-box,
  body .back-btn-container {
    margin-left: 0 !important;
  }
}

/* Glassmorphic Backdrop Blur (No Darkening) */
.overlay {
  position: fixed;
  display: none;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  background-color: transparent;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1500;
}

/* =====================
   Summary Container & Boxes (2 Columns Desktop Layout)
===================== */
.summary-container {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  padding: 0.85rem;
}

.summary-box {
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 1rem 0.8rem;
  text-align: center;
  box-shadow: 0 4px 10px var(--shadow-color);
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px var(--shadow-hover);
}

.summary-box h3 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-box p {
  margin: 0.4rem 0 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text-primary);
}

/* =====================
   Site Cards Grid (Uniform 5-5 Distribution & Equal Heights)
===================== */
.grid-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.85rem;
  padding: 0.85rem;
  align-items: stretch;
}

@media (max-width: 1200px) {
  .grid-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .grid-container {
    grid-template-columns: 1fr;
  }
}

site-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.site-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  box-shadow: 0 4px 12px var(--shadow-color);
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.site-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px var(--shadow-hover);
}

.site-card h4 {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
  min-height: 2.8rem;
}

.site-card-title-text {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  line-height: 1.35;
  word-break: break-word;
}

.site-card .status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  margin-top: 2px;
}

.status-badge.normal {
  color: var(--status-normal);
}

.status-badge.warning {
  color: var(--status-warning);
}

.status-badge.critical {
  color: var(--status-critical);
}

.site-card .count {
  margin: 0.4rem 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-bar {
  background: var(--bg-surface-variant);
  border-radius: 6px;
  overflow: hidden;
  height: 6px;
  width: 100%;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.progress-normal { background: var(--status-normal); }
.progress-warning  { background: var(--status-warning); }
.progress-critical { background: var(--status-critical); }
