/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:   #1D9E75;
  --green-l: #E1F5EE;
  --green-d: #0F6E56;
  --amber:   #EF9F27;
  --amber-l: #FAEEDA;
  --red:     #E24B4A;
  --red-l:   #FCEBEB;
  --red-d:   #A32D2D;
  --gray-50: #F8F9FA;
  --gray-100:#F1F3F4;
  --gray-200:#E8EAED;
  --gray-400:#9AA0A6;
  --gray-700:#5F6368;
  --gray-900:#202124;
  --white:   #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.15);
  --radius:  10px;
  --radius-sm: 7px;
}

html, body {
  height: 100%;
  font-family: 'Tajawal', system-ui, sans-serif;
  font-size: 15px;
  background: var(--gray-50);
  color: var(--gray-900);
  direction: rtl;
}

.hidden { display: none !important; }

/* ── Splash ── */
#splash { position: fixed; inset: 0; background: var(--green); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #fff; z-index: 9999; transition: opacity .5s ease; }
#splash h1 { font-size: 26px; font-weight: 700; }
#splash p  { font-size: 14px; opacity: .85; text-align: center; max-width: 260px; }

/* ── App Shell ── */
#app {
  display: flex; flex-direction: column;
  height: 100dvh; overflow: hidden;
}

/* ── Contact Button ── */
.header-actions {
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 5px;
}
.header-btns-row {
  display: flex; gap: 8px; align-items: center;
}
.contact-link {
  font-size: 11px; color: var(--gray-400);
  text-decoration: none;
  display: flex; align-items: center; gap: 3px;
  transition: color .15s;
}
.contact-link:hover { color: var(--green); }

/* ── Footer ── */
.app-footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 12px 20px;
  display: flex; align-items: center;
  justify-content: space-between;
  font-size: 12px;
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-email {
  color: var(--green);
  text-decoration: none;
  font-size: 13px;
  display: flex; align-items: center; gap: 5px;
}
.footer-email:hover { text-decoration: underline; }

/* ── Splash Logo ── */
.splash-logo {
  width: 130px; height: 130px;
  border-radius: 28px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  margin-bottom: 8px;
}

/* ── Header Logo ── */
.header-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

/* ── Header ── */
header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 38px; height: 38px;
  background: var(--green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.brand-name { font-size: 15px; font-weight: 700; color: var(--gray-900); }
.brand-sub  { font-size: 12px; color: var(--gray-400); }

.header-btn {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px; font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: background .15s;
}
.header-btn:hover { background: var(--green-d); }
.contact-btn {
  background: var(--white);
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  display: flex; align-items: center; gap: 4px;
  transition: all .15s;
}
.contact-btn:hover { background: var(--gray-100); border-color: var(--gray-400); }


.share-btn:hover { background: var(--green-l); }



/* ── Tabs ── */
.tabs {
  display: flex;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.tab {
  flex: 1; padding: 11px;
  text-align: center;
  font-size: 14px; font-weight: 500;
  font-family: inherit;
  background: none; border: none;
  border-bottom: 2.5px solid transparent;
  color: var(--gray-400);
  cursor: pointer;
  transition: all .2s;
}
.tab.active { color: var(--green); border-bottom-color: var(--green); }

/* ── Tab Panels ── */
.tab-panel { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.tab-panel.hidden { display: none; }

/* ── Map ── */
#map { flex: 1; width: 100%; }

.map-legend {
  position: absolute;
  bottom: 80px; left: 12px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 5px;
  z-index: 5;
}
.legend-item { display: flex; align-items: center; gap: 7px; color: var(--gray-700); }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }

/* ── Admin ── */
#tab-admin { overflow-y: auto; background: var(--gray-50); }

.admin-toolbar {
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 5;
}
.admin-toolbar select {
  flex: 1; padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px;
  background: var(--gray-50); color: var(--gray-900);
  cursor: pointer;
}
.admin-count {
  font-size: 12px; color: var(--gray-400);
  white-space: nowrap;
}

#adminList { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }

.report-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.card-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-name { font-size: 14px; font-weight: 700; color: var(--gray-900); }
.card-notes { font-size: 13px; color: var(--gray-700); margin-top: 3px; line-height: 1.5; }
.card-meta  { font-size: 12px; color: var(--gray-400); margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; }

.badge {
  font-size: 11px; font-weight: 500;
  padding: 3px 10px; border-radius: 999px;
  white-space: nowrap; flex-shrink: 0;
}
.badge.pending  { background: var(--amber-l); color: #854F0B; }
.badge.approved { background: var(--green-l);  color: var(--green-d); }
.badge.rejected { background: var(--red-l);    color: var(--red-d); }

.card-actions { display: flex; gap: 8px; margin-top: 12px; }
.card-btn {
  flex: 1; padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  font-family: inherit; cursor: pointer;
  border: 1.5px solid;
  transition: opacity .15s;
}
.card-btn:active { opacity: .75; }
.btn-approve { background: var(--green-l); border-color: var(--green); color: var(--green-d); }
.btn-reject  { background: var(--red-l);   border-color: var(--red);   color: var(--red-d); }
.btn-map     { background: var(--gray-100); border-color: var(--gray-200); color: var(--gray-700); }

.card-photo { width: 100%; border-radius: var(--radius-sm); margin-top: 10px; object-fit: cover; max-height: 160px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end;
  z-index: 1000;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.modal {
  background: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-height: 92dvh;
  display: flex; flex-direction: column;
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(100%) } to { transform: translateY(0) } }

.modal-header {
  padding: 16px 20px 12px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: var(--gray-100); border: none;
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 14px; cursor: pointer; color: var(--gray-700);
}
.modal-close:hover { background: var(--gray-200); }

.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }

.form-section { display: flex; flex-direction: column; gap: 7px; }
.form-label { font-size: 13px; font-weight: 700; color: var(--gray-700); }
.required { color: var(--red); }

input[type="text"], textarea {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px;
  color: var(--gray-900);
  background: var(--gray-50);
  outline: none; resize: vertical;
  transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--green); background: var(--white); }

.loc-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px;
  background: var(--green-l);
  border: 1.5px solid var(--green);
  border-radius: var(--radius-sm);
  font-family: inherit; cursor: pointer;
  text-align: right;
  transition: background .15s;
}
.loc-btn:hover { background: #c3eadb; }
.loc-btn #locBtnIcon { font-size: 22px; }
.loc-btn div { display: flex; flex-direction: column; gap: 2px; }
.loc-btn #locBtnTitle { font-size: 14px; font-weight: 500; color: var(--green-d); }
.loc-sub { font-size: 12px; color: var(--green); }

.loc-mini-map {
  width: 100%; height: 160px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--green);
  overflow: hidden;
}

.photo-label {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 100px;
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s;
}
.photo-label:hover { border-color: var(--green); }
#photoPreviewArea {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 13px; color: var(--gray-400); padding: 16px;
}
#photoPreviewArea img { width: 100%; border-radius: var(--radius-sm); }

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex; gap: 10px;
  flex-shrink: 0;
}
.btn-cancel {
  flex: 1; padding: 12px;
  background: var(--gray-100); border: none;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px; font-weight: 500;
  color: var(--gray-700); cursor: pointer;
}
.btn-submit {
  flex: 2; padding: 12px;
  background: var(--green); border: none;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px; font-weight: 700;
  color: #fff; cursor: pointer;
  transition: background .15s;
}
.btn-submit:hover { background: var(--green-d); }
.btn-submit:disabled { opacity: .5; cursor: not-allowed; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--gray-900); color: #fff;
  padding: 12px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 500;
  z-index: 9999; white-space: nowrap;
  animation: toastIn .25s ease;
  box-shadow: var(--shadow-md);
}
@keyframes toastIn { from { opacity:0; transform: translateX(-50%) translateY(10px) } to { opacity:1; transform: translateX(-50%) translateY(0) } }

/* ── Method Toggle ── */
.method-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.method-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200);
  background: var(--gray-50);
  font-family: inherit; cursor: pointer;
  text-align: right; transition: all .2s;
}
.method-btn.active {
  border-color: var(--green);
  background: var(--green-l);
}
.method-btn span { font-size: 22px; flex-shrink: 0; }
.method-title { font-size: 13px; font-weight: 700; color: var(--gray-900); }
.method-sub   { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.method-btn.active .method-title { color: var(--green-d); }
.method-btn.active .method-sub   { color: var(--green); }


.gm-marker {
  position: relative;
  cursor: pointer;
}

/* ── Method Toggle 3 columns ── */
.method-toggle.three { grid-template-columns: repeat(3, 1fr); }
.method-toggle.three .method-btn { flex-direction: column; align-items: center; text-align: center; padding: 10px 6px; gap: 5px; }
.method-toggle.three .method-btn span { font-size: 20px; }
.method-toggle.three .method-title { font-size: 12px; }
.method-toggle.three .method-sub   { font-size: 10px; }

/* ── Pick on Map ── */
.pick-hint {
  background: var(--green-l); border: 1px dashed var(--green);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 13px; color: var(--green-d); margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.loc-pick-map {
  width: 100%; height: 240px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--green);
  overflow: hidden; cursor: crosshair;
}
.pick-coords {
  background: var(--gray-100); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 12px; color: var(--gray-700);
  margin-top: 6px; text-align: center;
}

/* ── Pick Map Type Buttons (in modal) ── */
.pick-map-type-btns {
  display: flex; gap: 6px; margin-top: 8px;
  flex-wrap: wrap;
}
.pick-type-btn {
  flex: 1; min-width: 70px;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 7px 8px;
  font-size: 11px; font-weight: 500;
  font-family: inherit; cursor: pointer;
  color: var(--gray-700);
  transition: all .15s;
  white-space: nowrap;
}
.pick-type-btn:hover  { background: var(--gray-200); }
.pick-type-btn.active { background: var(--green); border-color: var(--green); color: #fff; }

.link-note {
  background: #EFF6FF; border: 1px solid #93C5FD;
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 12px; color: #1E40AF; line-height: 1.7;
}


.link-help {
  background: #FFF8E7;
  border: 1px solid #EF9F27;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 8px;
}
.help-title { font-size: 13px; font-weight: 700; color: #854F0B; margin-bottom: 8px; }
.help-steps { padding-right: 18px; font-size: 13px; color: var(--gray-700); line-height: 2; }
.help-alt { font-size: 12px; color: var(--gray-400); margin-top: 8px; border-top: 1px solid #EF9F2740; padding-top: 8px; }

/* ── Map Type Buttons ── */
.map-type-btns {
  position: absolute;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: row; gap: 6px;
  z-index: 5;
  background: rgba(255,255,255,.92);
  border-radius: 999px;
  padding: 5px 8px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-200);
}
.map-type-btn {
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px; font-weight: 500;
  font-family: inherit; cursor: pointer;
  color: var(--gray-700);
  transition: all .15s;
  white-space: nowrap;
}
.map-type-btn:hover  { background: var(--gray-100); }
.map-type-btn.active { background: var(--green); color: #fff; }

/* ── Export / Import Buttons ── */
.tool-btn {
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500; font-family: inherit;
  cursor: pointer; border: 1.5px solid; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px;
}
.export-btn { background: #E8F5E9; border-color: #4CAF50; color: #1B5E20; }
.export-btn:hover { background: #C8E6C9; }
.import-btn { background: #E3F2FD; border-color: #2196F3; color: #0D47A1; }
.import-btn:hover { background: #BBDEFB; }

/* ── Import Preview Modal ── */
.import-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; z-index: 1000;
}
.import-modal {
  background: var(--white); border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-height: 85dvh; display: flex; flex-direction: column;
  animation: slideUp .25s ease;
}
.import-header {
  padding: 16px 20px 12px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--gray-200); flex-shrink: 0;
}
.import-header h2 { font-size: 16px; font-weight: 700; }
.import-body { padding: 16px; overflow-y: auto; flex: 1; }
.import-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.import-table th {
  background: var(--gray-100); padding: 8px 10px; text-align: right;
  border: 1px solid var(--gray-200); font-weight: 600; white-space: nowrap;
}
.import-table td {
  padding: 7px 10px; border: 1px solid var(--gray-200);
  color: var(--gray-700); max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.import-table tr:nth-child(even) td { background: var(--gray-50); }
.import-stats {
  background: var(--green-l); border: 1px solid var(--green);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 13px; color: var(--green-d); margin-bottom: 12px;
}
.import-footer {
  padding: 14px 20px; border-top: 1px solid var(--gray-200);
  display: flex; gap: 10px; flex-shrink: 0;
}

/* ── Admin Subtabs ── */
.admin-subtabs {
  display: flex; gap: 6px;
  padding: 10px 16px 0;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}
.subtab {
  padding: 8px 14px;
  background: none; border: none;
  border-bottom: 2.5px solid transparent;
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--gray-400); cursor: pointer;
}
.subtab.active { color: var(--green); border-bottom-color: var(--green); }
.admin-subpanel { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }

/* ── Admin Login ── */
.admin-login {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--gray-50);
}
.login-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 28px 24px;
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-md);
}
.login-icon { font-size: 36px; text-align: center; }
.login-title { font-size: 18px; font-weight: 700; text-align: center; color: var(--gray-900); }
.login-sub   { font-size: 13px; color: var(--gray-400); text-align: center; margin-top: -8px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-error {
  background: var(--red-l); border: 1px solid var(--red);
  border-radius: var(--radius-sm); padding: 8px 12px;
  font-size: 13px; color: var(--red-d); text-align: center;
}
.logout-btn {
  background: var(--red-l); border: 1px solid var(--red);
  border-radius: var(--radius-sm); padding: 6px 12px;
  font-size: 12px; font-weight: 500; color: var(--red-d);
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.logout-btn:hover { background: #f9d5d5; }

.btn-delete {
  background: var(--red-l); border-color: var(--red); color: var(--red-d);
  flex: 0 0 auto; padding: 8px 10px;
}
.btn-delete:hover { opacity: .8; }

/* ── Edit Modal ── */
.edit-loc-info {
  background: var(--gray-100); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px; color: var(--gray-700);
  margin-bottom: 8px; line-height: 1.6;
}
.edit-map-label {
  font-size: 12px; color: var(--gray-400); margin-bottom: 6px;
  display: flex; align-items: center; gap: 4px;
}
.btn-edit {
  flex:1; padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  font-family: inherit; cursor: pointer;
  border: 1.5px solid #93C5FD;
  background: #EFF6FF; color: #1E40AF;
  transition: opacity .15s;
}
.btn-edit:active { opacity: .75; }

/* ── Responsive ── */
@media (min-width: 640px) {
  .modal { max-width: 480px; margin: auto; border-radius: var(--radius); }
  .modal-overlay { align-items: center; }
}
