/* ==========================================================================
   GEOPORTAL ARAXÁ - LEVANTAMENTO CADASTRAL 2026
   Modern WebGIS Stylesheet
   ========================================================================== */

:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --bg-dark: #0f172a;
  --bg-panel: #1e293b;
  --bg-card: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #475569;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --sidebar-width: 420px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
}

#app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
}

/* Navbar */
header {
  height: 60px;
  background-color: #090d16;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-title h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.brand-title span {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge-item {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #cbd5e1;
}

.badge-item i {
  color: var(--primary-color);
}

.badge-item strong {
  color: #fff;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-header {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn-header:hover {
  background: var(--primary-color);
  border-color: var(--primary-hover);
}

/* Main Layout */
.main-wrapper {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Sidebar Drawer */
#sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 900;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
}

#sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-toggle-btn {
  position: absolute;
  top: 75px;
  left: var(--sidebar-width);
  z-index: 950;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-left: none;
  color: #fff;
  width: 32px;
  height: 48px;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 10px rgba(0,0,0,0.3);
}

#sidebar.collapsed + .sidebar-toggle-btn {
  left: 0;
}

/* Sidebar Navigation Tabs */
.sidebar-tabs {
  display: flex;
  background: #0d1322;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.tab-btn i {
  font-size: 1.1rem;
}

.tab-btn:hover {
  color: #fff;
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: var(--bg-panel);
}

/* Tab Contents */
.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: none;
}

.tab-content.active {
  display: block;
}

/* Custom Scrollbars */
.tab-content::-webkit-scrollbar,
.custom-scroll::-webkit-scrollbar {
  width: 6px;
}
.tab-content::-webkit-scrollbar-track,
.custom-scroll::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
}
.tab-content::-webkit-scrollbar-thumb,
.custom-scroll::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

/* Feature Details Card (Tab 1) */
.detail-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.detail-card-header {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-card-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.type-pill {
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;

}

/* Requested Attribute Highlight Box */
.required-specs-box {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 10px;
  padding: 1rem;
  margin: 1rem;
}

.required-specs-box .box-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.spec-item {
  display: flex;
  flex-direction: column;
}

.spec-item.full-width {
  grid-column: span 2;
}

.spec-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;

}

.spec-value {
  font-size: 0.92rem;
  color: #ffffff;
  font-weight: 700;
  margin-top: 2px;
}

.spec-value.highlight-dim {
  color: var(--accent-gold);
  font-size: 1rem;
}

/* Mini Photo Carousel inside Sidebar */
.sidebar-carousel-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
  background: #000;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-carousel-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.3s;
}

.sidebar-carousel-img:hover {
  transform: scale(1.03);
}

.carousel-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
}

.carousel-nav-btn:hover {
  background: var(--primary-color);
}

.carousel-nav-btn.prev { left: 8px; }
.carousel-nav-btn.next { right: 8px; }

.carousel-counter {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  color: #fff;
  z-index: 10;
}

/* Secondary Details List */
.detail-group {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
}

.detail-group-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.85rem;
  border-bottom: 1px dashed rgba(255,255,255,0.05);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row span:first-child {
  color: var(--text-muted);
}

.detail-row span:last-child {
  color: #fff;
  font-weight: 600;
  text-align: right;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--border-color);
}

.empty-state h3 {
  font-size: 1rem;
  color: #fff;
  margin-bottom: 0.5rem;
}

/* Layers Tab (Tab 2) */
.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary-color);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.basemap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.basemap-card {
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
  text-align: center;
}

.basemap-card.active {
  border-color: var(--primary-color);
  background: rgba(59, 130, 246, 0.15);
}

.basemap-card img {
  width: 100%;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
}

.basemap-card span {
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
}

.layer-toggle-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.layer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.layer-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
}

.opacity-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.opacity-slider-wrapper input[type=range] {
  flex: 1;
  accent-color: var(--primary-color);
}

/* Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: #475569; transition: .3s; border-radius: 22px;
}
.slider:before {
  position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px;
  background-color: white; transition: .3s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(16px); }

/* Filters Tab (Tab 3) */
.filter-group {
  margin-bottom: 1rem;
}

.filter-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.filter-input, .filter-select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: #fff;
  font-size: 0.85rem;
}

.filter-input:focus, .filter-select:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Map Container */
#map {
  flex: 1;
  height: 100%;
  width: 100%;
  background: #0a0f1d;
}

/* Photo Carousel Modal (Full Screen Lightbox) */
.carousel-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.92);
  z-index: 2000;
  backdrop-filter: blur(8px);
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem;
}

.carousel-modal.active {
  display: flex;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s;
}

.modal-close-btn:hover {
  background: var(--accent-red);
}

.modal-body {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin: 1rem 0;
}

.modal-img-container {
  max-width: 90vw;
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
  transition: transform 0.2s ease;
}

.modal-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: all 0.2s;
}

.modal-nav-btn:hover {
  background: var(--primary-color);
  transform: translateY(-50%) scale(1.1);
}

.modal-nav-btn.prev { left: 1rem; }
.modal-nav-btn.next { right: 1rem; }

.modal-thumbnails {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem;
}

.thumb-item {
  width: 60px;
  height: 45px;
  border-radius: 4px;
  object-fit: cover;
  cursor: pointer;
  opacity: 0.5;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.thumb-item:hover, .thumb-item.active {
  opacity: 1;
  border-color: var(--primary-color);
  transform: scale(1.08);
}

/* Customized Leaflet Popups */
.leaflet-popup-content-wrapper {
  background: var(--bg-panel) !important;
  color: #fff !important;
  border-radius: 12px !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5) !important;
  padding: 0 !important;
  overflow: hidden;
}

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

.popup-container {
  width: 280px;
}

.popup-header {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.popup-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.popup-body {
  padding: 0.85rem;
}

.popup-spec-box {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 8px;
  padding: 0.65rem;
  margin-bottom: 0.75rem;
}

.popup-row {
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.popup-row:last-child {
  margin-bottom: 0;
}

.popup-row span:first-child {
  color: var(--text-muted);
}

.popup-row span:last-child {
  font-weight: 700;
  color: #fff;
}

.popup-photo-preview {
  position: relative;
  width: 100%;
  height: 120px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  margin-bottom: 0.65rem;
}

.popup-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popup-photo-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.btn-popup-details {
  width: 100%;
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background 0.2s;
}

.btn-popup-details:hover {
  background: var(--primary-hover);
}

/* Map Floating Info Badge */
.map-coords-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  z-index: 800;
  font-family: monospace;
}

/* Help Modal Styles */
.help-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  z-index: 2500;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.help-modal-overlay.active {
  display: flex;
}

.help-modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.help-modal-header {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.help-modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.help-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.help-guide-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.help-guide-item h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.help-guide-item p {
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.5;
}

.help-guide-item ul {
  margin-top: 0.5rem;
  padding-left: 1.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.help-guide-item li {
  margin-bottom: 0.3rem;
}
