/* ========= Dashboard ========= */
body {
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  margin: 0;
}

.dash-body {
  min-height: 100vh;
  background: radial-gradient(circle at 15% 20%, rgba(0, 102, 255, 0.15), transparent 55%),
              radial-gradient(circle at 85% 15%, rgba(0, 245, 255, 0.12), transparent 45%),
              #04070f;
  color: #e7eefc;
  position: relative;
  overflow-x: hidden;
}

.background-accent {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 20% 80%, rgba(0, 245, 255, 0.18), transparent 55%),
              radial-gradient(ellipse at 90% 50%, rgba(0, 102, 255, 0.25), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.dash-header {
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(14px);
  background: linear-gradient(135deg, rgba(0, 35, 78, 0.85), rgba(0, 15, 35, 0.65));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.8rem clamp(1.5rem, 3vw, 3rem);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.dash-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0 0 0.3rem;
  color: rgba(231, 238, 252, 0.65);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.85rem;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(10, 17, 30, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-weight: 600;
  color: #d4e5ff;
}

.dash-main {
  position: relative;
  z-index: 1;
  padding: clamp(1.5rem, 3vw, 3rem);
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

.card {
  background: linear-gradient(145deg, rgba(9, 14, 28, 0.88), rgba(5, 9, 18, 0.94));
  border-radius: 20px;
  padding: clamp(1.25rem, 3vw, 1.8rem);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 22px 45px rgba(0, 9, 30, 0.45);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at top right, rgba(0, 245, 255, 0.12), transparent 55%);
  pointer-events: none;
}

.map-card {
  min-height: 420px;
}

.section-title h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
}

.section-title p {
  margin: 0.35rem 0 1.4rem;
  font-size: 0.95rem;
  color: rgba(231, 238, 252, 0.6);
}

#map {
  width: 100%;
  height: clamp(320px, 45vh, 520px);
  border-radius: 16px;
  overflow: hidden;
  filter: saturate(1.05) contrast(1.03);
  box-shadow: inset 0 0 0 1px rgba(0, 245, 255, 0.08);
}

.events-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(1.4rem, 3vw, 2rem);
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(7, 12, 24, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: rgba(231, 238, 252, 0.75);
  font-size: 0.9rem;
}

event-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 420px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 14px;
}

.event-row {
  background: rgba(255,255,255,0.05);
  padding: 6px 8px;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.event-row:hover {
  background: rgba(255,255,255,0.12);
}

.delete-icon {
  color: #ff6666;
  cursor: pointer;
  font-size: 16px;
  margin-left: 10px;
}

.delete-icon:hover {
  color: #ff0000;
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.toolbar input[type="datetime-local"] {
  background: rgba(4, 10, 22, 0.9);
  border: 1px solid rgba(0, 245, 255, 0.25);
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  color: #e7eefc;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.toolbar input[type="datetime-local"]:focus {
  border-color: rgba(0, 245, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(0, 245, 255, 0.18);
}

.toolbar button {
  margin-left: auto;
  background: linear-gradient(135deg, #00f5ff, #0066ff);
  border: none;
  color: #03111f;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 12px 25px rgba(0, 102, 255, 0.35);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.toolbar button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(0, 102, 255, 0.5);
}

.toolbar button:active {
  transform: translateY(0);
}

.select-wrapper {
  position: relative;
  border-radius: 16px;
  background: rgba(3, 7, 16, 0.9);
  border: 1px solid rgba(0, 245, 255, 0.08);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#eventSelect {
  width: 100%;
  height: clamp(260px, 32vh, 420px);
  background: transparent;
  border: none;
  color: #e7eefc;
  padding: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.4;
  scrollbar-width: thin;
}

#eventSelect option {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
}

#eventSelect option:checked {
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.22), rgba(0, 102, 255, 0.22));
}

.detail-panel h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

#eventMeta {
  margin: 0;
  background: rgba(4, 9, 18, 0.9);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1rem 1.2rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(231, 238, 252, 0.82);
  white-space: pre-wrap;
  box-shadow: inset 0 0 0 1px rgba(0, 245, 255, 0.05);
}

.event-image {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.image-frame {
  flex: 1;
  display: grid;
  place-items: center;
  background: rgba(3, 8, 18, 0.85);
  border-radius: 18px;
  border: 1px solid rgba(0, 245, 255, 0.08);
  padding: 1rem;
  min-height: clamp(260px, 32vh, 420px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.event-image img {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(0, 245, 255, 0.15);
  box-shadow: 0 18px 35px rgba(0, 12, 35, 0.55);
  background: #02060f;
}

.leaflet-container {
  font-family: 'Manrope', 'Segoe UI', sans-serif;
}

.leaflet-marker-icon.marker-green {
  filter: hue-rotate(60deg) saturate(8) brightness(1.8);
}

/* statut sync */
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  background: #9aa2b8;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
}

.dot.on {
  background: #00f5ff;
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.9);
}

.dot.off {
  background: #f5475c;
  box-shadow: 0 0 16px rgba(245, 71, 92, 0.7);
}

/* ========= Portal ========= */
.portal-body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 15% 20%, rgba(0, 102, 255, 0.18), transparent 55%),
              radial-gradient(circle at 85% 15%, rgba(0, 245, 255, 0.16), transparent 45%),
              #04070f;
  color: #e7eefc;
  font-family: 'Manrope', 'Segoe UI', sans-serif;
}

.portal-wrapper {
  position: relative;
  z-index: 1;
  width: min(1024px, 92vw);
  display: grid;
  gap: clamp(2rem, 5vw, 3rem);
}

.portal-hero h1 {
  margin: 0.4rem 0 0.8rem;
  font-size: clamp(2.2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.portal-description {
  margin: 0;
  max-width: 60ch;
  color: rgba(231, 238, 252, 0.7);
  font-size: clamp(1rem, 2.3vw, 1.15rem);
  line-height: 1.6;
}

.portal-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1.5rem, 3vw, 2.2rem);
}

.portal-card {
  position: relative;
  display: flex;
  gap: 1.4rem;
  align-items: flex-start;
  padding: clamp(1.8rem, 3vw, 2.4rem);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(7, 12, 24, 0.92), rgba(4, 8, 18, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 30px 55px rgba(0, 10, 35, 0.55);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.portal-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at top right, rgba(0, 245, 255, 0.16), transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.portal-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 40px 75px rgba(0, 15, 45, 0.6);
  border-color: rgba(0, 245, 255, 0.3);
}

.portal-card:hover::after {
  opacity: 1;
}

.portal-icon {
  font-size: clamp(2.2rem, 4vw, 2.8rem);
  filter: drop-shadow(0 12px 18px rgba(0, 245, 255, 0.35));
}

.portal-content h2 {
  margin: 0 0 0.6rem;
  font-size: 1.5rem;
}

.portal-content p {
  margin: 0 0 1.1rem;
  color: rgba(231, 238, 252, 0.7);
  line-height: 1.6;
}

.portal-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  color: #00f5ff;
  letter-spacing: 0.04em;
}

.portal-cta::after {
  content: "→";
  font-size: 1.1em;
  transition: transform 0.2s ease;
}

.portal-card:hover .portal-cta::after {
  transform: translateX(4px);
}

/* ========= Login page ========= */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  margin: 0;
  background: radial-gradient(circle, rgba(0, 245, 255, 0.2), transparent 55%), #04070f;
  color: #e7eefc;
  font-family: 'Manrope', 'Segoe UI', sans-serif;
}

.login-container {
  background: linear-gradient(145deg, rgba(6, 12, 24, 0.95), rgba(4, 8, 18, 0.95));
  padding: 2.5rem 2.2rem;
  border-radius: 22px;
  box-shadow: 0 25px 45px rgba(0, 10, 40, 0.55);
  width: min(360px, 90vw);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.login-container h1 {
  margin: 0 0 1.5rem;
  color: #00f5ff;
  font-size: 1.8rem;
  text-align: center;
}

.login-container input {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  margin: 0.7rem 0;
  border: none;
  border-radius: 12px;
  background: rgba(3, 8, 18, 0.85);
  color: #e7eefc;
  font-size: 0.95rem;
  box-shadow: inset 0 0 0 1px rgba(0, 245, 255, 0.08);
}

.login-container button {
  width: 100%;
  background: linear-gradient(135deg, #00f5ff, #0066ff);
  color: #03111f;
  border: none;
  padding: 0.85rem 1rem;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  margin-top: 1rem;
  letter-spacing: 0.05em;
  box-shadow: 0 18px 35px rgba(0, 102, 255, 0.35);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.login-container button:hover {
  transform: translateY(-1px);
  box-shadow: 0 25px 40px rgba(0, 102, 255, 0.45);
}

.login-container button:active {
  transform: translateY(0);
}

/* ========= Responsive ========= */
@media (max-width: 1100px) {
  .events-grid {
    grid-template-columns: 1fr;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-status {
    align-self: flex-start;
  }
}

@media (max-width: 768px) {
  .portal-wrapper {
    text-align: center;
  }

  .portal-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .portal-content p {
    margin-bottom: 1.4rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar label {
    justify-content: space-between;
  }

  .toolbar button {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 540px) {
  .portal-body {
    padding: 2.4rem 0;
  }

  .portal-wrapper {
    gap: 2rem;
  }

  .dash-header {
    padding: 1.4rem 1.2rem;
  }

  .dash-main {
    padding: 1.4rem 1.2rem 2.2rem;
  }
}
