/* style.css */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");

:root {
  --bg-color: #f3f4f6;
  --card-bg: #ffffff;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --accent-color: #05179b;
  --accent-hover: #03106b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --border-color: #e5e7eb;
  --input-bg: #f9fafb;
  --message-other-bg: #f3f4f6;
  --empty-state-bg: #f9fafb;
  --attachment-bg: #f3f4f6;
  --logout-hover-bg: #f3f4f6;

  /* Alert colors - Light mode */
  --alert-error-bg: #fff5f5;
  --alert-error-border: #f56565;
  --alert-warning-bg: #fffaf0;
  --alert-warning-border: #ed8936;
  --alert-success-bg: #f0fff4;
  --alert-success-border: #48bb78;
}

body.dark-mode {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --border-color: #334155;
  --input-bg: #0f172a;
  --message-other-bg: #334155;
  --empty-state-bg: #0f172a;
  --attachment-bg: #334155;
  --logout-hover-bg: #334155;

  /* Alert colors - Dark mode */
  --alert-error-bg: #3f1f1f;
  --alert-error-border: #f56565;
  --alert-warning-bg: #3f2f1f;
  --alert-warning-border: #ed8936;
  --alert-success-bg: #1f3f2f;
  --alert-success-border: #48bb78;
}

/* Títulos en modo oscuro */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
  color: #e2e8f0 !important;
}

body.dark-mode .section-title {
  color: #e2e8f0 !important;
}

body.dark-mode .card-title {
  color: #e2e8f0 !important;
}

body.dark-mode .auth-title {
  color: #e2e8f0 !important;
}

body.dark-mode .dash-card h3 {
  color: #e2e8f0 !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Poppins", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
}

.container {
  flex: 1;
  max-width: 100%;
  margin: 0;
  padding: 2rem;
  width: 100%;
  background: var(--card-bg);
  border-radius: 8px;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

.superadmin-container {
  padding: 3rem;
}

.approver-container {
  padding-top: 2rem;
}

/* Global Alerts */
.global-alerts {
  width: 100%;
  position: relative;
  z-index: 100;
}

.alert-banner {
  color: #ffffff;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  animation: slideDown 0.3s ease-out;
}

/* Sitio caído - Rojo */
/* Sitio caído - Rojo claro */
.alert-banner-down {
  background: #ffebee;
  color: #8b3a3a;
  border-bottom-color: #ef9a9a;
}

/* Sitio lento - Naranja/Amarillo */
.alert-banner-slow {
  background: #f59e0b;
  border-bottom-color: #d97706;
}

/* Nueva orden - Verde pastel */
.alert-banner-order {
  background: #86efac;
  color: #065f46;
  border-bottom-color: #6ee7b7;
}

/* Nuevo lead - Azul pastel */
.alert-banner-lead {
  background: #bae6fd;
  color: #075985;
  border-bottom-color: #7dd3fc;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-content {
  font-size: 1rem;
  font-weight: 600;
}

.alert-content strong {
  font-weight: 700;
  margin-right: 0.5rem;
}

.alert-actions {
  display: flex;
  gap: 0.75rem;
}

.alert-btn {
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
}

.alert-btn-acknowledge {
  background: #ffffff;
  color: #ef4444;
}

.alert-banner-down .alert-btn-acknowledge {
  color: #b91c1c;
}

.alert-btn-acknowledge:hover {
  background: #f3f4f6;
  transform: translateY(-1px);
}

.alert-btn-report {
  background: #000b59;
  color: #ffffff;
}

.alert-btn-report:hover {
  background: #000947;
  transform: translateY(-1px);
}

.alert-btn-view {
  background: #000b59;
  color: #ffffff;
}

.alert-btn-view:hover {
  background: #000947;
  transform: translateY(-1px);
}

body.dark-mode .alert-btn-acknowledge {
  background: #f9fafb;
  color: #ef4444;
}

body.dark-mode .alert-btn-report {
  background: #1ca5ea;
  color: #ffffff;
}

body.dark-mode .alert-btn-report:hover {
  background: #1890c9;
}

body.dark-mode .alert-btn-view {
  background: #1ca5ea;
  color: #ffffff;
}

body.dark-mode .alert-btn-view:hover {
  background: #1890c9;
}

/* Auth Container */
.auth-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  background-color: var(--bg-color);
  z-index: 9999;
}

.auth-card {
  background: #000b59;
  padding: 2.5rem;
  border-radius: 8px;
  border: 1px solid #1ca5ea;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
  color: #ffffff;
}

/* Estilos específicos para el login */
.auth-card label {
  color: #ffffff;
}

.auth-card input {
  background-color: #ffffff;
  border: 1px solid #1ca5ea;
  border-radius: 8px;
  color: #000b59;
}

.auth-card input::placeholder {
  color: #94a3b8;
}

.auth-card button[type="submit"] {
  background-color: #1ca5ea;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 600;
}

.auth-card button[type="submit"]:hover {
  background-color: #1890c9;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.875rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(5, 23, 155, 0.1);
}

button {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

button:hover {
  background-color: var(--accent-hover);
}

/* Dashboard */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 1rem;
}

.nav-btn:hover {
  background: #000947 !important;
  opacity: 0.95;
}

/* Header principal de navegación */
.main-header {
  padding: 1.5rem 2rem !important;
  background-color: #000b59 !important;
  color: #ffffff !important;
  border-bottom: none !important;
  margin-bottom: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.main-header h2 {
  color: #ffffff !important;
  font-weight: 500;
}

.main-header span,
.main-header p {
  color: #ffffff !important;
}

.role-badge {
  background-color: rgba(5, 23, 155, 0.1);
  color: var(--accent-color);
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.logout-btn {
  background-color: transparent;
  border: 1px solid #1ca5ea;
  color: #ffffff;
  width: auto;
  padding: 0.5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logout-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: #ffffff;
}

/* Botón de estadísticas del monitor */
.stats-btn {
  background-color: #000b59 !important;
  border: none !important;
  color: #ffffff !important;
  width: auto;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.stats-btn:hover {
  opacity: 0.9;
}

body.dark-mode .stats-btn {
  background-color: #1ca5ea !important;
  color: #ffffff !important;
}

/* Botones de acción del monitor */
.monitor-action-btn {
  background-color: #000b59 !important;
  border: none !important;
  color: #ffffff !important;
  width: auto;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
  font-size: 0.875rem;
  font-weight: 500;
}

.monitor-action-btn:hover {
  opacity: 0.9;
}

body.dark-mode .monitor-action-btn {
  background-color: #1ca5ea !important;
  color: #ffffff !important;
}

/* Botón de eliminar del monitor */
.monitor-delete-btn {
  background-color: #ef4444 !important;
  border: none !important;
  color: #ffffff !important;
  width: auto;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
  font-size: 0.875rem;
  font-weight: 500;
}

.monitor-delete-btn:hover {
  opacity: 0.9;
}

/* Botones de selección de período (monitor stats) */
.period-btn {
  background-color: transparent !important;
  border: 1px solid #000b59 !important;
  color: #000b59 !important;
  width: auto;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.period-btn:hover {
  background-color: #000b59 !important;
  color: #ffffff !important;
}

.period-btn.active {
  background-color: #000b59 !important;
  color: #ffffff !important;
}

body.dark-mode .period-btn {
  border-color: #1ca5ea !important;
  color: #1ca5ea !important;
}

body.dark-mode .period-btn:hover {
  background-color: #1ca5ea !important;
  color: #ffffff !important;
}

body.dark-mode .period-btn.active {
  background-color: #1ca5ea !important;
  color: #ffffff !important;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 35px;
}

.dashboard-menu {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  width: 100%;
  margin: 0;
}

.orders-grid {
  width: 100%;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  border-color: #1ca5ea;
  padding: 1rem;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pending_approval {
  background: #fef3c7;
  color: #d97706;
}
.status-approved {
  background: #d1fae5;
  color: #059669;
}
.status-rejected {
  background: #fee2e2;
  color: #dc2626;
}
.status-completed {
  background: #dbeafe;
  color: #2563eb;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.card-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-approve {
  background-color: var(--success-color);
}
.btn-approve:hover {
  background-color: #059669;
}

.btn-reject {
  background-color: var(--danger-color);
}
.btn-reject:hover {
  background-color: #dc2626;
}

.btn-complete {
  background-color: var(--accent-color);
}

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 3rem;
  grid-column: 1 / -1;
  background: var(--empty-state-bg);
  border-radius: 8px;
  border: 1px dashed var(--border-color);
}

/* Modal/Form for New Order */
.new-order-section {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
}

.section-title {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #000b59;
}

.card-title {
  color: #000b59;
  font-weight: 600;
}

h1,
h2,
h3 {
  color: #000b59;
}

/* Chat Interface */
.chat-container {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.messages-list {
  height: auto;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  max-width: 85%;
  line-height: 1.5;
}

.message-own {
  align-self: flex-end;
  background-color: var(--accent-color);
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.message-other {
  align-self: flex-start;
  background-color: var(--message-other-bg);
  color: var(--text-primary);
  border-bottom-left-radius: 0.25rem;
}

.message-meta {
  font-size: 0.7rem;
  opacity: 0.8;
  margin-top: 0.25rem;
  display: block;
}

/* Webmaster Dashboard */

.dash-card {
  background: var(--card-bg);
  border: 1px solid #1ca5ea;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.dash-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-color);
  box-shadow: 0 10px 15px -3px rgba(5, 23, 155, 0.1);
}

.dash-card h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #000b59;
}

.dash-card p {
  color: var(--text-secondary);
}

.back-link {
  display: inline-flex;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.back-link:hover {
  color: var(--accent-color);
}

.main-header .back-link {
  color: #ffffff;
}

.main-header .back-link:hover {
  color: rgba(255, 255, 255, 0.8);
}

/* Footer */
.main-footer {
  text-align: center;
  padding: 2rem;
  color: #ffffff;
  background-color: #000b59;
  font-size: 0.875rem;
  border-top: none;
  margin-top: auto;
}

/* Attachments */
.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background-color: var(--attachment-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.attachment-link:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background-color: white;
}

/* Botones de navegación */
.nav-btn {
  text-decoration: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  background: #000b59 !important;
  color: #ffffff !important;
  font-size: 0.875rem;
  border: none !important;
  display: inline-block;
  transition:
    background-color 0.2s,
    opacity 0.2s;
  font-weight: 500;
}

.nav-btn:hover {
  background: #000947 !important;
  opacity: 0.95;
}

.nav-container {
  background: #1ca5ea;
  padding: 1rem 2rem;
  margin-bottom: 1.5rem;
  margin-left: -2rem;
  margin-right: -2rem;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Nav container para superadmin - pegado al header */
.superadmin-container .nav-container {
  margin-top: -3rem;
  margin-left: -3rem;
  margin-right: -3rem;
  margin-bottom: 1.5rem;
}

/* Nav container para approver - pegado al header */
.approver-container .nav-container {
  margin-top: -2rem;
  margin-left: -2rem;
  margin-right: -2rem;
  margin-bottom: 1.5rem;
}

/* Requester Action Buttons */
.requester-actions {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-action {
  width: auto;
  padding: 1rem 2rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-secondary {
  background-color: transparent;
  border: 2px solid var(--accent-color);
  color: var(--accent-color);
}

.btn-secondary:hover {
  background-color: rgba(5, 23, 155, 0.05);
  color: var(--accent-hover);
}

/* Dark Mode Toggle */
.theme-toggle {
  background-color: transparent;
  border: 1px solid #1ca5ea;
  color: #ffffff;
  width: auto;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: #ffffff;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
    margin: 1rem auto;
    margin-top: 0;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .logout-btn {
    position: static;
    width: 100%;
    text-align: center;
  }

  .requester-actions {
    flex-direction: column;
  }

  .btn-action {
    width: 100%;
  }

  /* Fix nav overlap on mobile */
  .superadmin-container .nav-container,
  .approver-container .nav-container {
    margin-top: 0 !important;
    margin-left: -1rem !important;
    margin-right: -1rem !important;
  }

  .nav-container {
    margin-left: -1rem !important;
    margin-right: -1rem !important;
  }

  /* Forzar TODAS las tarjetas a 1 por línea en móviles */
  .grid,
  .dashboard-menu,
  .orders-grid {
    grid-template-columns: 1fr !important;
  }

  .card,
  .dash-card {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* --- LEADS & MOBILE OPTIMIZATIONS --- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.filter-actions {
  display: flex;
  gap: 1rem;
}

@media (max-width: 768px) {
  /* Header Optimization */
  .header.main-header {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.5rem 1rem !important;
    gap: 0.5rem !important;
  }

  .main-header .user-info {
    flex: 1;
    min-width: 0;
    gap: 0.5rem !important;
    overflow: hidden;
  }

  .main-header h2 {
    font-size: 1rem !important;
    white-space: nowrap;
  }

  .main-header img {
    height: 28px !important;
  }

  #greeting-display {
    display: inline-block;
    max-width: unset; /* Allow full width */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.75rem !important; /* Slightly smaller to fit */
    flex: 1; /* Take available space */
  }

  /* Hide the greeting prefix 'Buen día' on very small screens if absolutely necessary, 
       but for now just fitting the name is priority. 
       Let's optimize the title space instead. */
  .main-header h2 {
    font-size: 0.9rem !important;
    white-space: nowrap;
    margin-right: 0.25rem;
  }

  /* Compact Buttons */
  .header .theme-toggle,
  .header .logout-btn {
    padding: 0.4rem !important;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .logout-text {
    display: none !important;
  }

  .logout-icon {
    display: block !important;
    width: 18px;
    height: 18px;
  }

  /* Leads Statistics - Mini Cards */
  .stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.5rem !important;
  }

  .stats-card {
    padding: 0.5rem !important;
  }

  .stats-card h3 {
    font-size: 1.25rem !important;
    margin-bottom: 0.25rem !important;
  }

  .stats-card p {
    font-size: 0.65rem !important;
    line-height: 1.1;
  }

  /* Leads Filters */
  .filter-actions {
    flex-wrap: wrap;
    gap: 0.5rem !important;
  }

  /* Filter & Clear buttons on top row */
  .filter-actions > *:nth-child(1),
  .filter-actions > *:nth-child(2) {
    flex: 1 1 45% !important;
    font-size: 0.8rem !important;
  }

  /* Export button on bottom row */
  .filter-actions > *:nth-child(3) {
    flex: 1 1 100% !important;
    margin-top: 0.25rem;
    order: 3;
  }
}

/* --- SUPERADMIN NAVIGATION --- */

/* Desktop Navigation */
.desktop-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 0 2rem;
  flex: 1;
  justify-content: center;
}

.nav-link,
.nav-dropbtn {
  color: #ffffff;
  background: transparent;
  border: none;
  font-size: 0.95rem;
  font-weight: 300;
  cursor: pointer;
  text-decoration: none;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-family: inherit;
  transition: opacity 0.2s;
}

.nav-link:hover,
.nav-dropbtn:hover {
  opacity: 0.8;
}

.nav-dropdown {
  position: relative;
  display: inline-block;
}

/* Bridge to prevent dropdown closing on gap */
.nav-dropdown::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 0;
  width: 100%;
  height: 15px;
}

.nav-dropdown-content {
  display: none;
  position: absolute;
  background-color: #000b59;
  min-width: 220px;
  box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
  z-index: 1000;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0;
  margin-top: 0.5rem;
}

/* Arrow indicator for dropdown */
.nav-dropdown-content::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 6px 6px 6px;
  border-style: solid;
  border-color: transparent transparent #000b59 transparent;
}

.nav-dropdown-content a {
  color: white;
  padding: 12px 20px;
  text-decoration: none;
  display: block;
  font-size: 0.9rem;
  transition: background-color 0.2s;
}

.nav-dropdown-content a:hover {
  background-color: #1ca5ea;
}

.nav-dropdown:hover .nav-dropdown-content {
  display: block;
}

/* Hamburger Menu Button */
.hamburger-btn {
  display: none;
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.4rem;
  align-items: center;
  justify-content: center;
}

.hamburger-btn svg {
  width: 24px;
  height: 24px;
}

/* Mobile Menu Overlay */
.mobile-menu {
  display: none;
  position: fixed;
  top: 70px; /* Adjust based on header height */
  left: 0;
  width: 100%;
  height: calc(100vh - 70px);
  background-color: #000b59;
  z-index: 9999;
  overflow-y: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideRight 0.3s ease-out;
}

@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.mobile-menu.active {
  display: block;
}

.mobile-menu-content {
  padding: 1.5rem 2rem;
}

.mobile-nav-link {
  display: block;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav-group {
  margin-top: 1.5rem;
}

.mobile-group-title {
  display: block;
  color: #1ca5ea;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.mobile-sub-link {
  display: block;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  padding: 0.75rem 0;
  padding-left: 1rem;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-sub-link:hover,
.mobile-nav-link:hover {
  color: #1ca5ea;
}

/* Responsive Navigation */
@media (max-width: 1024px) {
  .desktop-nav {
    display: none !important;
  }

  .hamburger-btn {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  .mobile-menu {
    top: 60px; /* Smaller header on mobile */
    height: calc(100vh - 60px);
  }
}

/* Dashboard New Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
}

.dashboard-panel {
  background: var(--card-bg);
  border: 1px solid #00a0de;
  border-radius: 8px;
  padding: 1.5rem;
  height: 100%;
}

.dashboard-panel h3 {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  color: #000b59;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  color: var(--text-secondary);
}

.stat-value {
  font-weight: 600;
  color: var(--text-primary);
}

.monitor-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.mini-stat-card {
  background: var(--bg-color);
  padding: 1rem;
  border-radius: 6px;
  text-align: center;
}

.mini-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.mini-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* New Layout with Top Header Navigation */
body {
  display: flex;
  flex-direction: column !important; /* Force column direction */
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--bg-color);
}

.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100% !important;
  margin-left: 0 !important;
  position: relative;
  background-color: var(--bg-color);
}

.container {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  margin-top: 1rem;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* New Top Header Styles */
.top-header {
  background-color: #000b59;
  background-image: linear-gradient(to right, #000b59, #05179b);
  color: white;
  padding: 0 2rem;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.top-header-left {
  display: flex;
  align-items: center;
  gap: 3rem; /* Space between logo and nav */
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.5px;
}

.brand-logo img {
  height: 36px;
  width: auto;
}

/* Main Navigation */
.main-nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  transition: all 0.2s;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link:hover,
.nav-link.active {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Dropdowns */
.nav-item-dropdown {
  position: relative;
  height: 70px; /* Match header height for hover area */
  display: flex;
  align-items: center;
}

.dropdown-menu {
  position: absolute;
  top: 60px; /* Below header */
  left: 0;
  background-color: #ffffff;
  min-width: 220px;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  display: none; /* Hidden by default */
  flex-direction: column;
  z-index: 1100;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  animation: fadeSlideDown 0.2s ease-out;
}

.nav-item-dropdown:hover .dropdown-menu {
  display: flex;
}

.dropdown-item {
  color: var(--text-primary);
  text-decoration: none;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  transition:
    background 0.2s,
    color 0.2s;
  font-weight: 500;
}

.dropdown-item:hover {
  background-color: #f3f4f6;
  color: var(--accent-color);
}

body.dark-mode .dropdown-menu {
  background-color: #1e293b;
  border-color: #334155;
}

body.dark-mode .dropdown-item {
  color: #e2e8f0;
}

body.dark-mode .dropdown-item:hover {
  background-color: #334155;
  color: #38bdf8;
}

@keyframes fadeSlideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.top-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.top-header-welcome {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
}

.top-header-welcome strong {
  color: #ffffff;
  font-weight: 600;
}

/* Simplified Header Buttons */
.top-header-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.top-header-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Alerts container styling */
#alerts-container {
  width: 100%;
  margin-bottom: 1rem;
}

@media (max-width: 1100px) {
  .top-header-left {
    gap: 1.5rem;
  }
  .brand-logo span {
    display: none; /* Hide brand name on smaller screens to save space */
  }
}

@media (max-width: 768px) {
  .top-header {
    padding: 0 1rem;
    height: auto;
    flex-wrap: wrap;
    padding-bottom: 0.5rem;
  }
  .top-header-left {
    width: 100%;
    justify-content: space-between;
    margin-bottom: 0.5rem;
  }
  .top-header-right {
    margin-left: auto;
  }
  .main-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    justify-content: flex-start;
  }
  .nav-link {
    white-space: nowrap;
  }
}
/* Custom Multiselect Styling to Match Filters */
.custom-multiselect {
  position: relative;
  font-family: inherit;
}

#multiselect-trigger {
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  user-select: none;
}

#multiselect-trigger:hover {
  border-color: var(
    --accent-hover
  ); /* Slightly darker on hover if desired, or keep standard */
}

.custom-multiselect.active #multiselect-trigger {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(5, 23, 155, 0.1);
}

#multiselect-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem; /* Match select font size usually */
}

#multiselect-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 50;
  max-height: 250px;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#multiselect-options label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s;
  margin: 0;
  font-weight: normal;
  font-size: 0.875rem;
  color: var(--text-primary);
}

#multiselect-options label:hover {
  background-color: var(--border-color); /* Light gray hover */
}

#multiselect-options input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent-color);
  cursor: pointer;
}
