
/* MINIMALIST FIRE ALARM SYSTEM STYLES */
:root {
  /* Minimalist color palette */
  --primary-red: #dc2626;
  --primary-red-light: #ef4444;
  --primary-red-dark: #b91c1c;
  
  --neutral-50: #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-900: #171717;
  
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  /* Shadows - minimal */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  /* Border radius */
  --radius-sm: 0.25rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--neutral-50);
  color: var(--neutral-900);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* TYPOGRAPHY */
h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--neutral-900);
  margin-bottom: 2.5rem;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  padding-bottom: 1rem;
}

h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-red) 0%, var(--primary-red-light) 100%);
  border-radius: 2px;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--neutral-800);
  margin-bottom: 1.5rem;
  letter-spacing: -0.025em;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--neutral-800);
  margin-bottom: 1rem;
}

/* SIDEBAR */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
  border-right: 1px solid var(--neutral-200);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
}

.sidebar-header {
  padding: 1.75rem 1.25rem;
  border-bottom: 1px solid var(--neutral-200);
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.05) 0%, rgba(239, 68, 68, 0.02) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  transition: transform 0.2s ease;
}

.brand-logo:hover {
  transform: translateX(2px);
}

.fire-icon {
  font-size: 1.75rem;
  color: var(--primary-red);
  filter: drop-shadow(0 2px 4px rgba(220, 38, 38, 0.2));
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.05); }
}

.brand-logo h2 {
  font-size: 1.375rem;
  margin: 0;
  color: var(--neutral-900);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--neutral-900) 0%, var(--neutral-700) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-info {
  padding: 1.25rem;
  border-bottom: 1px solid var(--neutral-200);
  background: rgba(250, 250, 250, 0.5);
}

.user-display {
  background: linear-gradient(135deg, #ffffff 0%, var(--neutral-50) 100%);
  padding: 1.125rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  gap: 0.875rem;
  transition: all 0.2s ease;
}

.user-display:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.user-avatar {
  width: 2.75rem;
  height: 2.75rem;
  background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  font-size: 0.9375rem;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.user-display:hover .user-avatar {
  transform: scale(1.05);
}

.user-details {
  flex: 1;
  min-width: 0;
}

.welcome-text {
  font-size: 0.75rem;
  color: var(--neutral-500);
  margin-bottom: 0.25rem;
}

.username-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--neutral-900);
  margin-bottom: 0.25rem;
}

.user-role {
  font-size: 0.7rem;
  color: var(--neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.nav-section {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--neutral-300) transparent;
}

.nav-section::-webkit-scrollbar {
  width: 6px;
}

.nav-section::-webkit-scrollbar-track {
  background: transparent;
}

.nav-section::-webkit-scrollbar-thumb {
  background: var(--neutral-300);
  border-radius: 3px;
}

.nav-section::-webkit-scrollbar-thumb:hover {
  background: var(--neutral-400);
}

.nav-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-menu li {
  margin-bottom: 0.125rem;
}

.nav-menu a {
  color: var(--neutral-700);
  text-decoration: none;
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-md);
  margin: 0.25rem 0.5rem;
  position: relative;
  font-weight: 500;
}

.nav-menu a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--primary-red);
  border-radius: 0 2px 2px 0;
  transition: height 0.2s ease;
}

.nav-icon {
  font-size: 1.125rem;
  width: 1.5rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.nav-text {
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.nav-menu a:hover {
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.08) 0%, rgba(239, 68, 68, 0.04) 100%);
  color: var(--primary-red);
  transform: translateX(4px);
  padding-left: 1.25rem;
}

.nav-menu a:hover .nav-icon {
  transform: scale(1.1);
}

.nav-menu a.active {
  background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-light) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  font-weight: 600;
}

.nav-menu a.active::before {
  height: 60%;
  background: rgba(255, 255, 255, 0.3);
}

.nav-menu a.active .nav-icon {
  transform: scale(1.15);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--neutral-200);
  background: rgba(250, 250, 250, 0.5);
}

.logout-btn {
  color: var(--neutral-700);
  text-decoration: none;
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  transition: all 0.2s ease;
  border-radius: var(--radius-md);
  border: 1px solid var(--neutral-200);
  background: white;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.logout-btn:hover {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: var(--primary-red-dark);
  border-color: var(--primary-red-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.15);
}

.logout-btn:hover .nav-icon {
  transform: rotate(-15deg) scale(1.1);
}

/* TOGGLE BUTTON */
#toggleBtn {
  position: fixed;
  top: 1.25rem;
  left: 280px;
  z-index: 1001;
  background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
  border: 2px solid var(--neutral-200);
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  font-size: 0.875rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neutral-700);
  overflow: hidden;
}

#toggleBtn.sidebar-hidden {
  left: 1rem;
}

#toggleBtn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-light) 100%);
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
}

#toggleBtn:hover {
  color: white;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4), 0 2px 8px rgba(220, 38, 38, 0.2);
  transform: translateY(-2px) scale(1.05);
  border-color: var(--primary-red);
}

#toggleBtn:hover::before {
  left: 0;
}

#toggleBtn:active {
  transform: translateY(0) scale(0.98);
}

#toggleBtn::after {
  content: '☰';
  font-size: 1.25rem;
  font-weight: 700;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
  position: relative;
  z-index: 1;
}

#toggleBtn:hover::after {
  transform: rotate(180deg);
}


/* MAIN CONTENT */
#main-content {
  margin-left: 260px;
  padding: 2.5rem;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--neutral-50) 0%, #ffffff 100%);
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: linear-gradient(135deg, #ffffff 0%, var(--neutral-50) 100%);
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--neutral-300) 0%, var(--neutral-200) 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.stat-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
  border-color: var(--neutral-300);
}

.stat-card:hover::before {
  transform: scaleX(1);
}

.stat-card.green:hover::before { background: linear-gradient(90deg, var(--success) 0%, #4ade80 100%); }
.stat-card.red:hover::before { background: linear-gradient(90deg, var(--danger) 0%, var(--primary-red-light) 100%); }
.stat-card.orange:hover::before { background: linear-gradient(90deg, var(--warning) 0%, #fbbf24 100%); }
.stat-card.blue:hover::before { background: linear-gradient(90deg, var(--primary-red) 0%, var(--primary-red-light) 100%); }
.stat-card.purple:hover::before { background: linear-gradient(90deg, #a855f7 0%, #c084fc 100%); }
.stat-card.yellow:hover::before { background: linear-gradient(90deg, var(--warning) 0%, #fbbf24 100%); }

.stat-number {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--neutral-900);
  margin-bottom: 0.625rem;
  line-height: 1;
  letter-spacing: -0.02em;
  transition: transform 0.2s ease;
}

.stat-card:hover .stat-number {
  transform: scale(1.05);
}

.stat-label {
  color: var(--neutral-600);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.stat-card.green .stat-number { color: var(--success); }
.stat-card.red .stat-number { color: var(--danger); }
.stat-card.orange .stat-number { color: var(--warning); }
.stat-card.blue .stat-number { color: var(--primary-red); }

/* STATUS BANNER */
.status-banner {
  background: white;
  border: 1px solid var(--neutral-200);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-light.green { background: var(--success); }
.status-light.red { background: var(--danger); }
.status-light.yellow { background: var(--warning); }

.status-info h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--neutral-900);
}

.status-info p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--neutral-500);
}

.last-update {
  font-size: 0.75rem;
  color: var(--neutral-400);
}

/* ACTIVITY SECTION */
.activity-section {
  margin: 2rem 0;
}

.activity-box {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  overflow: hidden;
}

.activity-header {
  padding: 1.5rem;
  background: var(--neutral-50);
  border-bottom: 1px solid var(--neutral-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.activity-header h3 {
  margin: 0;
  color: var(--neutral-900);
  font-weight: 600;
  font-size: 1rem;
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-badge.normal {
  background: var(--neutral-100);
  color: var(--neutral-600);
}

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

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

.activity-content {
  padding: 1.5rem;
}

.activity-content p {
  margin: 0 0 0.75rem 0;
  color: var(--neutral-600);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.activity-content p:last-child {
  margin-bottom: 0;
}

/* PLACEHOLDER PAGES */
.page-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 3rem;
}

.placeholder-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  opacity: 0.4;
}

.placeholder-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--neutral-900);
  margin-bottom: 0.75rem;
}

.placeholder-description {
  font-size: 0.875rem;
  color: var(--neutral-500);
  max-width: 400px;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.placeholder-features {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.placeholder-features li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--neutral-600);
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  background: white;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius);
}

/* IFRAME CONTAINER */
.iframe-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.iframe-box {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--neutral-200);
}

.iframe-box h3 {
  background: var(--neutral-50);
  color: var(--neutral-900);
  padding: 1rem;
  margin: 0;
  border-bottom: 1px solid var(--neutral-200);
  font-size: 0.875rem;
  font-weight: 600;
}

.iframe-box iframe {
  width: 100%;
  border: none;
  display: block;
}

.iframe-box.full-width {
  grid-column: 1 / -1;
}

/* MAP SECTION */
.map-section {
  margin: 2rem 0;
}

.map-description {
  color: var(--neutral-500);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  padding: 1rem;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--neutral-200);
  border-left: 3px solid var(--primary-red);
}

.map-container {
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.map-container h3 {
  background: var(--neutral-50);
  color: var(--neutral-900);
  margin: 0;
}

/* BUTTONS */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.btn-primary {
  background: var(--primary-red);
  color: white;
  border: 1px solid var(--primary-red);
}

.btn-primary:hover {
  background: var(--primary-red-dark);
  border-color: var(--primary-red-dark);
}

.btn-secondary {
  background: white;
  color: var(--neutral-700);
  border: 1px solid var(--neutral-300);
}

.btn-secondary:hover {
  background: var(--neutral-50);
}

/* FORMS */
input, select, textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: border-color 0.15s ease;
  background: white;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 1px var(--primary-red);
}

/* LOGIN PAGE */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--neutral-50);
  padding: 1rem;
}

.login-box {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--neutral-200);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h2 {
  color: var(--neutral-900);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.login-header p {
  color: var(--neutral-500);
  font-size: 0.875rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--neutral-700);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.875rem;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 1px var(--primary-red);
}

.login-btn {
  width: 100%;
  background: var(--primary-red);
  color: white;
  padding: 0.875rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.login-btn:hover {
  background: var(--primary-red-dark);
}

.login-footer {
  text-align: center;
  margin-top: 2rem;
  color: var(--neutral-500);
  font-size: 0.75rem;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  #sidebar {
    width: 100%;
    transform: translateX(-100%);
  }

  #toggleBtn {
    left: 1rem !important;
  }

  #main-content {
    margin-left: 0 !important;
    padding: 1rem;
  }

  .iframe-container {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  h1 {
    font-size: 1.5rem;
  }
}

/* MODAL */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 2rem;
  border: none;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
}

.close {
  color: var(--neutral-400);
  float: right;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  margin-top: -0.5rem;
  margin-right: -0.5rem;
}

.close:hover {
  color: var(--neutral-600);
}

/* ANALYTICS FILTER GROUP */
.filters-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 0.75rem;
  padding: 1rem;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 1.5rem;
}

.filters-group.compact {
  align-items: end;
}

@media (min-width: 992px) {
  .filters-group.compact {
    grid-template-columns: 1.5fr repeat(2, minmax(150px, 0.9fr)) auto;
  }
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.filter-item.stretch {
  min-width: 220px;
}

.filter-item label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--neutral-500);
  font-weight: 600;
}

.filter-item select,
.filter-item input {
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--neutral-300);
  background: var(--neutral-50);
  font-size: 0.875rem;
  min-height: 38px;
}

.filter-item select:focus,
.filter-item input:focus {
  border-color: var(--primary-red);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.08);
  background: white;
}

.filter-item.action {
  display: flex;
  align-items: flex-end;
}

.filter-item.action .btn {
  width: 100%;
  justify-content: center;
}

/* ANALYTICS PAGE ENHANCEMENTS */
.time-filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.time-filters button {
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--neutral-200);
  background: white;
  color: var(--neutral-700);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.time-filters button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.time-filters button:hover::before {
  left: 100%;
}

.time-filters button:hover {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.08) 0%, rgba(239, 68, 68, 0.04) 100%);
  color: var(--primary-red);
  border-color: var(--primary-red-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.15);
}

.time-filters button.active {
  background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-light) 100%);
  color: white;
  border-color: var(--primary-red);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  font-weight: 600;
}

.device-select {
  margin-bottom: 2rem;
  padding: 1rem;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.device-select label {
  display: block;
  font-weight: 600;
  color: var(--neutral-700);
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
}

.device-select select {
  padding: 0.875rem 1rem;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-md);
  background: white;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.device-select select:hover {
  border-color: var(--primary-red-light);
}

.device-select select:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.kpi-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: linear-gradient(135deg, #ffffff 0%, var(--neutral-50) 100%);
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-red) 0%, var(--primary-red-light) 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.kpi-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
  border-color: var(--primary-red-light);
}

.kpi-card:hover::after {
  transform: scaleX(1);
}

.kpi-card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--neutral-600);
  margin: 0 0 0.75rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-card p {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-red);
  margin: 0;
  line-height: 1;
  letter-spacing: -0.02em;
  transition: transform 0.2s ease;
}

.kpi-card:hover p {
  transform: scale(1.1);
}

.chart-container {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  margin-bottom: 2rem;
  position: relative;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.chart-container canvas {
  max-width: 100%;
  height: auto !important;
}

.chart-block {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  margin-bottom: 2rem;
}

.chart-block h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--neutral-800);
  margin-bottom: 1.5rem;
}

.chart-block canvas {
  max-width: 100%;
  height: 300px !important;
}

/* Metrics Section */
.metrics-section {
  margin-bottom: 2rem;
}

.metrics-section h2 {
  margin-bottom: 1.5rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}

.stat-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--neutral-600);
}

.stat-detail-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-detail-item.critical {
  color: var(--danger);
}

.stat-detail-item.warning {
  color: var(--warning);
}

.stat-detail-item strong {
  font-weight: 600;
  color: var(--neutral-900);
}

/* Heatmap Section */
.heatmap-section {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  margin-bottom: 2rem;
}

.heatmap-section h2 {
  margin-bottom: 1.5rem;
}

.heatmap-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--neutral-600);
}

.heatmap-legend {
  display: flex;
  gap: 3px;
}

.heatmap-legend-item {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--neutral-100);
  border: 1px solid var(--neutral-200);
}

.heatmap-legend-item[data-level="1"] { background: #c6e48b; border-color: #7bc96f; }
.heatmap-legend-item[data-level="2"] { background: #7bc96f; border-color: #239a3b; }
.heatmap-legend-item[data-level="3"] { background: #fbbf24; border-color: #f59e0b; }
.heatmap-legend-item[data-level="4"] { background: #ef4444; border-color: #dc2626; }

.heatmap-container,
.heatmap-container-verified {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  margin-top: 1rem;
}

.heatmap-months {
  display: grid;
  grid-template-rows: repeat(7, 11px);
  gap: 3px;
  align-content: start;
  padding-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--neutral-600);
}

.heatmap-month-label {
  grid-row: 1;
  font-size: 0.75rem;
  color: var(--neutral-600);
  white-space: nowrap;
  padding-right: 0.5rem;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(53, 11px);
  grid-auto-rows: 11px;
  gap: 3px;
}

.heatmap-day {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: #ebedf0;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s, border 0.1s;
  border: 1px solid transparent;
}

.heatmap-day:hover {
  transform: scale(1.3);
  z-index: 10;
  border: 1px solid var(--neutral-400);
}

/* Green for no alerts (default) */
.heatmap-day[data-level="0"] { background: #ebedf0; }

/* Light green for low alerts */
.heatmap-day[data-level="1"] { background: #c6e48b; }

/* Medium green for moderate alerts */
.heatmap-day[data-level="2"] { background: #7bc96f; }

/* Yellow for warnings */
.heatmap-day[data-level="3"][data-level-type="warning"] { background: #fbbf24; }
.heatmap-day[data-level="3"][data-level-type="low"] { background: #7bc96f; }

/* Red for critical/high alerts */
.heatmap-day[data-level="4"] { background: #ef4444; }

.heatmap-tooltip {
  position: fixed;
  background: var(--neutral-900);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 1000;
  display: none;
  box-shadow: var(--shadow-lg);
  line-height: 1.5;
}

.heatmap-tooltip strong {
  display: block;
  margin-bottom: 0.25rem;
}

/* Performance Section */
.performance-section {
  margin-bottom: 2rem;
}

.performance-section h2 {
  margin-bottom: 1.5rem;
}

.performance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.performance-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

/* ENHANCED BUTTONS */
.btn {
  padding: 0.875rem 1.75rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.9375rem;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-light) 100%);
  color: white;
  border: 1px solid var(--primary-red);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-red-dark) 0%, var(--primary-red) 100%);
  border-color: var(--primary-red-dark);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.btn-secondary {
  background: white;
  color: var(--neutral-700);
  border: 1px solid var(--neutral-300);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  background: var(--neutral-50);
  border-color: var(--neutral-400);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.btn-compact {
  padding: 0.6rem 1.25rem;
  font-size: 0.85rem;
}

/* LOADING STATES */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.loading-content {
  text-align: center;
}

.loading-content .loading-spinner {
  width: 40px;
  height: 40px;
  border-width: 4px;
  border-top-color: var(--primary-red);
  margin-bottom: 1rem;
}

.loading-text {
  color: var(--neutral-700);
  font-weight: 500;
  font-size: 0.9375rem;
}

/* ERROR STATES */
.error-message {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border: 1px solid var(--primary-red-light);
  color: var(--primary-red-dark);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
}

.error-message::before {
  content: '⚠️';
  font-size: 1.25rem;
}

.success-message {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border: 1px solid var(--success);
  color: #166534;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
}

.success-message::before {
  content: '✅';
  font-size: 1.25rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
}

.empty-state-icon {
  font-size: 4rem;
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--neutral-900);
  margin-bottom: 0.5rem;
}

.empty-state-description {
  color: var(--neutral-600);
  font-size: 0.9375rem;
  max-width: 400px;
  margin: 0 auto;
}

/* ENHANCED STATUS BANNER */
.status-banner {
  background: linear-gradient(135deg, #ffffff 0%, var(--neutral-50) 100%);
  border: 1px solid var(--neutral-200);
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.status-banner:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.status-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.status-light.green { 
  background: var(--success);
  color: var(--success);
}

.status-light.red { 
  background: var(--danger);
  color: var(--danger);
}

.status-light.yellow { 
  background: var(--warning);
  color: var(--warning);
}

/* ENHANCED ACTIVITY BOX */
.activity-box {
  background: linear-gradient(135deg, #ffffff 0%, var(--neutral-50) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.activity-box:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.activity-header {
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--neutral-50) 0%, #ffffff 100%);
  border-bottom: 1px solid var(--neutral-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-badge {
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-badge.normal {
  background: linear-gradient(135deg, var(--neutral-100) 0%, var(--neutral-200) 100%);
  color: var(--neutral-700);
}

.status-badge.warning {
  background: linear-gradient(135deg, var(--warning) 0%, #fbbf24 100%);
  color: white;
}

.status-badge.critical {
  background: linear-gradient(135deg, var(--danger) 0%, var(--primary-red-light) 100%);
  color: white;
}

/* ENHANCED IFRAME BOX */
.iframe-box {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--neutral-200);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.iframe-box:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.iframe-box h3 {
  background: linear-gradient(135deg, var(--neutral-50) 0%, #ffffff 100%);
  color: var(--neutral-900);
  padding: 1.25rem;
  margin: 0;
  border-bottom: 1px solid var(--neutral-200);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}


/* ENHANCED FORMS */
input, select, textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  transition: all 0.2s ease;
  background: white;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
  transform: translateY(-1px);
}

input:hover, select:hover, textarea:hover {
  border-color: var(--neutral-400);
}

/* ENHANCED MODAL */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: linear-gradient(135deg, #ffffff 0%, var(--neutral-50) 100%);
  margin: 5% auto;
  padding: 2.5rem;
  border: none;
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

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

.close {
  color: var(--neutral-400);
  float: right;
  font-size: 1.75rem;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  margin-top: -0.75rem;
  margin-right: -0.75rem;
  transition: all 0.2s ease;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close:hover {
  color: var(--primary-red);
  background: rgba(220, 38, 38, 0.1);
  transform: rotate(90deg);
}

/* RESPONSIVE ENHANCEMENTS */
@media (max-width: 768px) {
  #sidebar {
    width: 100%;
    transform: translateX(-100%);
  }

  #toggleBtn {
    left: 1rem !important;
  }

  #main-content {
    margin-left: 0 !important;
    padding: 1.5rem;
  }

  .iframe-container {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .kpi-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .time-filters {
    flex-direction: column;
  }

  .time-filters button {
    width: 100%;
  }

  h1 {
    font-size: 1.5rem;
  }

  .stat-card, .kpi-card {
    padding: 1.25rem;
  }
}
/* Container for filters and table/chart */
.analytics-container {
    max-width: 900px; /* Limit width */
    margin: 20px auto; /* Center horizontally */
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
    font-family: 'Inter', sans-serif;
}

/* Filters row */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* Inputs and dropdowns */
.filters input[type="date"],
.filters select {
    padding: 6px 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #fff;
}

/* Apply filter button */
.filters button {
    padding: 6px 14px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.filters button:hover {
    background-color: #45a049;
}

/* Table for analytics data */
.analytics-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.analytics-table th,
.analytics-table td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: center;
}

.analytics-table th {
    background-color: #f2f2f2;
}

/* Chart container */
.chart-container {
    width: 100%;
    height: 300px;
    margin-top: 20px;
}
