html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

.maps-main {
  padding: 20px;
  background: #32353a;
  color: white;
  min-height: 100vh;
}

.title {
  font-size: 28px;
  text-align: center;
  font-weight: bold;
  color: #c18a32;
  margin-bottom: 30px;
  margin-top: 0;
  text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);

}

.subtitle {
  direction: rtl;
  font-size: 18px;
  display: block;
  word-break: break-word;
  text-align: center; /* هذا هو اللي يوسّط الرابط */
  color: #fff7e6;
  text-decoration: none;
}

.links {
  text-align: center;
}

.links a {
  color: #c18a32;
  text-decoration: none;
  font-weight: bold;
  transition: 0.3s;
}

.links a:hover {
  color: #e0a83a;
  text-decoration: underline;
}

/* ================= LAYOUT ================= */
.container {
  display: flex;
  flex-direction: row-reverse; /* sidebar يمين */
  gap: 20px;
}

/* ================= SIDEBAR ================= */
.sidebar {
  width: 280px;
  max-height: 80vh;
  overflow-y: auto;
  background: #fff7e61c;
  border-radius: 10px;
  transition: transform 0.3s ease;
}

.sidebar.hidden {
  transform: translateX(110%);
}

/* table */
#mapTable {
  width: 100%;
  border-collapse: collapse;
}

#mapTable th {
  background: #c18a32;
  color: #fff7e6;
  padding: 10px;
}

#mapTable td {
  padding: 10px;
  border-bottom: 1px solid #fff7e6;
  cursor: pointer;
  text-align: center;
}

#mapTable tr:hover {
  background: #3a3f45;
}

#mapTable tr.active {
  background: #c18a324e;
  color: black;
  font-weight: bold;
}

/* ================= MAP ================= */
.map-view {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* الوضع العادي */
.map-container {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  height: 500px;
  background: #000000;
  touch-action: none;
}

.map-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ================= FULLSCREEN MODE ================= */
/* 🔥 فقط عندما sidebar مخفية */
.container.sidebar-hidden .map-view {
  flex: 1;
  width: 100%;
}

.container.sidebar-hidden .map-container {
  height: 100vh;
  border-radius: 0;
}

.container.sidebar-hidden .sidebar {
  display: none;
}

/* ================= BUTTONS ================= */
.download-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(193,138,50,0.9);
  color: black;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  z-index: 10;
}

.toggle-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #c18a32;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: bold;
  border-radius: 6px;
  z-index: 20;
}

/* ================= MOBILE ================= */
@media (max-width: 768px) {

  .container {
    flex-direction: column;
    position: relative;
  }

  .map-view {
    width: 100%;
  }

  /* في الهاتف fullscreen دائم عند toggle */
  .map-container {
    height: 100vh;
    border-radius: 0;
  }

  .sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 85%;
    height: 100vh;
    z-index: 100;
    background: #2c2f33;
  }

  .sidebar.hidden {
    transform: translateX(100%);
  }

  .download-btn {
    width: 34px;
    height: 34px;
    font-size: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .download-btn::before {
    content: "⬇";
    font-size: 16px;
  }
}