/* ════════════════════════════════════════
   KISAN360 — location.css
   Location bar, modal, cascading dropdowns
   ════════════════════════════════════════ */

/* ════════════════════════════════════════
   LOCATION BAR (mobile — below topnav)
   ════════════════════════════════════════ */
.loc-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.loc-bar-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--gl);
  border: 1.5px solid var(--gm);
  border-radius: 20px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--g2);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  text-align: left;
  transition: background 0.15s;
  min-width: 0;
}
.loc-bar-btn:hover,
.loc-bar-btn:active { background: var(--gm); }

.loc-bar-btn .loc-pin-icon {
  width: 14px; height: 14px;
  stroke: var(--g3); fill: none; stroke-width: 2;
  flex-shrink: 0;
}
.loc-bar-btn .loc-bar-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.loc-bar-btn .loc-chevron {
  width: 12px; height: 12px;
  stroke: var(--g3); fill: none; stroke-width: 2.5;
  flex-shrink: 0;
}

.loc-gps-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
  white-space: nowrap;
}
.loc-gps-btn:hover { background: var(--surface); border-color: var(--border2); color: var(--g2); }
.loc-gps-btn svg { width: 14px; height: 14px; stroke: var(--g3); fill: none; stroke-width: 2; }

/* ════════════════════════════════════════
   DESKTOP TOPNAV LOCATION PILL
   ════════════════════════════════════════ */
.nav-loc-pill {
  display: none; /* shown via media query */
  align-items: center;
  gap: 5px;
  background: var(--gl);
  border: 1px solid var(--gm);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--g2);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s;
}
.nav-loc-pill:hover { background: var(--gm); }
.nav-loc-pill svg { flex-shrink: 0; }

/* ════════════════════════════════════════
   MODAL BACKDROP
   ════════════════════════════════════════ */
.loc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.loc-modal-backdrop.show {
  opacity: 1;
  pointer-events: all;
}

/* ════════════════════════════════════════
   MODAL — Mobile: bottom sheet
   Desktop: centered dialog
   ════════════════════════════════════════ */
.loc-modal {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  z-index: 501;
  padding: 0 0 32px;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  scrollbar-width: none;
}
.loc-modal::-webkit-scrollbar { display: none; }
.loc-modal.open { transform: translateY(0); }

/* Drag handle */
.loc-modal::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
}

/* ── Modal Header ── */
.loc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.loc-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.loc-modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.loc-modal-close:hover { background: var(--border); }
.loc-modal-close svg { width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 2.5; }

/* ── GPS Detect Button ── */
.loc-detect-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  width: 100%;
  background: none;
  border: none;
  font-family: 'DM Sans', sans-serif;
  text-align: left;
  transition: background 0.15s;
}
.loc-detect-btn:hover { background: var(--surface); }

.loc-detect-icon {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: var(--gl);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.3s;
}
.loc-detect-icon svg { width: 22px; height: 22px; stroke: var(--g3); fill: none; stroke-width: 1.8; }
.loc-detect-icon.pulsing {
  animation: loc-pulse 1.2s ease-in-out infinite;
}
@keyframes loc-pulse {
  0%, 100% { background: var(--gl); }
  50%       { background: var(--gm); }
}

.loc-detect-label { font-size: 14px; font-weight: 600; color: var(--text); }
.loc-detect-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Divider ── */
.loc-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 14px;
}
.loc-divider::before,
.loc-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.loc-divider span {
  font-size: 11px;
  color: var(--hint);
  font-weight: 500;
  white-space: nowrap;
}

/* ── Recently Used Section ── */
.loc-recent-section {
  padding: 4px 18px 14px;
  display: none;
}
.loc-recent-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 9px;
}
.loc-recent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.loc-recent-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}
.loc-recent-chip:hover { background: var(--gl); border-color: var(--gm); color: var(--g2); }
.loc-recent-chip svg   { stroke: var(--hint); fill: none; stroke-width: 2; flex-shrink: 0; }

/* ── Field Groups ── */
.loc-field-group {
  padding: 0 18px 14px;
}
.loc-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 7px;
  display: block;
}
.loc-optional {
  font-size: 10px;
  color: var(--hint);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.loc-select-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  transition: border-color 0.2s;
}
.loc-select-wrap:focus-within { border-color: var(--g3); }
.loc-select-wrap svg:first-child { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 1.8; flex-shrink: 0; }
.loc-select-wrap .loc-sel-arrow  { width: 14px; height: 14px; stroke: var(--hint); fill: none; stroke-width: 2.5; flex-shrink: 0; }

.loc-select {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  padding: 13px 0;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  min-width: 0;
}
.loc-select option { font-weight: 400; }

/* ── Location Preview Badge ── */
.loc-preview {
  margin: 0 18px 14px;
  background: var(--gl);
  border: 1px solid var(--gm);
  border-radius: 12px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.loc-preview svg    { width: 15px; height: 15px; stroke: var(--g3); fill: none; stroke-width: 2; flex-shrink: 0; }
.loc-preview-text   { font-size: 13px; font-weight: 500; color: var(--g2); }

/* ── Apply Button ── */
.loc-apply-btn {
  display: block;
  width: calc(100% - 36px);
  margin: 0 18px;
  background: var(--g3);
  color: #ffffff;
  border: none;
  border-radius: 13px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s;
}
.loc-apply-btn:hover:not(:disabled) { background: var(--g2); }
.loc-apply-btn:disabled {
  background: var(--gm);
  color: var(--g3);
  cursor: not-allowed;
}

/* ════════════════════════════════════════
   DESKTOP — 1024px+
   ════════════════════════════════════════ */
@media (min-width: 1024px) {

  /* Hide mobile location bar */
  .loc-bar { display: none; }

  /* Show nav pill */
  .nav-loc-pill { display: flex; }

  /* Modal becomes centered dialog instead of bottom sheet */
  .loc-modal {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -60%);
    width: 460px;
    border-radius: 20px;
    max-height: 80vh;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s;
  }
  .loc-modal::before { display: none; } /* no drag handle on desktop */
  .loc-modal.open {
    transform: translate(-50%, -50%);
    opacity: 1;
  }

  /* Wider field groups */
  .loc-field-group { padding: 0 22px 16px; }
  .loc-modal-header { padding: 18px 22px 14px; }
  .loc-detect-btn { padding: 14px 22px; }
  .loc-divider,
  .loc-recent-section { padding-left: 22px; padding-right: 22px; }
  .loc-preview { margin: 0 22px 16px; }
  .loc-apply-btn { width: calc(100% - 44px); margin: 0 22px; }
}
