﻿:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #1b1b1b;
  --muted: #5f6368;
  --primary: #007a3d;
  --alert: #e53935;
  --alert-glow: rgba(229, 57, 53, 0.45);
  --card: #f4f6f2;
  --border: #e1e4df;
  --shadow: 0 14px 30px rgba(10, 24, 14, 0.08);
  --danger: #c62828;
  --success: #00897b;
  --warning: #f4b400;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0b;
  --text: #f3f3f3;
  --muted: #b7b7b7;
  --primary: #c62828;
  --alert: #ff5252;
  --alert-glow: rgba(255, 82, 82, 0.55);
  --card: #141414;
  --border: #262626;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Cairo", "Tajawal", sans-serif;
  background: radial-gradient(1200px 480px at 90% -10%, rgba(0, 122, 61, 0.12), transparent 60%),
    radial-gradient(800px 400px at -10% 20%, rgba(244, 180, 0, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.25s ease, color 0.25s ease;
}

:root[data-theme="dark"] body {
  background: radial-gradient(900px 460px at 90% -10%, rgba(198, 40, 40, 0.18), transparent 60%),
    radial-gradient(800px 400px at -20% 30%, rgba(30, 136, 229, 0.14), transparent 60%),
    var(--bg);
}

a {
  color: inherit;
}

button,
input {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

.noscript {
  padding: 16px;
  background: #fff3cd;
  color: #5f3700;
  text-align: center;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 120px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0 8px;
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 55px;
  height: 55px;
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
}

.icon-btn.active {
  border-color: var(--primary);
  color: var(--primary);
}

.icon {
  font-size: 16px;
}

.icon-label {
  font-size: 12px;
}

.hero {
  display: grid;
  gap: 8px;
  margin: 10px 0 18px;
}

.hero h1 {
  margin: 0;
  font-size: 28px;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.status {
  align-self: flex-start;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 122, 61, 0.1);
  color: var(--primary);
  font-size: 12px;
  border: 1px solid rgba(0, 122, 61, 0.2);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.auth {
  margin-bottom: 16px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

.tab-btn.active {
  background: rgba(0, 122, 61, 0.12);
  border-color: rgba(0, 122, 61, 0.22);
  color: var(--primary);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.auth-form input {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px;
  background: #fff;
}

:root[data-theme="dark"] .auth-form input {
  background: #1f1f1f;
  color: var(--text);
}

.auth-hint {
  font-size: 12px;
  color: var(--muted);
}

.user {
  margin-bottom: 18px;
}

.user-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.user-title {
  font-weight: 700;
}

.user-email {
  font-size: 12px;
  color: var(--muted);
}

.primary-btn {
  background: var(--primary);
  border: none;
  color: #fff;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ghost-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
}

.lines {
  display: grid;
  gap: 16px;
}

.feedback-card {
  margin: 18px auto 40px;
  display: grid;
  gap: 12px;
  text-align: right;
}

.feedback-text {
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}

.fb-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1877f2;
  color: #fff;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  width: fit-content;
}

.fb-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-family: "Arial", sans-serif;
}

.map-card {
  margin: 8px 0 18px;
  display: grid;
  gap: 10px;
}

.map-title {
  font-weight: 700;
  font-size: 16px;
}

.map-hint {
  font-size: 12px;
  color: var(--muted);
}

.leaflet-map {
  width: 100%;
  height: 360px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.map-shell {
  position: relative;
}

.map-switch {
  position: absolute;
  inset-inline-start: 12px;
  top: 12px;
  display: flex;
  gap: 6px;
  z-index: 1200;
  flex-wrap: wrap;
}

.map-switch button {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  border-radius: 10px;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.map-switch button.active {
  border-color: var(--primary);
  color: var(--primary);
}

:root[data-theme="dark"] .map-switch button {
  background: rgba(15, 15, 15, 0.9);
}

.leaflet-container {
  font-family: "Cairo", "Tajawal", sans-serif;
  background: #f4f6f2;
  direction: ltr;
}

:root[data-theme="dark"] .leaflet-container {
  background: #050505;
}

.leaflet-control-zoom a {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 32px;
  height: 32px;
  line-height: 30px;
}

.leaflet-control-zoom a:hover {
  background: rgba(0, 0, 0, 0.04);
}

:root[data-theme="dark"] .leaflet-control-zoom a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.leaflet-control-attribution {
  font-size: 10px;
  color: var(--muted);
}

.line-card {
  background: var(--card);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 14px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: rise 0.4s ease both;
}

.line-card.is-collapsed {
  padding-bottom: 8px;
}

.line-card.is-collapsed .line-header {
  margin-bottom: 0;
}

.line-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  text-align: right;
  cursor: pointer;
  padding: 0;
}

.line-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.line-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}

.line-name {
  font-weight: 700;
}

.line-sub {
  font-size: 12px;
  color: var(--muted);
}

.line-summary {
  display: grid;
  gap: 6px;
  font-size: 12px;
}

.line-body {
  display: grid;
  gap: 12px;
}

.line-card.is-collapsed .line-body {
  display: none;
}

.line-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.line-action .action-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.line-header:hover .action-arrow {
  transform: translateX(-2px);
}

.summary-item {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
}

:root[data-theme="dark"] .summary-item {
  background: rgba(24, 24, 24, 0.8);
}

.summary-item strong {
  color: var(--text);
}

.line-map {
  position: relative;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04), transparent 60%);
  padding: 10px 0;
  overflow: hidden;
  touch-action: none;
}

.map-svg {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  font-family: "Cairo", "Tajawal", sans-serif;
}

.map-svg.is-abstract {
  filter: contrast(1.06) saturate(0.92);
}

.map-root {
  transform-origin: 0 0;
}

.line-path {
  fill: none;
  stroke: var(--line-color, var(--primary));
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.line-ticks {
  fill: none;
  stroke: var(--line-color, var(--primary));
  stroke-width: 0.8;
  stroke-linecap: round;
  stroke-dasharray: 2 4;
  opacity: 0.35;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.metro-line {
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.12));
}

.metro-station-dot {
  transition: filter 0.2s ease, opacity 0.2s ease;
}

.metro-station-hit {
  cursor: pointer;
}

.metro-station-dot.is-seen {
  filter: drop-shadow(0 0 10px currentColor);
}

.metro-station-dot.is-selected {
  filter: drop-shadow(0 0 12px var(--primary));
}

.metro-station-pulse,
.metro-station-select {
  opacity: 0;
  transform-origin: center;
  transform-box: fill-box;
}

.metro-station-pulse.is-seen {
  opacity: 0.9;
  animation: mapPulse 1.4s ease-out infinite;
  filter: drop-shadow(0 0 10px currentColor);
}

.metro-station-select.is-selected {
  opacity: 0.85;
  animation: selectPulse 1.6s ease-out infinite;
  filter: drop-shadow(0 0 10px var(--primary));
}

.metro-station-label {
  color: var(--text);
  font-weight: 600;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  direction: rtl;
  unicode-bidi: plaintext;
  pointer-events: none;
}

.metro-station-label span {
  font-size: var(--label-size, 12px);
}

.metro-station-label.is-disabled {
  opacity: 0.4;
}

.metro-station-label.is-seen span {
  color: var(--alert);
  font-weight: 700;
}

.metro-station-label.is-stopped span {
  color: var(--danger);
  font-weight: 700;
}

.metro-station-label.is-broken span {
  color: var(--warning);
  font-weight: 700;
}

.metro-station-label.is-selected span {
  color: var(--primary);
}

.metro-direction-label {
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  direction: rtl;
  unicode-bidi: plaintext;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.metro-direction-label .dir-text {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: var(--dir-size, 11px);
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.metro-direction-label.is-stopped .dir-text {
  background: rgba(198, 40, 40, 0.22);
  color: #fff;
  border: 1px solid rgba(198, 40, 40, 0.5);
}

.metro-direction-label.is-broken .dir-text {
  background: rgba(244, 180, 0, 0.22);
  color: #2b2000;
  border: 1px solid rgba(244, 180, 0, 0.5);
}

.metro-direction-label.is-visible {
  opacity: 1;
}

:root[data-theme="dark"] .metro-direction-label .dir-text {
  background: rgba(255, 255, 255, 0.12);
}

:root[data-theme="dark"] .metro-direction-label.is-stopped .dir-text {
  background: rgba(255, 82, 82, 0.2);
  color: #fff;
  border-color: rgba(255, 82, 82, 0.4);
}

:root[data-theme="dark"] .metro-direction-label.is-broken .dir-text {
  background: rgba(244, 180, 0, 0.2);
  color: #fff7db;
  border-color: rgba(244, 180, 0, 0.4);
}

.metro-direction-label .dir-badge-icon {
  width: 16px;
  height: 16px;
  margin-inline-start: 6px;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.metro-direction-label.is-stopped .dir-badge-icon {
  opacity: 1;
  transform: scale(1);
  color: var(--danger);
}

.metro-direction-label.is-broken .dir-badge-icon {
  opacity: 1;
  transform: scale(1);
  color: var(--warning);
}

.metro-edit-handle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--warning);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 8px rgba(244, 180, 0, 0.45);
}

.metro-edit-handle span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.station-node {
  cursor: pointer;
}

.station-node.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.station-hit {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

.station-core {
  fill: var(--line-color, var(--primary));
  transition: fill 0.2s ease;
  pointer-events: none;
}

.station-alert {
  fill: none;
  stroke: var(--alert);
  opacity: 0;
  transform-origin: center;
  transform-box: fill-box;
  pointer-events: none;
}

.station-select {
  fill: none;
  stroke: var(--line-color, var(--primary));
  opacity: 0;
  transform-origin: center;
  transform-box: fill-box;
  pointer-events: none;
}

.station-node.is-seen .station-alert {
  opacity: 0.9;
  animation: alertPulse 1.1s ease-out infinite;
  filter: drop-shadow(0 0 8px var(--alert-glow));
}

.station-node.is-seen .station-core {
  fill: var(--alert);
  filter: drop-shadow(0 0 10px var(--alert-glow));
}

.station-label {
  fill: var(--text);
  font-size: 4.2px;
  opacity: 1;
  transition: opacity 0.2s ease, fill 0.2s ease;
  pointer-events: none;
  direction: rtl;
  unicode-bidi: plaintext;
  font-weight: 600;
}

.station-label.secondary {
  fill: var(--muted);
  font-weight: 500;
  opacity: 0;
}

.station-node.is-seen .station-label {
  fill: var(--alert);
  font-weight: 700;
}

.station-node.is-selected .station-select {
  opacity: 0.85;
  animation: selectPulse 1.6s ease-out infinite;
}

.station-node.is-selected .station-core {
  stroke: var(--line-color, var(--primary));
  stroke-width: 0.6;
  filter: drop-shadow(0 0 6px var(--station-glow));
}



.map-controls {
  position: absolute;
  inset-inline-start: 12px;
  top: 12px;
  display: grid;
  gap: 6px;
  z-index: 5;
}

.map-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
}

:root[data-theme="dark"] .map-btn {
  background: rgba(20, 20, 20, 0.9);
}

.report-sheet {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 14px 16px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  display: grid;
  gap: 12px;
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.report-title {
  font-weight: 700;
}

.report-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.report-directions {
  display: grid;
  gap: 8px;
}

.report-status {
  display: grid;
  gap: 8px;
}

.report-status-title {
  font-size: 12px;
  color: var(--muted);
}

.report-status-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

.status-btn.active {
  border-color: var(--primary);
  background: rgba(0, 122, 61, 0.12);
  color: var(--primary);
}

.status-btn[data-status='stopped'].active {
  border-color: var(--danger);
  background: rgba(198, 40, 40, 0.16);
  color: var(--danger);
}

.status-btn[data-status='broken'].active {
  border-color: var(--warning);
  background: rgba(244, 180, 0, 0.16);
  color: var(--warning);
}

.dir-btn {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  background: transparent;
  cursor: pointer;
  text-align: right;
}

.dir-btn.active {
  border-color: var(--primary);
  background: rgba(0, 122, 61, 0.12);
  color: var(--primary);
}

.dir-btn .fr {
  font-size: 11px;
  color: var(--muted);
}

.dir-btn.active .fr {
  color: var(--primary);
}

.report-hint {
  font-size: 12px;
  color: var(--muted);
}

.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: 100px;
  background: var(--text);
  color: var(--bg);
  padding: 12px 16px;
  border-radius: 14px;
  text-align: center;
  box-shadow: var(--shadow);
  z-index: 2200;
}

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

@keyframes pulse {
  0% {
    transform: scale(0.6);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

@keyframes alertPulse {
  0% {
    transform: scale(0.55);
    opacity: 0.9;
  }
  70% {
    opacity: 0.2;
  }
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}

@keyframes mapPulse {
  0% {
    transform: scale(0.6);
    opacity: 0.9;
  }
  70% {
    opacity: 0.25;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

@keyframes selectPulse {
  0% {
    transform: scale(0.7);
    opacity: 0.85;
  }
  70% {
    opacity: 0.25;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@keyframes alertGlow {
  0% {
    box-shadow: 0 0 0 4px rgba(229, 57, 53, 0.2), 0 0 10px var(--alert-glow);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(229, 57, 53, 0.08), 0 0 24px var(--alert-glow);
  }
  100% {
    box-shadow: 0 0 0 4px rgba(229, 57, 53, 0.2), 0 0 10px var(--alert-glow);
  }
}

@media (min-width: 860px) {
  .lines {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .line-map {
    min-height: 340px;
  }

  .leaflet-map {
    height: 440px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.secret-trigger {
  position: absolute;
  inset-inline-start: 6px;
  top: 6px;
  width: 38px;
  height: 38px;
  opacity: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 20;
}

.edit-panel {
  position: fixed;
  inset-inline-end: 16px;
  bottom: 120px;
  width: min(320px, 90vw);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
  z-index: 2100;
}

.edit-title {
  font-weight: 700;
}

.edit-actions {
  display: flex;
  gap: 8px;
}

.edit-panel textarea {
  width: 100%;
  min-height: 160px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 8px;
  font-family: "Cairo", "Tajawal", sans-serif;
  font-size: 12px;
  resize: vertical;
  background: rgba(255, 255, 255, 0.7);
}

:root[data-theme="dark"] .edit-panel textarea {
  background: rgba(20, 20, 20, 0.9);
  color: var(--text);
}
