:root {
  --bg-dark: #0f111a;
  --panel-bg: rgba(22, 25, 43, 0.7);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --status-normal: #10b981;
  --status-issue: #ef4444;
  --status-warning: #f59e0b;
  --font-body: 'Inter', sans-serif;
  --font-heading: 'Outfit', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Glassmorphism utility */
.glass {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
}

.dashboard-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.noc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  height: 64px;
  background: linear-gradient(90deg, rgba(15,23,42,1) 0%, rgba(30,58,138,0.5) 100%);
  border-bottom: 1px solid var(--panel-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

.header-logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 2px;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.5rem;
  text-shadow: 0 0 10px rgba(255,255,255,0.2);
}

.header-time {
  font-family: monospace;
  font-size: 1.2rem;
  color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid var(--panel-border);
}

/* Main Content Layout */
.main-content {
  display: flex;
  flex: 1;
  height: calc(100vh - 64px);
}

/* Sidebars */
.sidebar {
  width: 320px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  z-index: 10;
}

.filter-panel {
  border-right: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(15,23,42,0.95) 0%, rgba(15,23,42,0.85) 100%);
  backdrop-filter: blur(10px);
}

.details-panel {
  border-left: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(15,23,42,0.95) 0%, rgba(15,23,42,0.85) 100%);
  backdrop-filter: blur(10px);
}

.sidebar h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--panel-border);
}

.refresh-btn {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font-body);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.refresh-btn:hover {
  background: rgba(6, 182, 212, 0.3);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
  transform: translateY(-1px);
}

.refresh-btn:active {
  transform: translateY(0);
}

.refresh-btn i.spinning {
  animation: spin 1s linear infinite;
}

/* Forms */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

select, input {
  width: 100%;
  padding: 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s;
}

select:focus, input:focus {
  border-color: var(--accent-blue);
}

select option {
  background: var(--bg-dark);
  color: #fff;
}

/* Checkbox Dropdown Styling */
.checkbox-dropdown {
    position: relative;
    user-select: none;
}

.dropdown-btn {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
    transition: border-color 0.3s;
}

.dropdown-btn:hover {
    border-color: var(--accent-blue);
}

.dropdown-btn::after {
    content: '▼';
    font-size: 0.6rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.checkbox-dropdown.active .dropdown-btn::after {
    transform: rotate(180deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background: rgba(15, 17, 26, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent-blue);
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 8px;
    margin-top: 4px;
}

.checkbox-dropdown.active .dropdown-content {
    display: block;
}

.search-inner {
    margin-bottom: 8px;
    position: sticky;
    top: -8px;
    background: inherit;
    padding-bottom: 4px;
    padding-top: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2;
}

.search-inner input {
    width: 100%;
    padding: 6px;
    font-size: 0.85rem;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    outline: none;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #fff;
    transition: background 0.2s;
}

.checkbox-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.checkbox-item input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.checkbox-item span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Stats */
.stats-container {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-box {
  padding: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform 0.2s;
}

.stat-box:hover {
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 2rem;
  opacity: 0.8;
}

.stat-box.normal .stat-icon { color: var(--status-normal); }
.stat-box.issue .stat-icon { color: var(--status-issue); }
.stat-box.total .stat-icon { color: var(--accent-cyan); }

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: var(--font-heading);
  line-height: 1;
}

.stat-box.normal .stat-value { color: var(--status-normal); }
.stat-box.issue .stat-value { color: var(--status-issue); }
.stat-box.total .stat-value { color: #fff; }

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 4px;
  font-weight: 500;
}

/* Map Container */
.map-container {
  flex: 1;
  position: relative;
  background: #000;
}

#map {
  width: 100%;
  height: 100%;
  background-color: #0f111a;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 17, 26, 0.8);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--accent-cyan);
  transition: opacity 0.5s;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(6, 182, 212, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

/* Site Info Panel */
.site-info-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  gap: 16px;
}

.site-info-placeholder i {
  font-size: 3rem;
  opacity: 0.5;
}

.site-card {
  animation: fadeIn 0.3s ease-in-out;
}

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

.site-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 16px;
}

.site-name {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.site-id {
  font-size: 0.9rem;
  color: var(--accent-cyan);
  font-family: monospace;
}

.site-status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 12px;
  text-transform: uppercase;
}

.site-status-badge.normal {
  background: rgba(16, 185, 129, 0.2);
  color: var(--status-normal);
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.site-status-badge.issue {
  background: rgba(239, 68, 68, 0.2);
  color: var(--status-issue);
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.site-detail-row {
  display: flex;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(255,255,255,0.1);
}

.site-detail-label {
  flex: 0 0 100px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-detail-value {
  flex: 1;
  color: #fff;
  font-weight: 500;
  font-size: 0.9rem;
  word-break: break-word;
}

/* Leaflet Overrides for Dark Mode */
.leaflet-popup-content-wrapper {
  background: rgba(22, 25, 43, 0.95) !important;
  color: #fff !important;
  border: 1px solid var(--accent-cyan);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}
.leaflet-popup-tip {
  background: rgba(22, 25, 43, 0.95) !important;
}
.leaflet-popup-content {
  margin: 14px;
}
.popup-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 4px;
  color: var(--accent-cyan);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 4px;
}

.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
  background-color: rgba(6, 182, 212, 0.6);
}
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
  background-color: rgba(6, 182, 212, 0.9);
  color: white;
  font-weight: bold;
}

/* Mobile Responsive UI */
.mobile-nav-btn, .mobile-close-btn {
  display: none !important;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.mobile-close-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

@media (max-width: 860px) {
  .mobile-nav-btn, .mobile-close-btn {
    display: flex !important;
  }
  
  .hide-mobile {
    display: none !important;
  }

  body {
    overflow: hidden;
  }

  .noc-header {
    padding: 0 15px;
  }

  .header-logo {
    font-size: 1rem;
  }

  .header-title {
    display: none;
  }

  .header-time {
    font-size: 0.9rem;
    padding: 4px 8px;
  }

  .main-content {
    position: relative;
    overflow: hidden;
  }

  .map-container {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0; left: 0;
  }

  .sidebar.filter-panel {
    position: absolute;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 340px;
    height: 100%;
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 5px 0 25px rgba(0,0,0,0.5);
  }

  .sidebar.filter-panel.open {
    left: 0;
  }

  .sidebar.details-panel {
    position: absolute;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 60%;
    z-index: 1000;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -5px 25px rgba(0,0,0,0.5);
    border-left: none;
    border-top: 1px solid var(--panel-border);
  }

  .sidebar.details-panel.open {
    bottom: 0;
  }

  .stats-container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .stat-box {
    flex: 1 1 calc(50% - 6px);
    padding: 10px;
    gap: 10px;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .stat-icon {
    font-size: 1.3rem;
  }
}

@media (max-width: 480px) {
  .stat-box {
    flex: 1 1 100%;
  }
}

/* Modern Login Overlay */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #08090f;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  font-family: var(--font-body);
}

/* Background glowing abstract shapes */
.login-background-glows {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.login-background-glows .glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(150px);
  opacity: 0.35;
  animation: floatGlow 12s ease-in-out infinite alternate;
}

.login-background-glows .glow-1 {
  top: -10%;
  left: 10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-cyan) 0%, rgba(6,182,212,0) 70%);
}

.login-background-glows .glow-2 {
  bottom: -10%;
  right: 10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-blue) 0%, rgba(59,130,246,0) 70%);
  animation-delay: -6s;
}

@keyframes floatGlow {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(50px, 30px) scale(1.15);
  }
}

/* Glassmorphic Login Card */
.login-card {
  width: 100%;
  max-width: 440px;
  padding: 40px;
  border-radius: 20px;
  z-index: 2;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  position: relative;
  background: rgba(15, 17, 26, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: cardEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardEntrance {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Card Header */
.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 3px;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  text-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
  border: none !important;
  padding: 0 !important;
}

.login-logo i {
  font-size: 1.6rem;
  animation: pulseLogo 2s infinite ease-in-out;
}

@keyframes pulseLogo {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px var(--accent-cyan)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 10px var(--accent-cyan)); }
}

.login-header h2 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Login Error State */
.login-error {
  display: none;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 24px;
  align-items: center;
  gap: 10px;
  animation: shakeError 0.4s ease-in-out;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Inputs and Forms */
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-card .input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-card .input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.login-card .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.login-card .input-wrapper input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
}

.login-card .input-wrapper input:focus {
  border-color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
}

/* Toggle Password Visibility Button */
.toggle-password-btn {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.toggle-password-btn:hover {
  color: var(--accent-cyan);
}

/* Modern Gradient Submit Button */
.login-card .login-btn {
  width: 100%;
  padding: 14px;
  margin-top: 10px;
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.login-card .login-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: all 0.6s ease;
}

.login-card .login-btn:hover::before {
  left: 100%;
}

.login-card .login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

.login-card .login-btn:active {
  transform: translateY(0);
}

.login-card .login-btn span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Footer Copyright */
.login-footer {
  margin-top: 30px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Logout Button Styling */
.logout-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font-body);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

.logout-btn:active {
  transform: translateY(0);
}
