#map { height: 100vh; width: 100vw;  overflow: hidden;}
body {
  margin: 0;
  overflow: hidden;
}

/* Blinking animation for pre warning */
@keyframes blinkSlow {
  0%, 50% { opacity: 0.3; }
  100%    { opacity: 1;   }
}
.blink-red {
  animation: blinkSlow 1s infinite;
}
#sound-toggle {
  position: absolute; 
  left: 10px;
  position: absolute;
  top: 110px;
  z-index: 5000;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  padding: 10px 14px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease;
  direction: rtl;
}

#sound-toggle:hover {
  background: rgba(0,0,0,0.8);
}

#sound-toggle:active {
  transform: scale(0.97);
}

#logo-flex {
  display: flex;
  align-items: center;
}
#logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Segoe UI', sans-serif;
  font-size: 22px;
  font-weight: bold;
  padding: 4px 16px;
  color: black;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5000;
  flex-direction: column;
}

#logo .icon {
  margin-right: 8px;
}
.line-md--brake-alert {
  display: inline-block;
  width: 24px;
  height: 24px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23f90000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath stroke-dasharray='56' stroke-dashoffset='56' d='M12 4c4.42 0 8 3.58 8 8c0 4.42 -3.58 8 -8 8c-4.42 0 -8 -3.58 -8 -8c0 -4.42 3.58 -8 8 -8'%3E%3Canimate fill='freeze' attributeName='stroke-dashoffset' dur='0.6s' values='56;0'/%3E%3C/path%3E%3Cpath stroke-dasharray='20' stroke-dashoffset='20' d='M4.22 4.22c-4.29 4.3 -4.29 11.26 0 15.56'%3E%3Canimate fill='freeze' attributeName='stroke-dashoffset' begin='0.7s' dur='0.2s' values='20;0'/%3E%3C/path%3E%3Cpath stroke-dasharray='20' stroke-dashoffset='20' d='M19.78 4.22c4.29 4.3 4.29 11.26 0 15.56'%3E%3Canimate fill='freeze' attributeName='stroke-dashoffset' begin='0.9s' dur='0.2s' values='20;0'/%3E%3C/path%3E%3Cpath stroke-dasharray='6' stroke-dashoffset='6' d='M12 8v4'%3E%3Canimate fill='freeze' attributeName='stroke-dashoffset' begin='1.1s' dur='0.2s' values='6;0'/%3E%3C/path%3E%3Cpath stroke-dasharray='2' stroke-dashoffset='2' d='M12 16v0.01'%3E%3Canimate fill='freeze' attributeName='stroke-dashoffset' begin='1.3s' dur='0.2s' values='2;0'/%3E%3C/path%3E%3C/g%3E%3C/svg%3E");
}
#logo .text {
  letter-spacing: 1px;
}
#logo .text a{
  color: #000;
  text-decoration: none;
}
#clock-container {
  top: 32px;
  position: absolute;
  font-size: 12px;
  padding: 4px 0;
  font-family: sans-serif;
  color: #000000;
  direction: rtl;
  z-index: 5000;
}

#time-part {
  color: #f90200;
  font-weight: bold;
}
.city-popup {
  text-align: right;
  direction: rtl;
}
/* Button */
#info-toggle {
  position: absolute;
  top: 60px;
  left: 10px;
  z-index: 5000;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  padding: 10px 14px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease;
  direction: rtl;
}

#info-toggle:hover {
  background: rgba(0,0,0,0.8);
}

/* Info Panel */
#info-panel {
  position: absolute;
  top: 120px;
  left: 10px;
  width: 300px;
  max-width: 90%;
  max-height: -webkit-fill-available;
  background: rgba(30, 30, 30, 0.9);
  color: #fff;
  padding: 20px;
  border-radius: 10px;
  z-index: 5000;
  font-family: sans-serif;
  font-size: 14px;
  line-height: 1.5;
  direction: rtl;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
  overscroll-behavior: contain;
  cursor: default;  
  max-height: 58vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}
#info-panel::-webkit-scrollbar {
  width: 6px;
}
#info-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 4px;
}
#info-panel.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#info-panel h2, #info-panel h3 {
  margin-top: 0;
}

#info-panel ul {
  list-style: none;
  padding: 0;
  margin: 10px 0;
}

.legend-box {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  vertical-align: middle;
  border-radius: 3px;
}
.legend-box.red    { background: red; }
.legend-box.blue   { background: #66ccff; }
.legend-box.green  { background: #00cc66; }
.legend-box.blink-red {
  background: red;
  animation: blinkSlow 1s infinite;
}

/* Already existing blink animation assumed */
@keyframes blinkSlow {
  0%, 50% { opacity: 0.3; }
  100%    { opacity: 1;   }
}

#regions-notification {
  position: absolute;
  bottom: 26px;
  right: 16px;
  transform: translateY(100%);
  background: rgba(214,0,0,0.8);
  color: white;
  padding: 8px;
  border-radius: 14px;
  font-size: 14px;
  font-family: sans-serif;
  z-index: 5000;
  transition: transform 0.4s ease, opacity 0.4s ease;
  opacity: 0;
  max-width: 300px;
  text-align: right;
  pointer-events: none;
  direction: rtl;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  gap: 6px;
  overscroll-behavior: contain;
  pointer-events: all;  
  cursor: default;  
  max-height: 50vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;

}

#regions-notification.visible {
  opacity: 1;
  transform: translateY(0);
}

#regions-notification .region-title {
  font-weight: bold;
  margin-bottom: 4px;
  text-align: center;
}

#regions-notification span {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  border-radius: 8px;
  display: inline-block;
  font-weight: bold;
  font-size: 11px;
  margin: 2px 0 0 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#regions-notification::-webkit-scrollbar {
  width: 6px;
}
#regions-notification::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 4px;
}

@media (max-width: 500px) {
  #regions-notification {
    bottom: 24px;
  }
}

#history-toggle {
  position: absolute;
  top: 160px;
  left: 10px;
  z-index: 5000;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  padding: 10px 14px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease;
  direction: rtl;
}

#history-toggle:hover {
  background: rgba(0,0,0,0.8);
}

#history-panel {
  position: absolute;
  top: 218px;
  left: 10px;
  width: 300px;
  max-width: 90%;
  max-height: 45vh;
  background: rgba(30, 30, 30, 0.9);
  color: #fff;
  padding: 20px;
  border-radius: 10px;
  z-index: 5000;
  font-family: sans-serif;
  font-size: 14px;
  line-height: 1.5;
  direction: rtl;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}

#history-panel::-webkit-scrollbar {
  width: 6px;
}
#history-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 4px;
}

#history-panel.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#history-panel h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: #ffe;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding-bottom: 4px;
}
#history-panel h2 {
  margin-top: 0;
}
#history-panel .alert-time {
  font-size: 13px;
  color: #ffaaaa;
}
#history-panel .alert-cities {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  direction: rtl;
}
#history-panel .alert-cities span {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 4px;
  border-radius: 6px;
  font-size: 12px;
}
#history-panel .alert-type {
  margin: 10px 0 0 0;
  font-weight: bold;
}
#history-panel .alert-group {
  cursor: pointer;
  padding: 2px;
  margin-top: 4px;
  -webkit-tap-highlight-color: transparent;
}
#history-panel .alert-group:hover {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}
.temporary-highlight {
  outline: none;
}
.connection-toast {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 8px;
  font-family: sans-serif;
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  display: none;
  pointer-events: none;
  direction: rtl;
}
#connection-error {
  background: #d32f2f;
  color: white;
}
#connection-restored {
  background: #2e7d32;
  color: white;
}
#reset-view {
  position: absolute;
  left: 10px;
  bottom: 20px;
  z-index: 5000;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  padding: 10px 14px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease;
  direction: rtl;
}

#reset-view:hover {
  background: rgba(0,0,0,0.8);
}
