/* =========================================================
   base.css - المتغيرات والإعدادات الأساسية للخريطة
   يستند إلى sudmap (https://sudamap.pages.dev)
   ========================================================= */

:root {
  /* الألوان الأساسية */
  --c-bg:           #f0f0f0;
  --c-map-bg:       #e5e3df;
  --c-surface:      #ffffff;
  --c-accent:       #2ecc71;
  --c-accent-dark:  #27ae60;
  --c-accent-light: #58d68d;
  --c-text:         #333333;
  --c-text-muted:   #999999;
  --c-border:       #f0f0f0;

  /* الظلال */
  --shadow-sm:      0 2px 6px  rgba(0, 0, 0, 0.25);
  --shadow-md:      0 2px 8px  rgba(0, 0, 0, 0.15);
  --shadow-lg:      0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-press:   0 1px 4px  rgba(0, 0, 0, 0.20);

  /* أزرار التحكم */
  --btn-size:            44px;
  --btn-transition:      transform 0.15s ease, box-shadow 0.15s ease;
  --btn-transition-press:transform 0.08s ease, box-shadow 0.08s ease;

  /* ترتيب الطبقات (Z-index) */
  --z-buttons:         1005;
  --z-menu:            1006;
  --z-search:          1010;
  --z-search-dropdown: 1011;
  --z-bottom-sheet:    1100;

  /* الهوامش الآمنة (Safe-area) */
  --safe-t: env(safe-area-inset-top,    0px);
  --safe-r: env(safe-area-inset-right,  0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left,   0px);
}
  
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  background-color: var(--c-bg);
  overflow: hidden;
  height: 100%;
  width: 100%;
}

#map {
  width: 100%;
  height: 100vh;   /* fallback */
  height: 100dvh;  /* دعم شريط عنوان الجوال */
  background-color: var(--c-map-bg);
}

/* نصوص المباني/المناطق */
.building-label {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: #111111;
  white-space: nowrap;
  pointer-events: none;
  direction: rtl;
  text-align: right;
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.9),
               0 0 6px rgba(255, 255, 255, 0.8);
  line-height: 1.2;
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 480px) {
  .building-label { font-size: 11px; }
}

/* مؤشر "غير متصل" */
#offline-indicator {
  position: fixed;
  top: calc(15px + var(--safe-t));
  left: max(55px, var(--safe-l));
  z-index: 1001;
  background: rgba(33, 33, 33, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 500;
  direction: rtl;
  padding: 5px 10px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#offline-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #ff3b30;
  border-radius: 50%;
  flex-shrink: 0;
  animation: offlinePulse 1.5s ease-in-out infinite;
}

#offline-indicator.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes offlinePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}