/* ===========================
   DANSAL FINDER — Modern UI
   Inter font · Clean dark theme
   =========================== */

:root {
  --accent: #00c97a;
  --accent-dim: rgba(0, 201, 122, 0.12);
  --accent-hover: #00b36b;
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #191919;
  --bg4: #222222;
  --border: rgba(255,255,255,0.07);
  --text: #f0f0f0;
  --text2: #999999;
  --text3: #666666;
  --danger: #ff4757;
  --warning: #ffb347;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.18s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
button { border: none; cursor: pointer; background: none; }
input, select, button { font-family: 'Inter', sans-serif; }


/* ====== LOADER ====== */
#loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999999;
  transition: opacity 0.4s ease;
}

.loaderInner {
  position: relative;
  width: 52px;
  height: 52px;
}

.loaderRing {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid var(--bg4);
  border-top: 3px solid var(--accent);
  animation: spin 0.8s linear infinite;
}

.loaderDot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

@keyframes spin { 100% { transform: rotate(360deg); } }


/* ====== LOCATION POPUP ====== */
#locationPopup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 999999;
}

.locationBox {
  background: var(--bg2);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 360px;
  padding: 36px 28px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow);
}

.locationIconWrap {
  width: 72px;
  height: 72px;
  background: var(--accent-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.locationIconWrap i {
  font-size: 28px;
  color: var(--accent);
}

.locationBox h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
}

.locationBox p {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 28px;
  line-height: 1.7;
}

.locationBtn {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--accent);
  font-weight: 600;
  font-size: 15px;
  color: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  transition: background var(--transition), transform var(--transition);
}

.locationBtn:active { transform: scale(0.98); }
.locationBtn:hover { background: var(--accent-hover); }

#locationBtnText {
  display: flex;
  align-items: center;
  gap: 8px;
}

.locationLoader {
  display: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid rgba(0,0,0,0.2);
  border-top: 2.5px solid #000;
  animation: spin 0.7s linear infinite;
}

.locationBtn.loading #locationBtnText { display: none; }
.locationBtn.loading .locationLoader { display: block; }


/* ====== HERO ====== */
.hero {
  height: 72vh;
  min-height: 420px;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.75) 100%),
    url('https://images.unsplash.com/photo-1528605248644-14dd04022da1?q=80&w=1200')
    center/cover no-repeat;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
  position: relative;
}

.heroBadge {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(6px);
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
}

.heroContent h1 {
  font-size: 56px;
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 14px;
  letter-spacing: -1px;
}

.heroContent h1 span {
  color: var(--accent);
}

.heroContent p {
  font-size: 18px;
  color: rgba(255,255,255,0.75);
  margin-bottom: 32px;
  font-weight: 400;
}

.heroBtn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #000;
  padding: 15px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  transition: background var(--transition), transform var(--transition);
}

.heroBtn:hover { background: var(--accent-hover); }
.heroBtn:active { transform: scale(0.97); }


/* ====== HEADER ====== */
header {
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.logoWrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
}

.logoText h2 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.versionBadge {
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 100px;
}

/* User area */
.userProfile {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg3);
  padding: 6px 12px 6px 6px;
  border-radius: 100px;
  border: 1px solid var(--border);
}

.userProfile img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.userProfile .userName {
  font-size: 13px;
  font-weight: 500;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logoutBtn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255,71,87,0.12);
  color: var(--danger);
  font-weight: 600;
  font-size: 13px;
  margin-top: 8px;
  width: 100%;
  transition: background var(--transition);
}

.logoutBtn:hover { background: rgba(255,71,87,0.22); }

.loginBtn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: 14px;
  transition: background var(--transition);
}

.loginBtn:hover { background: var(--accent-hover); }


/* ====== FILTERS ====== */
.filters {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  position: sticky;
  top: 65px;
  z-index: 800;
}

.filterWrap {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filterWrap::-webkit-scrollbar { display: none; }

.filterItem {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  min-width: max-content;
  transition: border-color var(--transition);
}

.filterItem:focus-within {
  border-color: var(--accent);
}

.filterIcon {
  color: var(--accent);
  font-size: 13px;
}

.filterItem select {
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 4px;
  outline: none;
  cursor: pointer;
  appearance: none;
}

.filterItem select option { background: var(--bg3); }


/* ====== MAP ====== */
#mapSection {
  position: relative;
}

#map {
  height: 58vh;
  width: 100%;
}

#myLocationBtn {
  position: fixed;
  right: 16px;
  bottom: 90px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-size: 18px;
  z-index: 900;
  box-shadow: 0 4px 16px rgba(0,201,122,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), box-shadow var(--transition);
}

#myLocationBtn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(0,201,122,0.55);
}

#myLocationBtn:active { transform: scale(0.96); }


/* ====== ADD PANEL ====== */
.addPanel,
.myDansals {
  padding: 28px 16px;
  max-width: 600px;
  margin: 0 auto;
}

.sectionHeader {
  margin-bottom: 20px;
}

.sectionTitleWrap {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.sectionIcon {
  width: 42px;
  height: 42px;
  background: var(--accent-dim);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.sectionTitleWrap h2 {
  font-size: 20px;
  font-weight: 700;
}

.sectionSub {
  font-size: 13px;
  color: var(--text2);
  margin-top: 2px;
}

.formCard {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inputGroup {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inputGroup label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: 0.2px;
}

.inputWrap {
  position: relative;
  display: flex;
  align-items: center;
}

.inputIcon {
  position: absolute;
  left: 14px;
  color: var(--text3);
  font-size: 14px;
  pointer-events: none;
}

.inputWrap input {
  width: 100%;
  padding: 13px 14px 13px 40px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.inputWrap input:focus {
  border-color: var(--accent);
}

.inputWrap input[type="time"] {
  padding-left: 40px;
  color-scheme: dark;
}

.inputWrap input::placeholder { color: var(--text3); }

.selectWrap {
  position: relative;
}

.selectWrap select {
  width: 100%;
  padding: 13px 40px 13px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.selectWrap select:focus { border-color: var(--accent); }
.selectWrap select option { background: var(--bg3); }

.selectArrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 12px;
  pointer-events: none;
}

.formGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Upload */
.uploadBox {
  background: var(--bg3);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.uploadBox:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.uploadBox input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.uploadIcon {
  font-size: 28px;
  color: var(--accent);
  margin-bottom: 8px;
  display: block;
}

.uploadTitle {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.uploadSub {
  font-size: 12px;
  color: var(--text3);
}

.previewWrap {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.previewWrap:empty { display: none; }

.previewWrap img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Publish button */
.publishBtn {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--accent);
  font-weight: 700;
  font-size: 15px;
  color: #000;
  min-height: 52px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background var(--transition), transform var(--transition);
}

.publishBtn:hover { background: var(--accent-hover); }
.publishBtn:active { transform: scale(0.98); }
.publishBtn:disabled { opacity: 0.6; pointer-events: none; }

#publishText {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.btnLoader {
  display: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid rgba(0,0,0,0.2);
  border-top: 2.5px solid #000;
  animation: spin 0.7s linear infinite;
}


/* ====== MY DANSALS ====== */
.myCard {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color var(--transition);
}

.myCard:hover { border-color: rgba(255,255,255,0.14); }

.myCardTop {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.myCard h3 {
  font-size: 15px;
  font-weight: 600;
}

.myCard p {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 14px;
}

.myCardButtons {
  display: flex;
  gap: 8px;
}

.editBtn, .deleteBtn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  transition: all var(--transition);
}

.editBtn {
  background: var(--accent-dim);
  color: var(--accent);
}

.editBtn:hover { background: rgba(0,201,122,0.2); }

.deleteBtn {
  background: rgba(255,71,87,0.1);
  color: var(--danger);
}

.deleteBtn:hover { background: rgba(255,71,87,0.2); }


/* ====== MODAL ====== */
#modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: flex-end;
  z-index: 99999;
  padding: 0;
}

.modalContent {
  background: var(--bg2);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modalTop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 2;
}

.modalTop h2 {
  font-size: 17px;
  font-weight: 700;
}

#closeModal {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg4);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background var(--transition);
}

#closeModal:hover { background: var(--danger); }

#modalBody { padding: 18px 20px 24px; }

.gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding-bottom: 4px;
}

.gallery img {
  width: 100%;
  max-width: 240px;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.badgeRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.infoBadge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  background: var(--bg3);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
}

.infoBadge i { color: var(--accent); font-size: 12px; }

.actionButtons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.actionBtn {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  color: #000;
  background: var(--accent);
  transition: background var(--transition), transform var(--transition);
}

.actionBtn:active { transform: scale(0.97); }
.actionBtn:hover { background: var(--accent-hover); }

.actionBtn.whatsapp {
  background: #25D366;
  color: #fff;
}

.actionBtn.whatsapp:hover { background: #1db954; }


/* ====== BUG BTN ====== */
.bugBtn {
  position: fixed;
  left: 16px;
  bottom: 20px;
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  z-index: 800;
  transition: all var(--transition);
}

.bugBtn:hover {
  background: rgba(255,71,87,0.12);
  color: var(--danger);
  border-color: rgba(255,71,87,0.3);
}


/* ====== FOOTER ====== */
footer {
  padding: 40px 20px;
  text-align: center;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

.footerLogo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin-bottom: 12px;
  border-radius: 10px;
}

.footerText {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.footerSub {
  font-size: 13px;
  color: var(--text3);
}


/* ====== LEAFLET OVERRIDES ====== */
.leaflet-popup-content-wrapper {
  background: var(--bg2) !important;
  color: var(--text) !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 13px !important;
}

.leaflet-popup-tip { background: var(--bg2) !important; }

.leaflet-control-zoom a {
  background: var(--bg2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}


/* ====== RESPONSIVE ====== */
@media (max-width: 600px) {
  .heroContent h1 { font-size: 42px; }
  .heroContent p { font-size: 16px; }

  .formGrid { grid-template-columns: 1fr; }

  .modalContent { border-radius: 24px 24px 0 0; }

  #modal { align-items: flex-end; }

  .actionButtons { grid-template-columns: 1fr; }
}

@media (min-width: 601px) {
  #modal {
    align-items: center;
    padding: 20px;
  }
  .modalContent {
    border-radius: var(--radius-lg);
    margin: auto;
  }
}
