/* ── Catamarca brand palette ─────────────────────────────────────────────── */
/*
  Naranja  #E8561E   primary brand / navbar
  Verde    #387C38   secondary / accents
  Cielo    #B7CEDD   light-blue tint
  Oliva    #A0B44D   warm highlight
  Tiza     #F2F2E7   off-white background
  Oro      #F4A740   hover / warm accent
  Adobe    #D14233   danger / alert
  Sepia    #3A2D23   primary dark text
*/

/* ── Reset / base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #F2F2E7;
  color: #3A2D23;
}

/* ── Bootstrap-independent utility classes ──────────────────────────────── */
.d-none   { display: none !important; }
.d-flex   { display: flex; }
.w-100    { width: 100%; }
.mt-3     { margin-top: 1rem; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ── Pure-CSS loading spinner ────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-border {
  display: inline-block;
  width: 2.5rem; height: 2.5rem;
  border: 0.3em solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

/* ── Navbar ─────────────────────────────────────────────────────────────── */
.navbar-app {
  background: #FFFFFF !important;
  height: 52px;
  flex-shrink: 0;
  z-index: 1100;
  position: relative;
  border-bottom: 3px solid #A0B44D;
}

.navbar-app .navbar-brand {
  color: #E8561E !important;
}

.navbar-brand-province {
  font-weight: 700;
  letter-spacing: .03em;
  color: #E8561E;
}

.navbar-brand-separator {
  margin: 0 .4em;
  color: #E8561E;
  opacity: 1;
}

.navbar-app .navbar-text {
  color: #387C38 !important;
  opacity: 1;
}

.navbar-app .container-fluid {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: nowrap;
}

:root {
  --control-pill-radius: 999px;
  --side-panel-width: 340px;
}

.tenure-search-wrap {
  margin-left: auto;
  margin-right: .55rem;
  display: flex;
  align-items: center;
}

.tenure-search-input {
  width: 260px;
  max-width: 36vw;
  height: 36px;
  border: 1px solid #A0B44D;
  border-radius: var(--control-pill-radius);
  padding: .4rem .95rem;
  font-size: .8rem;
  font-family: "Poppins", sans-serif;
  color: #3A2D23;
  background: #FFFFFF;
}

.tenure-search-input::placeholder {
  color: #8C7E73;
  opacity: 1;
}

.tenure-search-input:focus {
  outline: none;
  border-color: #387C38;
  box-shadow: 0 0 0 2px rgba(56,124,56,.18);
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
#layout {
  display: flex;
  height: calc(100vh - 52px);
  overflow: hidden;
}

/* Map wrapper */
#map-wrap {
  flex: 1 1 auto;
  min-width: 320px;
  position: relative;
}

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

.side-panel {
  width: var(--side-panel-width);
  flex-shrink: 0;
  background: #fff;
  border-left: 3px solid #E8561E;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

#side-panel-resize-handle {
  width: 10px;
  flex: 0 0 10px;
  cursor: col-resize;
  touch-action: none;
  background: #F2F2E7;
  position: relative;
}

#side-panel-resize-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 56px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #A0B44D;
  opacity: .65;
  transition: opacity .15s ease;
}

#side-panel-resize-handle:hover::before,
body.is-resizing #side-panel-resize-handle::before {
  opacity: 1;
}

body.is-resizing {
  user-select: none;
  cursor: col-resize;
}

.panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: .2rem;
}

/* Placeholder state */
.panel-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #A0B44D;
}
.placeholder-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.placeholder-text  {
  font-size: .9rem;
  line-height: 1.5;
  color: #3A2D23;
  opacity: .7;
}

/* Content state */
.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: #E8561E;
  margin-bottom: .25rem;
  font-family: "Poppins", sans-serif;
}
.panel-divider { border-color: #F4A740; margin: .5rem 0 .75rem; }

.panel-body dt {
  font-size: .75rem;
  font-weight: 600;
  color: #387C38;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: .75rem;
  font-family: "Poppins", sans-serif;
}
.panel-body dd {
  font-size: .85rem;
  color: #3A2D23;
  margin-left: 0;
  line-height: 1.5;
}

/* Download button */
.pdf-btn {
  background: #387C38;
  border-color: #387C38;
  color: #FFFFFF;
  font-weight: 600;
  font-family: "Poppins", sans-serif;
  letter-spacing: .02em;
  border-radius: var(--control-pill-radius);
  padding: .5rem 1rem;
  transition: background .2s, border-color .2s, color .2s;
}
.pdf-btn:hover {
  background: #A0B44D;
  border-color: #A0B44D;
  color: #FFFFFF;
}

/* ── Tenure list & collapsible cards ────────────────────────────────── */
.tenure-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  min-height: 0;
}

.side-panel-bottom-actions {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding-top: .75rem;
  background: #FFFFFF;
  display: flex;
  justify-content: center;
}

.side-panel-bottom-actions .pdf-btn {
  width: min(100%, 320px);
}

.tenure-card {
  width: 100%;
  border: 1px solid #F4A740;
  border-radius: 4px;
  overflow: hidden;
}

.tenure-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .85rem;
  background: #FFF8F0;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #F4A740;
}

.tenure-card-header:hover {
  background: #FDEBD0;
}

.tenure-card.collapsed .tenure-card-header {
  border-bottom: none;
}

.tenure-card-title {
  font-size: .9rem;
  font-weight: 700;
  color: #E8561E;
  font-family: "Poppins", sans-serif;
}

/* Arrow indicator: ▲ by default (expanded), rotates to ▼ when collapsed */
.tenure-card-toggle::before {
  content: "\25B2";
  font-size: .65rem;
  color: #E8561E;
  display: inline-block;
  transition: transform .2s ease;
}

.tenure-card.collapsed .tenure-card-toggle::before {
  transform: rotate(180deg);
}

.tenure-card-body {
  padding: .75rem .85rem;
}

.tenure-card.collapsed .tenure-card-body {
  display: none;
}

/* ── Loading overlay ─────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(58,45,35,.55);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Language selector ──────────────────────────────────────────────────── */
.lang-selector {
  display: flex;
  align-items: center;
  gap: .2rem;
  border: 1px solid #A0B44D;
  border-radius: var(--control-pill-radius);
  background: #FFFFFF;
  padding: .15rem;
}

.lang-btn {
  background: #FFFFFF;
  border: 1px solid transparent;
  color: #000000;
  font-size: .72rem;
  font-weight: 600;
  font-family: "Poppins", sans-serif;
  min-width: 2.3rem;
  padding: .25rem .6rem;
  border-radius: var(--control-pill-radius);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  letter-spacing: .05em;
}

.lang-btn:not(.lang-btn--active):hover {
  background: #F2F2E7;
  color: #000000;
  border-color: #A0B44D;
}

.lang-btn--active {
  background: #387C38;
  color: #FFFFFF;
  border-color: #387C38;
}

.lang-btn--active:hover {
  background: #A0B44D;
  border-color: #A0B44D;
  color: #FFFFFF;
}

@media (max-width: 768px) {
  .navbar-app {
    height: auto;
    min-height: 52px;
    padding: .45rem .35rem;
  }

  .navbar-app .container-fluid {
    flex-wrap: wrap;
    row-gap: .4rem;
  }

  .tenure-search-wrap {
    order: 3;
    width: 100%;
    margin: 0;
  }

  .tenure-search-input {
    width: 100%;
    max-width: none;
  }

  #layout { flex-direction: column; }
  #side-panel-resize-handle { display: none; }
  .side-panel {
    width: 100%;
    height: 240px;
    border-left: none;
    border-top: 3px solid #E8561E;
    flex-shrink: 0;
  }
}
