/* Dark theme overrides (toggled from index-light.html) */
body.theme-dark {
  --bg: #05060a;
  --panel-bg: rgba(17, 18, 24, 0.92);
  --panel-bg-soft: rgba(23, 25, 35, 0.88);
  --panel-bg-soft2: #191b26;
  --icon-accent: #023ccd;
  --icon-arrow: #c90101;
  --primary: #60a5fa;
  --primary-soft: rgba(96, 165, 250, 0.22);
  --accent: #f5c86a;
  --accent-soft: rgba(245, 200, 106, 0.25);
  --text-main: #f5f7ff;
  --text-muted: #696d7a;
  --border-soft: rgb(140 140 140 / 12%);
  --shadow-soft: 0 18px 35px rgba(0, 0, 0, 0.75);
  --card-blur: 12px;
}

body.theme-dark,
body.theme-dark html {
  background-color: #000;
  color: var(--text-main);
}

body.theme-dark::before {
  background-image: url("images/img-kemendagri-dark.webp");
  opacity: 1;
  transform: none;
  background-position: top left;
  background-size: cover;
}

body.theme-dark .bg-parallax {
  background-image: url("images/img-kemendagri-dark.webp");
  background-position: top left;
  opacity: 1;
  transform: none;
  filter: grayscale(1);
}

body.theme-dark .bg-parallax.is-color {
  filter: none;
}

body.theme-dark .dash-wrapper {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  color: var(--text-main);
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body.theme-dark .top-bar {
  color: var(--text-muted);
}

body.theme-dark .icon-small {
  border-color: rgba(255, 255, 255, 0.18);
  color: #d3daea;
  background: rgba(10, 12, 20, 0.9);
}

body.theme-dark .icon-small.active {
  background: rgba(2, 60, 205, 0.22);
  border-color: var(--icon-accent);
  color: var(--icon-accent);
}

body.theme-dark .mode-card {
  background: transparent;
  background: rgb(24 24 24 / 30%);
  border: 1px solid var(--border-soft);
  -webkit-backdrop-filter: blur(var(--card-blur));
  backdrop-filter: blur(var(--card-blur));
  box-shadow: var(--shadow-soft);
  transform-origin: center center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  isolation: isolate;
}

@keyframes mode-card-map-pan-dark {
  0% {
    background-position: 0% center;
  }
  50% {
    background-position: 100% center;
  }
  100% {
    background-position: 0% center;
  }
}

body.theme-dark .mode-card::before {
  background-image: url("images/img-map.png");
  transform: scaleX(1);
  opacity: 0.3;
  background-repeat: no-repeat;
  background-size: auto 100%;
  background-position: 0% center;
  animation: mode-card-map-pan-dark 80s ease-in-out infinite;
  border-radius: inherit;
  z-index: -1;
}

body.theme-dark .mode-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(
    ellipse 100% 100% at 0% 0%,
    rgba(182, 1, 1, 0.35) 0%,
    rgba(116, 1, 1, 0.2) 30%,
    rgba(34, 16, 23, 0.15) 55%,
    transparent 85%
  );
  opacity: 0.85;
}

body.theme-dark .mode-card .mode-label,
body.theme-dark .mode-card .mode-profile-position,
body.theme-dark .mode-card .weather-feel,
body.theme-dark .mode-card .weather-minmax {
  color: var(--text-muted);
}

body.theme-dark .mode-card .mode-header-date {
  color: #c90101;
}

body.theme-dark .mode-card .mode-value,
body.theme-dark .mode-card .weather-desc {
  color: var(--text-main);
}

body.theme-dark .mode-card .weather-main .weather-temp,
body.theme-dark .mode-card .weather-main .weather-deg {
  color: var(--icon-accent);
}

body.theme-dark .mode-card .weather-icon,
body.theme-dark .mode-card .weather-icon i {
  color: #ffffff;
}

body.theme-dark .mode-card .mode-foot span i {
  color: #ffffff;
}

body.theme-dark .mode-profile-avatar {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

body.theme-dark .mode-card .pill {
  border-color: var(--border-soft);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

body.theme-dark .mode-card .pill.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

body.theme-dark .mode-card .mode-foot {
  color: var(--text-muted);
}

body.theme-dark .mode-card .mode-foot span {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-soft);
  color: var(--text-main);
}

body.theme-dark .tile {
  border-color: var(--border-soft);
  -webkit-backdrop-filter: blur(var(--card-blur));
  backdrop-filter: blur(var(--card-blur));
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.7);
  background: rgba(17, 18, 24, 0.78);
  transform-origin: center center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.theme-dark .tile.subtle {
  background: rgb(24 24 24 / 30%);
}

body.theme-dark .tile-main,
body.theme-dark .map-value {
  color: #ffffff;
}

body.theme-dark .tile-icon {
  color: var(--text-muted);
}

body.theme-dark .weather-minmax .up i,
body.theme-dark .weather-minmax .down i {
  color: var(--icon-arrow);
}

body.theme-dark .tile .tile-icon i.ri-arrow-right-line,
body.theme-dark .tile:hover .tile-icon i.ri-arrow-right-line,
body.theme-dark .title-subtitle .tile-icon i.ri-arrow-right-line {
  color: var(--icon-arrow) !important;
}

body.theme-dark .tile-svg-icon i,
body.theme-dark .map .tile-svg-icon i,
body.theme-dark .map-label .tile-svg-icon i,
body.theme-dark .map-stat-icon {
  /* color: var(--icon-accent); */
  color: #818698;
}

body.theme-dark .tile:hover .tile-svg-icon i,
body.theme-dark .map:hover .tile-svg-icon i,
body.theme-dark .map:hover .map-label .tile-svg-icon i {
  color: var(--icon-arrow);
}

body.theme-dark .tile:hover .tile-icon i:not(.ri-arrow-right-line),
body.theme-dark .mode-card:hover .weather-icon,
body.theme-dark .mode-card:hover .weather-icon i,
body.theme-dark .map:hover .map-stat-icon {
  color: var(--icon-accent);
}

body.theme-dark .mode-card:hover .mode-foot span i {
  color: #ffffff;
}

body.theme-dark .main,
body.theme-dark .left-col,
body.theme-dark .mid-col,
body.theme-dark .right-col,
body.theme-dark .left-grid,
body.theme-dark .mid-stack,
body.theme-dark .right-grid {
  overflow: visible;
}

body.theme-dark .tile:hover,
body.theme-dark .mode-card:hover,
body.theme-dark .map:hover {
  transform: scale(1.05);
  overflow: visible;
  position: relative;
  z-index: 2;
  box-shadow: 0 0 28px rgba(2, 60, 205, 0.42);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.theme-dark .announcement-card:hover {
  transform: scale(1.05);
  overflow: hidden;
  position: relative;
  z-index: 2;
  border-radius: var(--radius-md);
  box-shadow: 0 0 28px rgba(2, 60, 205, 0.42);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.theme-dark .mode-card:hover {
  overflow: hidden;
}

body.theme-dark .left-col,
body.theme-dark .mid-col {
  grid-template-rows: minmax(0, 1.4fr) minmax(0, 1.6fr);
}

body.theme-dark .mid-col-spacer {
  min-height: 0;
}

body.theme-dark .mid-stack {
  justify-content: flex-end;
  gap: 12px;
  min-height: 0;
  height: 100%;
}

body.theme-dark .mid-stack > .tile {
  flex: 0 0 auto;
  align-self: start;
  width: calc((100% - 12px) / 2);
  height: calc((100% - 12px) / 2);
  min-height: 0;
  box-sizing: border-box;
}

body.theme-dark .mid-stack > .map {
  flex: 0 0 auto;
  width: 100%;
  height: calc((100% - 12px) / 2);
  min-height: 0;
  align-self: stretch;
  box-sizing: border-box;
}

body.theme-dark .left-grid {
  grid-template-rows: 1fr 1fr;
  min-height: 0;
}

body.theme-dark .left-grid .tile.tile-span-2 {
  height: 100%;
  min-height: 0;
}

body.theme-dark .map {
  background: rgb(24 24 24 / 30%);
  -webkit-backdrop-filter: blur(var(--card-blur));
  backdrop-filter: blur(var(--card-blur));
  box-shadow: 0 22px 38px rgba(0, 0, 0, 0.9);
  border: 1px solid var(--border-soft);
  transform-origin: center center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.theme-dark .text-sabar {
  color: var(--text-muted);
}

body.theme-dark #trainMap {
  min-height: 0;
  flex: 1;
}

body.theme-dark .map-slider-track {
  background: rgba(255, 255, 255, 0.08);
}

body.theme-dark .right-col {
  display: grid;
  grid-template-rows: 1.4fr 1.6fr;
  gap: 18px;
  min-height: 0;
  background: none;
  background-image: none;
  border: none;
  padding: 0;
  overflow: visible;
  justify-content: stretch;
  box-shadow: none;
  transform: none;
  transition: none;
}

body.theme-dark .right-col:hover {
  transform: none;
  box-shadow: none;
  transition: none;
}

body.theme-dark .right-grid {
  gap: 12px;
  min-height: 0;
  overflow: visible;
  isolation: isolate;
}

body.theme-dark .right-grid > .tile {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  justify-self: stretch;
  z-index: 0;
  background: rgb(24 24 24 / 30%);
}

body.theme-dark .right-grid > .tile:hover {
  transform: scale(1.05);
  z-index: 3;
  overflow: visible;
  box-shadow: 0 0 28px rgba(2, 60, 205, 0.42);
}

body.theme-dark .announcement-card {
  --overlay-bottom-start: 60%;
  position: relative;
  min-height: 0;
  border-radius: var(--radius-md);
  background-image: var(--announcement-bg, url("images/berita-1.webp"));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 0;
  box-shadow: 0 22px 38px rgba(0, 0, 0, 0.85);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  transform-origin: center center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.theme-dark .announcement-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    180deg,
    rgba(5, 6, 10, 0) 0%,
    rgba(5, 6, 10, 0.35) var(--overlay-bottom-start),
    rgba(5, 6, 10, 0.82) calc(var(--overlay-bottom-start) + 20%),
    rgba(5, 6, 10, 0.96) 100%
  );
  pointer-events: none;
  z-index: 0;
}

body.theme-dark .announcement-card .right-badge {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 1;
}

body.theme-dark .announcement-card .right-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
}

body.theme-dark .announcement-card .announcement-slider {
  min-height: unset;
}

body.theme-dark .announcement-card .tile-main,
body.theme-dark .announcement-card .caption-label {
  color: var(--text-main);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

body.theme-dark .announcement-card .caption-date {
  color: var(--primary);
  text-shadow: none;
}

body.theme-dark .announcement-card .title-pengumuman {
  display: block;
  color: #ffffff;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  line-height: 20px;
  cursor: pointer;
  transition: color 0.2s ease;
}

body.theme-dark .announcement-card .title-pengumuman:hover {
  color: #fca5a5;
}

body.theme-dark .announcement-card .announcement-dots .dot {
  background: rgba(255, 255, 255, 0.25);
}

body.theme-dark .announcement-card .announcement-dots .dot.active {
  background: var(--icon-arrow);
}

body.theme-dark .bottom-left-text .bottom-left-brand {
  color: #ffffff;
}

body.theme-dark .bottom-right-text .brand {
  color: var(--text-main);
}

body.theme-dark .temp-pill {
  background: rgba(17, 18, 24, 0.9);
  border-color: var(--border-soft);
  color: var(--text-main);
}

body.theme-dark .station-tooltip-inner {
  background-color: #111218;
  border-color: var(--border-soft);
  color: var(--text-main);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.85);
}

body.theme-dark .device-guard-overlay {
  background: rgba(5, 6, 10, 0.78);
}

body.theme-dark .device-guard-content {
  color: var(--text-main);
  border-color: var(--border-soft);
  background: #111218;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
}

body.theme-dark .device-guard-message {
  color: var(--text-muted);
}

@media screen and (max-width: 1180px) {
  body.theme-dark #trainMap {
    min-height: 0;
  }

  body.theme-dark .right-col {
    gap: 12px;
  }

  body.theme-dark .announcement-card {
    padding: 10px 14px;
  }

  body.theme-dark .announcement-card .right-badge {
    top: 10px;
    left: 14px;
    right: 14px;
  }
}
