/* Styles for sakan.html and the new cards */

.sakan-page {
  padding: 18px;
  margin-top: 110px; /* حتى ما يجي المحتوى تحت الـ navbar */
}

/* ── Search Section ── */
.search-section {
  text-align: center;
  margin-bottom: 45px;
}

.search-title {
  font-size: 34px;
  font-weight: 800;
  color: var(--brik);
  font-family: 'Qahwa Arabic', serif;
  margin-bottom: 20px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border: 2px solid var(--brik);
  border-radius: 30px;
  padding: 10px 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  transition: box-shadow 0.2s ease;
}

.search-box:focus-within {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.search-icon {
  color: var(--brik);
  display: flex;
  align-items: center;
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  font-family: 'Qahwa Arabic', serif;
  color: var(--brik);
  text-align: right;
}

.search-box input::placeholder {
  color: var(--brik);
  opacity: 0.5;
}

.page-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--green);
  font-family: 'Qahwa Arabic', serif;
  text-align: right;
  margin-right: 10px;
}

.shelters-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(180px, 1fr));
  gap: 20px;
  align-items: stretch; /* كل البطاقات بنفس الارتفاع */
  margin-top: 15px;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .shelters-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
}
@media (max-width: 992px) {
  .shelters-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
}
@media (max-width: 768px) {
  .shelters-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); gap: 15px; }
  .sakan-page { padding: 10px; margin-top: 80px; }
  .page-title { font-size: 26px; }
}
@media (max-width: 576px) {
  .shelters-grid { grid-template-columns: 1fr; }
  .sakan-page { padding: 10px; margin-top: 70px; }
  .page-title { font-size: 24px; margin-bottom: 12px; }
  .search-title { font-size: 28px; }
  .search-box { max-width: 90%; }
}

.shelter-card {
  text-decoration: none;
  color: var(--abyad);
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--brik);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.shelter-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card-img {
  position: relative;
  height: 160px;
  flex-shrink: 0;
  background: #eee;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.status-pill {
  position: absolute;
  top: 15px;
  left: 15px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 12px;
  z-index: 2;
}

.status-pill.booked {
  background: var(--brik, #c0622a);
}

.card-body {
  padding: 12px;
  color: var(--abyad);
  flex: 1; /* يملأ المساحة المتبقية حتى تتساوى الارتفاعات */
}

.card-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--abyad);
  font-family: 'Qahwa Arabic', serif;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--abyad);
}
.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-meta span::after {
  font-size: 11px;
}

/* رسائل التحميل وعدم وجود نتائج */
.loading, .empty, .error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px 0;
  font-weight: 700;
  color: var(--blue-gray);
  font-size: 18px;
}

.error {
  color: var(--red);
}

.arrow-icon {
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 2px solid var(--green);
  border-radius: 50%;
  text-decoration: none;
  color: var(--green);
  cursor: pointer;
}
.arrow-icon:hover {
  background: var(--green);
  color: white;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--brik);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: opacity 0.3s;
  text-decoration: none;
}

/* ── Map Section ── */
.map-section {
  margin-top: 50px;
}

/* ── وضع تكبير الخريطة (ملء الشاشة) ── */
.map-section.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  margin: 0;
  padding: 20px;
  background: var(--abyad, #fff);
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.map-section.fullscreen #sheltersMap {
  flex: 1;
  height: auto;
  max-width: none;
}

.map-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin: 10px 10px 16px;
  font-weight: 700;
  font-size: 14px;
  color: #2a3b37;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* زر قابل للنقر */
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  transition: all .2s ease;
}
.legend-item:hover { background: rgba(56,114,108,0.08); }
.legend-item.active {
  border-color: currentColor;
  background: rgba(56,114,108,0.10);
  font-weight: bold;
}
.legend-item.dimmed { opacity: 0.4; }
.legend-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
}
.legend-dot.person { background: #2563eb; }
.legend-dot.avail  { background: var(--green); }
.legend-dot.booked { background: var(--brik); }

#sheltersMap {
  width: 100%;
  max-width: 1100px;
  margin: 0;
  height: 420px;
  border-radius: 18px;
  overflow: hidden;
  border: 3px solid var(--green);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  z-index: 1;
}

/* ── Map Markers ── */
.pin {
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  border: 2px solid #fff;
}
.pin > * { transform: rotate(45deg); font-size: 16px; }

.pin-person { width: 40px; height: 40px; background: #2563eb; }
.pin-person > * { font-size: 18px; }
.pin-avail  { background: var(--green); }
.pin-booked { background: var(--brik); }

/* ── Map Popup ── */
.map-popup {
  text-align: center;
  width: 160px;
  font-family: 'Qahwa Arabic', serif;
}
.map-popup img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 6px;
}
.map-popup .mp-title {
  font-weight: 900;
  font-size: 14px;
  color: #1f2d2a;
  margin-bottom: 4px;
}
.map-popup .mp-status {
  display: inline-block;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
}
.map-popup .mp-status.avail  { background: var(--green); }
.map-popup .mp-status.booked { background: var(--brik); }
.map-popup .mp-price {
  font-size: 13px;
  font-weight: 700;
  color: #324a45;
  margin-bottom: 8px;
}
.map-popup .mp-btn {
  display: inline-block;
  background: #b66914;
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 8px;
}
.map-popup .mp-btn:hover { opacity: .85; }
/* ===== نافذة إذن استخدام الموقع ===== */
.geo-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 40, 36, 0.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 18px;
}
.geo-modal[hidden] { display: none; }
.geo-box {
  background: #fff;
  border-radius: 18px;
  max-width: 400px;
  width: 100%;
  padding: 28px 24px 24px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0,0,0,0.3);
  font-family: 'IBMPlexArabic', sans-serif;
}
.geo-icon { font-size: 44px; line-height: 1; margin-bottom: 8px; }
.geo-box h3 {
  font-family: 'Qahwa Arabic', serif;
  color: var(--green);
  font-size: 24px;
  margin: 0 0 12px;
}
.geo-box p {
  color: #4a5a57;
  font-size: 15px;
  line-height: 2;
  margin: 0 0 22px;
}
.geo-box p b { color: var(--brik); }
.geo-actions { display: flex; flex-direction: column; gap: 10px; }
.geo-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  font-family: 'IBMPlexArabic', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s, background .2s;
}
.geo-btn.allow { background: var(--green); color: #fff; border: none; }
.geo-btn.allow:hover { opacity: .9; }
.geo-btn.later { background: #fff; color: var(--green); border: 1.5px solid var(--green); }
.geo-btn.later:hover { background: rgba(56,114,108,0.06); }
