body, html { margin: 0; height: 100%; font-family: sans-serif; direction: rtl}

@font-face {
    font-family: myFirstFont;
    src: url(../fonts/DIN.ttf);
}

#map { width: 100%; height: 100%; }



/* =========================
   Install Screen (RTL) — بدون Flex
   ========================= */

/* قفل تمرير الخلفية عند الحاجة (اختياري إن كنت تضيف الكلاسين من JS) */
html.overlay-locked,
body.overlay-locked {
  overflow: hidden !important;
}

/* طبقة التثبيت: تغطي الشاشة وتسمح بالتمرير داخلها فقط */
.install-overlay {
  font-family: myFirstFont;
  position: fixed;     /* فوق كل شيء */
  inset: 0;            /* top/right/bottom/left: 0 */
  width: 100%;         /* نتجنب 100vw لمنع انزلاق أفقي */
  height: 100vh;
  height: 100dvh;      /* دعم iOS الحديثة */
  background: #f8fafb;
  z-index: 99999;
  direction: rtl;

  padding: 24px;
  box-sizing: border-box;

  overflow-y: auto;               /* التمرير داخل الطبقة */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;   /* عدم تمرير/شد الخلفية */
}

/* نصوص عامة داخل طبقة التثبيت */
.install-overlay p {
  margin: 14px 0;
  font-size: 20px;
  color: #222;
  line-height: 1.6;
  text-align: center;
  padding: 15px;
}
.install-overlay strong {
  color: blue;
}

/* زر التثبيت */
#installBtn {
  font-family: myFirstFont;
  background-color: #137a15;
  color: #fff;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 17px;
  cursor: pointer;
  margin-top: 15px;
  transition: background 0.3s;
  display: none;
}
#installBtn:hover {
  background-color: #015f6b;
}

/* صورة أيقونة/دليل */
.guide-img {
  width: 150px;
  height: auto;
  margin: 12px auto;
  display: block;
}


/* =========================
   بطاقة التعريف + محتواها — بدون Flex
   ========================= */

.install-card {
  position: relative;
  box-sizing: border-box;
  max-width: 680px;     /* حد أقصى مناسب */
  width: 100%;
  margin: 16px auto 0;  /* توسيط أفقي طبيعي */
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
  padding: 50px 20px;
  overflow: hidden;     /* احتواء أي تجاوز داخلي */
}

/* منع أي عنصر داخلي من دفع العرض خارج البطاقة */
.install-card > * {
  max-width: 100%;
}

/* صور داخل البطاقة عموماً */
.install-card img {
  max-width: 100%;
  height: auto;
  display: block;
}

.install-card h2 {
  margin: 0;
  font-size: 26px;
  text-align: center;
  color: #111827;
}
.install-card h3 {
  margin: 4px 0 16px;
  font-size: 16px;
  text-align: center;
  color: #6b7280;
  font-weight: 500;
}

/* قائمة المزايا */
.features-list {
  margin: 12px 0 0;
  padding: 0 20px;
  list-style: none;
}
.features-list li {
  position: relative;
  padding-inline-start: 1.2em;
  margin: 8px 0;
}
.features-list li::before {
  content: "🔹";
  position: absolute;
  inset-inline-start: 0;
}

/* صندوق خطوات التحميل داخل البطاقة */
.download-box {
  background-color: #f3f4f6;
  padding: 12px;
  border-radius: 10px;
  margin: 30px 0 80px 0;
  font-size: 15px;
  box-sizing: border-box;
}

/* =========================
   معرض لقطات الشاشة — صور فوق بعض (بدون Flex)
   ========================= */

.screens-row {
  margin-top: 16px;
  /* لا Flex هنا */
}
.screens-row img {
  width: 100%;
  border-radius: 10px;
  display: block;
  margin: 0 0 10px 0;  /* مسافة بين الصورتين */
}
.install-card img {
    width: 49%;
    max-width: 250px;
}
.install-card .imgRight {
    float: right;
}
.install-card .imgLeft {
    float: left;
}

/* =========================
   أقسام الإرشاد + الزر (داخل البطاقة)
   ========================= */

#installBtn,
#iosSafariGuide,
#iosChromeGuide {
  width: 100%;
  margin: auto;
  text-align: center;
  box-sizing: border-box;
}

#iosSafariGuide,
#iosChromeGuide {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
  padding: 16px 0px;
}


/* =========================
   نافذة الإذن بالوصول إلى الموقع
   ========================= */
   
#geoModal, #geoModal button {
    font-family: myFirstFont;
}




/* Splash screen */
.splash {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: #000;
  z-index: 2000;
}
.splash-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.splash-overlay {
  position: absolute;
  width: 350px;
  height: auto;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: rgb(255 255 255 / 50%);
  padding: 10px 0px;
  border-radius: 8px;
}


.label-marker {
  font: 600 13px/1.2 sans-serif;
  direction: rtl;            /* دعم العربية */
  background: rgba(255,255,255,0.85);
  color: #0b3d3b;
  border: 1px solid #017580;
  border-radius: 8px;
  padding: 4px 8px;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  transform: translateY(-4px);
  user-select: none;
}
.label-marker.small { font-size: 11px; padding: 3px 6px; }  /* لو حبيت تصغير مع الزوم */


.user-location {
    width: 20px;
    height: 20px;
    background: #007bff;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.map-center-marker {
  position:absolute; top:50%; left:50%;
  width:20px; height:20px; margin-left:-10px; margin-top:-10px;
  z-index:1000; font-size:20px; color:#e8e8e8; text-align:center;
  pointer-events:none; user-select:none;
}

.coords-display, .speed-display, .gpsAccuracy-display {
  position:absolute; z-index:1000;
  background: rgb(186 186 186 / 90%);
  padding:3px 6px; font-size:14px; border-radius:4px;
  box-shadow:0 1px 4px rgba(0,0,0,0.3); direction:rtl;
}
.speed-display { bottom:80px; left:20px; }
.coords-display { bottom:20px; left:20px; }
.gpsAccuracy-display { bottom:50px; left:20px; direction:ltr}
.gpsAccuracy-display span { font-size: 11px; }

.follow-btn, .zoom-btn {
  position:absolute; z-index:1000;
  background:rgb(186 186 186 / 90%); border-radius:50%; padding:12px;
  box-shadow:0 2px 6px rgba(0,0,0,0.3); cursor:pointer;
  transition:background 0.2s;
}
.follow-btn { bottom:60px; right:20px; }
.follow-btn.active { background:#007bff; }
.follow-btn svg { width:32px; height:32px; display:block; }
.follow-btn svg path { fill:#333; }

.zoom-btn { display:none; right:20px; }
.zoom-in { bottom:180px; }
.zoom-out { bottom:120px; }
.zoom-btn svg { width:32px; height:32px; display:block; }
.zoom-btn:hover { background:#e6e6e6; }

.refresh-btn { position:absolute; z-index:1000; bottom:110px; left:20px;
  background:white; border-radius:50%; padding:8px;
  box-shadow:0 2px 6px rgba(0,0,0,0.3); cursor:pointer; transition:background 0.2s; }
.refresh-btn:hover { background:#e6e6e6; }
.refresh-btn svg { width:20px; height:20px; display:block; transition:transform 0.6s ease; }
.refresh-btn.rotate svg { transform:rotate(360deg); }

.menu-btn { position:absolute; margin-bottom: 20px; top:20px; right:20px; z-index:1100;
  background:rgb(186 186 186 / 90%); border-radius:5px; padding:8px;
  box-shadow:0 2px 6px rgba(0,0,0,0.3); cursor:pointer; }
.menu-btn div { width:25px; height:3px; background:#333; margin:5px 0; }

.sidebar {
  position: fixed;
  top: 0;
  right: -300px;
  width: 265px;

  /* ارتفاع ثابت يغطي الشاشة بشكل صحيح على الموبايل */
  height: 100vh;      /* fallback */
  height: 100dvh;     /* يعالج شريط العنوان في iOS */
    
  background: rgb(186 186 186 / 90%);
  box-shadow: -2px 0 6px rgba(0,0,0,0.3);
  transition: right 0.3s ease;
  z-index: 1050;

  /* فراغ علوي كما كان + فراغ سفلي آمن */
  padding: 65px 20px 20px;
  padding-bottom: calc(env(safe-area-inset-bottom) + 100px);

  box-sizing: border-box;

  /* الأهم: تفعيل التمرير داخل اللوحة */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* انسيابية على iOS */
  overscroll-behavior: contain;      /* يمنع سحب الصفحة خلف اللوحة */
}
.sidebar.open { right: 0; }
/* قفل تمرير الخلفية (الخريطة) عند فتح القائمة */
body.sidebar-open {
  overflow: hidden;
  height: 100dvh; /* يمنع قفز/تمدد الصفحة على iOS */
}

.sidebar h3 { margin-top:0; }
.sidebar button { display:block; width:100%; padding:10px; margin:10px 0;
  font-size:16px; cursor:pointer; border:none; background:#f0f0f0; border-radius:5px; font-family: myFirstFont;}
.sidebar button:hover { background:#e0e0e0; }

.dropdown-container { display: none; padding-left: 5px; padding-right: 5px;}
.dropdown-btn { background: #dcdcdc; width: 100%; text-align: right;
  padding: 10px; margin: 5px 0; cursor: pointer; border: none; border-radius: 5px; color: #7d7d7d; font-family: myFirstFont;}
.dropdown-btn.active { background: #ececec; }
.dropdown-container button { background: #f0f0f0; margin: 5px 0; padding-right: 20px; color: #535252; border: 2px solid #696969;}
.dropdown-container button:hover { background: #e0e0e0; }

/* إظهار/إخفاء قائمة إعدادات العرض */
.menu-section .dropdown-btn.active + .dropdown-container {
  display: block;
}
/* عندما يتم تفعيل الزر */
.menu-section .dropdown-btn.active {
  background: #ececec;
}


.menu-section .dropdown-container {
  display: none; /* البداية تكون مخفية */
}

.menu-section .dropdown-container label {
    display: block;
    padding: 8px 10px 13px 10px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    background: #f0f0f0;
    border-radius: 5px;
    margin: 5px 0;
    color: #535252;
    text-align: justify;
    font-family: myFirstFont;
    border: 2px solid #696969;
}

.menu-section .dropdown-container input[type="checkbox"] {
  margin-left: 10px;
  transform: scale(1.2); /* تكبير حجم المربع */
}
/* عندما يتم تفعيل الزر */
.menu-section .dropdown-btn.active {
  background: #ececec;
}

.s-btn {
    text-align: right;
    font-size: 16px;
}


/* تنسيق الرموز من Font Awesome */
.menu-section i {
    margin-left: 10px;
    font-size: 16px;
    color: #7d7d7d;
}


.save-location-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 2001; }
.save-location-content { background: #fff; padding: 20px; border-radius: 8px; width: 300px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4); text-align: center; }
.icons-select span { font-size: 18px; margin: 0 10px; cursor: pointer; transition: transform 0.2s; }
.icons-select span.selected { transform: scale(1.3); border-bottom: 2px solid #007bff; }
#locationDesc { width: 90%; margin-top: 15px; padding: 8px; font-size: 14px;
  border: 1px solid #ccc; border-radius: 5px; }
.modal-buttons { margin-top: 20px; display: flex; justify-content: space-between; }
.modal-buttons button { flex: 1; margin: 0 5px; padding: 10px; font-size: 16px;
  cursor: pointer; border: none; border-radius: 5px; }
.modal-buttons button:first-child { background: #007bff; color: white; }
.modal-buttons button:last-child { background: #ccc; }

.saved-location-marker { cursor: pointer; user-select: none; }

.saved-locations-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 2002; }
.saved-locations-content { background: #fff; padding: 20px; width: 320px; border-radius: 8px;
  max-height: 80%; overflow-y: auto; text-align: center;}
.saved-locations-content button {padding: 5px; font-size: 15px;}  
.saved-locations-item { display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid #ccc; }
.saved-locations-item span.icon { font-size: 24px; margin-right: 8px; }
.saved-locations-actions button { border: none; background: none; font-size: 18px;
  cursor: pointer; margin-left: 8px; }
.saved-locations-actions button:hover { color: red; }

.select-label { margin-bottom: 5px; font-size: 14px; color: #333; text-align: center; }

.import-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); align-items: center; justify-content: center; z-index: 2003; }
.import-modal .import-content { background: #fff; padding: 20px; width: 300px; border-radius: 8px; text-align: center;}

.saved-location-item, .saved-route-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #ccc;
}

.saved-location-item .clickable,
.saved-route-item .clickable {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    cursor: pointer;
    flex-grow: 1;
}

.saved-location-item .icon {
    font-size: 20px;
}

.saved-location-actions, .saved-route-actions {
    display: flex;
    gap: 6px;
}

.saved-location-actions button,
.saved-route-actions button {
    border: none;
    background: none;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s;
}

.saved-location-actions button:hover,
.saved-route-actions button:hover {
    transform: scale(1.2);
    color: #007bff;
}




/* === Weather Bottom Sheet (محدَّثة) === */
:root { --wx-height: 40vh; } /* عدّلها لو حبيت 46–48vh */

.weather-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: var(--wx-height);
  background: #0e1b1b; color: #e8f6f5;
  border-top-left-radius: 14px; border-top-right-radius: 14px;
  box-shadow: 0 -6px 24px rgba(0,0,0,.35);
  z-index: 2500; display: none; overflow: hidden;
}
.weather-sheet.open { display: block; }

.weather-head {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 10px;
  padding: 6px 0px 7px 0px; border-bottom: 1px solid #114b4b;
  background: linear-gradient(180deg,#102828 0%, #0e1b1b 100%);
}
.weather-close {
  grid-column: 2; justify-self: center;
  background: #143; color: #c9ffff; border: 1px solid #1b6666;
  border-radius: 10px; padding: 3px 10px 5px 10px; cursor: pointer; font-size: 20px;;
}

.weather-body { display: grid; grid-template-rows: 50px 1fr; height: calc(var(--wx-height) - 56px); }
.weather-tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin;
  padding: 6px 10px; border-bottom: 1px solid #114b4b;
}
.weather-tab {
  white-space: nowrap; font-size: 13px; padding: 6px 10px;
  border-radius: 999px; border: 1px solid #1b6666; cursor: pointer;
  background: #0f3636; color:#c9ffff;
}
.weather-tab.active { background: #178; border-color:#2aa; color:#fff; }

.weather-hours { overflow-x: auto; overflow-y: hidden; white-space: nowrap; padding: 10px; gap: 10px; display: flex; margin-bottom: 10px; }
.hour-card { min-width: 110px; display: inline-flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid #1b6666; border-radius: 10px; background: #0f2b2b; }
.hour-time { font-size: 14px; color: #e8f6f5; font-weight: 700; }
.hour-wind { font-size: 14px; }
.hour-wind span { font-size: 12px; }
.hour-gust { font-size: 12px; color: #bfe; opacity: .9; }
.hour-dir { font-size: 12px; color: #bfe; display: flex; align-items: center; gap: 6px; }
.wind-arrow { width: 16px; height: 16px; display: inline-block; transform-origin: 50% 50%; }

/* تلميح: يمكنك تعديل --wx-height لاحقًا بدون لمس الجافاسكربت */

.contrib-select, .contrib-input, .contrib-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  margin: 6px 0 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}
.contrib-textarea { min-height: 80px; resize: vertical; }
.contrib-btn {
  width: 100%;
  background: #017580;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
}
.contrib-btn:hover { background: #015f6b; }
.contrib-hint { font-size: 12px; color: #666; margin-top: 6px; }


.toast {
    position: fixed;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    z-index: 4000;
    /* شكل وزخرفة */
    background: linear-gradient(135deg, rgba(1,117,128,0.92), rgba(1,117,128,0.80));
    color: #fff;
    border-radius: 9999px;               /* كبسولة */
    border: 1px solid rgba(255,255,255,0.25);
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    backdrop-filter: saturate(160%) blur(6px);
    /* مقاسات */
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    direction: rtl;                      /* يدعم العربية */
    /* حجم مرن يمنع انقسام السطر على iPhone */
    font-size: clamp(14px, 4vw, 20px);
    line-height: 1.2;
    white-space: nowrap;                 /* منع اللفّ */
    max-width: min(92vw, 700px);         /* أوسع من قبل لتستوعب الجملة */
    overflow: hidden;                    /* لو زادت جدًا */
    text-overflow: clip;
    pointer-events: none;
    /* حركة */
    opacity: 0;
    transition: opacity .25s ease, transform .25s ease;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* أدوات رسم المسار الآمن */
.draw-tools{
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1300;      /* أعلى من الخريطة وأقل من السبلّاش */
}
.draw-tools .pill{
  font-family: myFirstFont;
  background: #017580;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  min-width: 120px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.draw-tools .pill:hover{ filter: brightness(1.05); }
.draw-tools .pill:disabled{
  background: #bdbdbd;
  cursor: not-allowed;
  color: #eee;
}
/* زر الإخفاء (✕) أسفل الأدوات */
.draw-tools .pill-x{
  margin-top: 6px;
  background: #cfcfcf;
  color: #333;
}
.draw-tools .pill-x:hover{ filter: brightness(0.97); }



/* ثيمات ألوان جاهزة (اختياري) */
.toast--info  { background: linear-gradient(135deg, rgba(1,117,128,0.95), rgba(0,160,176,0.85)); }
.toast--ok    { background: linear-gradient(135deg, rgba(22,163,74,0.95), rgba(34,197,94,0.85)); }
.toast--warn  { background: linear-gradient(135deg, rgba(234,179,8,0.95), rgba(245,158,11,0.85)); }
.toast--error { background: linear-gradient(135deg, rgba(220,38,38,0.95), rgba(239,68,68,0.85)); }

/* أيقونة التوست */
.toast svg { flex: 0 0 auto; width: 18px; height: 18px; }
.toast .txt { display: inline-block; }


/* Auth Modal */
.auth-modal{position:fixed;inset:0;background:rgba(0,0,0,.5);display:none;align-items:center;justify-content:center;z-index:3000}
.auth-content{width:min(92vw,380px);background:#fff;border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.25);padding:14px}
.auth-tabs{display:flex;gap:6px;align-items:center;margin-bottom:8px}
.auth-tab{flex:1;border:1px solid #ddd;background:#f7f7f7;padding:8px;border-radius:8px;cursor:pointer}
.auth-tab.active{background:#017580;color:#fff;border-color:#017580}
.auth-close{border:none;background:#eee;border-radius:8px;padding:6px 10px;cursor:pointer}
.auth-pane{display:none}
.auth-content label{display:block;margin:8px 0 4px}
.auth-content input{width:90%;padding:10px;border:1px solid #ccc;border-radius:8px;font-size:14px}
.auth-actions{display:flex;justify-content:space-between;align-items:center;margin-top:10px}
.auth-actions .remember{font-size:13px;color:#444}
.auth-content button#loginBtn,
.auth-content button#registerBtn,
.auth-content button#forgotBtn{background:#017580;color:#fff;border:none;border-radius:8px;padding:10px 14px;cursor:pointer; margin: 10px;}
.auth-links{margin-top:10px;text-align:center}
.auth-links a{font-size:13px;color:#017580;text-decoration:none}
.auth-note{margin-top:10px;font-size:13px;color:#666}
.auth-note.small{font-size:12px}
.auth-status{margin-top:10px;font-size:14px;color:#b00}
