/* 
  GeoTaksator Core Design System
  Theme: Modern Premium Dark Mode with HSL Cyan Accents & Glassmorphism
*/

:root {
  --font-family-primary: 'Outfit', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-family-secondary: 'Plus Jakarta Sans', sans-serif;
  
  /* Harmonious Dark Palette */
  --bg-app: #090d16;
  --bg-sidebar: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.45);
  --bg-card-hover: rgba(30, 41, 59, 0.6);
  --border-card: rgba(148, 163, 184, 0.12);
  --border-card-active: rgba(56, 189, 248, 0.35);
  
  /* Typography Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #0f172a;
  
  /* Primary HSL Tailored Brand Colors (Sleek Cyan/Blue) */
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-glow: rgba(56, 189, 248, 0.15);
  
  /* Secondary HSL Accent (Gorgeous Violet/Indigo for alternate values) */
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-glow: rgba(129, 140, 248, 0.12);
  
  --success: #34d399;
  --error: #fb7185;
  --overlay-bg: rgba(9, 13, 22, 0.8);
  
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
}

/* ==========================================================================
   Base & Reset Styles
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-family-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.4);
}

/* ==========================================================================
   App Header Layout
   ========================================================================== */
.app-header {
  height: 72px;
  background-color: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 32px;
  position: relative;
  z-index: 1000;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  color: var(--primary);
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-main {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 30%, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-sub {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-top: -2px;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.btn-icon-label {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--border-card);
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  color: var(--text-main);
  font-family: var(--font-family-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-icon-label:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: var(--border-card-active);
  color: var(--primary);
}

.btn-icon-label.accent-action {
  background: rgba(129, 140, 248, 0.08);
  border-color: rgba(129, 140, 248, 0.15);
}

.btn-icon-label.accent-action:hover {
  background: rgba(129, 140, 248, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   Main App Grid Split Layout
   ========================================================================== */
.app-main {
  height: calc(100% - 72px);
  display: flex;
  position: relative;
}

/* Map Panel (Left side) */
.map-panel {
  flex: 1;
  position: relative;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  background-color: var(--bg-app);
}

.leaflet-dark-tiles {
  filter: invert(100%) hue-rotate(180deg) brightness(85%) contrast(90%) !important;
}

/* Map Search Floating Bar Overlay */
.map-search-overlay {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 1000;
  width: 360px;
}

.search-input-wrapper {
  display: flex;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--border-radius-md);
  padding: 6px 6px 6px 16px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  transition: var(--transition-smooth);
  align-items: center;
}

.search-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
}

.search-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-family-primary);
  font-size: 14px;
  outline: none;
}

.search-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.search-input-wrapper button {
  background: var(--primary);
  border: none;
  color: var(--bg-app);
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.search-input-wrapper button:hover {
  background: var(--primary-hover);
  transform: scale(1.03);
}

/* Search Dropdown list of results */
.search-results-dropdown {
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  border-radius: var(--border-radius-md);
  list-style: none;
  max-height: 250px;
  overflow-y: auto;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

.search-results-dropdown li {
  padding: 12px 18px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid rgba(148, 163, 184, 0.05);
  transition: var(--transition-smooth);
}

.search-results-dropdown li:last-child {
  border-bottom: none;
}

.search-results-dropdown li:hover {
  background: rgba(56, 189, 248, 0.08);
  color: var(--primary);
}

/* Map Layers Control Panel (Glassmorphic) */
.map-layers-panel {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  width: 280px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.layers-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.layer-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 500;
}

.layer-label {
  cursor: pointer;
  flex: 1;
  user-select: none;
}

.layer-toggle-row.divider-row {
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  padding-top: 12px;
  margin-top: 4px;
}

/* Apple-style Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(148, 163, 184, 0.2);
  transition: .3s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

/* Map Visual Legend */
.map-legend {
  margin-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.15);
  padding-top: 10px;
}

.legend-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.legend-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.color-red { background-color: #f87171; border: 1px solid rgba(248, 113, 113, 0.5); }
.color-yellow { background-color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.5); }
.color-blue { background-color: #60a5fa; border: 1px solid rgba(96, 165, 250, 0.5); }
.color-brown { background-color: #a78bfa; border: 1px solid rgba(167, 139, 250, 0.5); }

.map-coordinates-legend {
  position: absolute;
  bottom: 24px;
  left: 24px;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  border-radius: var(--border-radius-sm);
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Sidebar panel layout (Right side) */
.sidebar-panel {
  width: 480px;
  height: 100%;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-card);
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ==========================================================================
   Tabs System inside Parcel Card
   ========================================================================== */
.tab-header {
  display: flex;
  background: rgba(9, 13, 22, 0.4);
  padding: 4px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 16px;
  border: 1px solid rgba(148, 163, 184, 0.05);
}

.parcel-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.parcel-tab-btn.active {
  background: var(--bg-sidebar);
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.form-hint-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 16px;
}

.relative-position {
  position: relative;
}

.card-separator {
  border: none;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  margin: 16px 0;
}

/* ==========================================================================
   Premium Cards System (Glassmorphism & Aesthetics)
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  backdrop-filter: blur(12px);
  transition: var(--transition-smooth);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(148, 163, 184, 0.18);
}

.card.disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(80%);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text-main);
  margin-bottom: 6px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Empty placeholder state */
.parcel-info-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 10px;
  color: var(--text-muted);
}

.placeholder-icon {
  margin-bottom: 12px;
  color: rgba(148, 163, 184, 0.35);
}

.parcel-info-placeholder p {
  font-size: 13px;
  line-height: 1.5;
}

/* Info row values */
.parcel-info-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 12.5px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.05);
  gap: 12px;
}

.info-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.info-label {
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
  max-width: 55%;
}

.info-value {
  font-weight: 600;
  color: var(--text-main);
  text-align: right;
  word-break: break-word;
}

.highlight-value {
  color: var(--primary);
  font-weight: 700;
}

.code-value {
  font-family: monospace;
  font-size: 11.5px;
  background: rgba(148, 163, 184, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-all;
}

/* ==========================================================================
   Form Controls
   ========================================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  line-height: 1.3;
}

/* Label Help Wrapper */
.label-help-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.label-help-wrapper label {
  margin-bottom: 0;
}

.info-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  cursor: help;
  transition: var(--transition-smooth);
  position: relative;
}

.info-bubble:hover {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--primary);
}

.info-bubble:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Premium Custom CSS Tooltip Popover */
.info-bubble::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-card-active);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  font-size: 11px;
  font-family: var(--font-family-primary);
  font-weight: 500;
  white-space: pre-wrap;
  width: 290px;
  z-index: 3000;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: none;
  letter-spacing: normal;
  text-align: left;
  line-height: 1.45;
}

.info-bubble:hover::before,
.info-bubble:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.land-price-suggestion {
  display: block;
  font-size: 10px;
  color: var(--primary);
  margin-top: 5px;
  font-weight: 600;
  line-height: 1.3;
}

.form-group select, .form-group input {
  width: 100%;
  background: rgba(9, 13, 22, 0.5);
  border: 1px solid var(--border-card);
  border-radius: var(--border-radius-sm);
  color: var(--text-main);
  font-family: var(--font-family-primary);
  font-size: 13.5px;
  padding: 10px 12px;
  outline: none;
  transition: var(--transition-smooth);
}

.form-group select:focus, .form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

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

/* Shifting Leaflet Zoom Controls to prevent overlaps */
.leaflet-bottom.leaflet-left {
  margin-bottom: 56px;
  margin-left: 12px;
}

.leaflet-control-zoom {
  border: 1px solid var(--border-card) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

.leaflet-control-zoom a {
  background-color: rgba(15, 23, 42, 0.9) !important;
  color: var(--text-main) !important;
  border-bottom: 1px solid var(--border-card) !important;
  transition: var(--transition-smooth);
}

.leaflet-control-zoom a:hover {
  background-color: var(--primary) !important;
  color: var(--bg-app) !important;
}

/* Narzędzie interaktywnego pomiaru linii na mapie */
.btn-ruler-tool {
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-ruler-tool:hover {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ruler-tool.ruler-active {
  background: rgba(251, 113, 133, 0.15) !important;
  border-color: var(--error) !important;
  color: var(--error) !important;
  animation: pulse-ruler 1.5s infinite alternate;
}

@keyframes pulse-ruler {
  from { box-shadow: 0 0 4px rgba(251, 113, 133, 0.2); }
  to { box-shadow: 0 0 10px rgba(251, 113, 133, 0.5); }
}

/* Pływające powiadomienie instrukcji pomiaru */
.map-instruction-toast {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  padding: 10px 18px;
  border-radius: var(--border-radius-sm);
  font-size: 12px;
  color: var(--text-main);
  border: 1px solid var(--border-card-active);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
  opacity: 0;
}

/* Sliders */
.slider-group {
  margin-top: 16px;
  margin-bottom: 20px;
}


.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.slider-header label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.slider-badge {
  background: var(--primary-glow);
  border: 1px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
}

.slider-group input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  background: rgba(9, 13, 22, 0.5);
  height: 6px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.slider-description {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.info-box {
  background: rgba(56, 189, 248, 0.04);
  border: 1px solid rgba(56, 189, 248, 0.1);
  border-radius: var(--border-radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

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

.preview-row strong {
  color: var(--primary);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.preview-label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.info-bubble-inline {
  flex: 0 0 auto;
}

/* Custom Buttons */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  border: none;
  color: var(--bg-app);
  font-family: var(--font-family-secondary);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 15px -3px rgba(56, 189, 248, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px -3px rgba(56, 189, 248, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  font-family: var(--font-family-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: rgba(148, 163, 184, 0.15);
  border-color: rgba(148, 163, 184, 0.3);
}

/* Spinner */
.btn-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(9, 13, 22, 0.25);
  border-top-color: var(--bg-app);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Results & Calculations Panel
   ========================================================================== */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.results-summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.result-card-highlight {
  background: rgba(56, 189, 248, 0.03);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.result-card-highlight.accent-card {
  background: rgba(129, 140, 248, 0.03);
  border-color: rgba(129, 140, 248, 0.15);
}

.result-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.result-card-amount {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.result-card-highlight.accent-card .result-card-amount {
  color: var(--accent);
}

.result-card-detail {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.results-total-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--border-radius-md);
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.results-total-card span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.results-total-card strong {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  text-shadow: 0 0 10px var(--primary-glow);
}

/* Tabs for AI text opinion */
.technical-reasoning {
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  padding-top: 20px;
}

.technical-reasoning h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.reasoning-tabs {
  display: flex;
  background: rgba(9, 13, 22, 0.4);
  padding: 4px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 16px;
  border: 1px solid rgba(148, 163, 184, 0.05);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.tab-content {
  font-size: 13px;
  color: rgba(248, 250, 252, 0.85);
  line-height: 1.6;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 8px;
}

.tab-content p {
  margin-bottom: 10px;
}

/* ==========================================================================
   Side Drawer System (Educational Guide)
   ========================================================================== */
.app-drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 480px;
  background: #0f172a;
  border-left: 1px solid rgba(148, 163, 184, 0.15);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  z-index: 2500;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(0);
}

.app-drawer.hidden {
  transform: translateX(100%);
  display: flex !important; /* Force display flex but slide out of screen */
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.drawer-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-close-drawer {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
}

.btn-close-drawer:hover {
  color: var(--primary);
}

.drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.drawer-section {
  border-bottom: 1px dashed rgba(148, 163, 184, 0.08);
  padding-bottom: 20px;
}

.drawer-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.drawer-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
}

.drawer-section p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.drawer-section ul {
  padding-left: 20px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Reference Table in Drawer */
.table-container {
  margin: 16px 0;
  border: 1px solid var(--border-card);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  background: rgba(9, 13, 22, 0.3);
}

.reference-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.reference-table th {
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid var(--border-card);
  padding: 8px 12px;
  font-weight: 600;
  color: var(--primary);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reference-table td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.05);
  padding: 8px 12px;
  color: var(--text-main);
}

.reference-table tr:last-child td {
  border-bottom: none;
}

.reference-table tr:hover td {
  background: rgba(56, 189, 248, 0.04);
}

.align-right {
  text-align: right;
}

.table-caption {
  font-size: 11px !important;
  font-style: italic;
  margin-top: 8px;
  line-height: 1.4;
}

/* ==========================================================================
   Modals & Settings Overlays
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  background: var(--overlay-bg);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: var(--transition-smooth);
}

.modal-card {
  width: 500px;
  max-width: 90%;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(1);
  transition: var(--transition-smooth);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
}

.btn-close-modal:hover {
  color: var(--primary);
}

.modal-body {
  padding: 24px;
  max-height: 400px;
  overflow-y: auto;
}

.help-text {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.form-divider {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 1px;
  margin-top: 24px;
  margin-bottom: 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(9, 13, 22, 0.25);
}

/* Helper Utilities */
.hidden {
  display: none !important;
}

/* Custom glowing polygon styled specifically for Leaflet WKT outline */
.glowing-polygon {
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6));
}

/* ==========================================================================
   Print and PDF Stylesheet (@media print)
   ========================================================================== */
.printable-report-container {
  display: none;
}

@media print {
  html, body {
    height: auto;
    overflow: visible;
    background: #fff;
    color: #000;
    font-size: 12pt;
    font-family: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;
  }
  
  .app-header, .app-main, .modal-overlay, .leaflet-control-container {
    display: none !important;
  }
  
  .printable-report-container {
    display: block !important;
    padding: 20mm;
    background: #fff;
    color: #000;
  }

  .print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10mm;
  }

  .print-client-branding h1 {
    font-size: 18pt;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
  }

  .print-client-branding p {
    font-size: 10pt;
    color: #475569;
  }

  .print-report-metadata {
    font-size: 10pt;
    color: #1e293b;
    text-align: right;
    line-height: 1.5;
  }

  .print-divider {
    border: none;
    border-top: 2px solid #0f172a;
    margin-bottom: 10mm;
  }

  .print-title-section {
    text-align: center;
    margin-bottom: 12mm;
  }

  .print-title-section h2 {
    font-size: 20pt;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
  }

  .print-title-section h3 {
    font-size: 11pt;
    font-weight: 500;
    color: #475569;
    max-width: 80%;
    margin: 0 auto;
    line-height: 1.4;
  }

  .print-details-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8mm;
    font-size: 10.5pt;
  }

  .print-details-table th {
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    font-weight: 700;
    text-align: left;
    padding: 8px 12px;
  }

  .print-details-table td {
    border: 1px solid #cbd5e1;
    padding: 8px 12px;
  }

  .print-details-table td:first-child {
    font-weight: 500;
    width: 45%;
    color: #334155;
  }

  .print-details-table td:last-child {
    color: #000;
  }

  .highlight-table th {
    background-color: #e2e8f0;
  }

  .highlight-table td {
    padding: 10px 12px;
  }

  .align-right {
    text-align: right;
  }

  .total-row td {
    font-weight: 800 !important;
    background-color: #f8fafc;
    border-top: 2px solid #0f172a;
    font-size: 12pt;
    color: #0f172a !important;
  }

  .print-narrative-section {
    margin-bottom: 10mm;
    page-break-inside: avoid;
  }

  .print-narrative-section h4 {
    font-size: 12pt;
    font-weight: 700;
    color: #0f172a;
    border-bottom: 1px solid #94a3b8;
    padding-bottom: 4px;
    margin-bottom: 4px;
    text-transform: uppercase;
  }

  .print-narrative-block {
    font-size: 10.5pt;
    line-height: 1.6;
    color: #334155;
    text-align: justify;
  }

  .page-break-before {
    page-break-before: always;
  }

  .print-signatures {
    display: flex;
    justify-content: space-between;
    margin-top: 20mm;
    page-break-inside: avoid;
  }

  .signature-box {
    width: 45%;
    text-align: center;
    font-size: 10pt;
  }

  .signature-line {
    border-top: 1px dashed #475569;
    margin: 15mm 0 2mm 0;
  }
}
