/* --- MODALS GENERAL STYLING & POSITIONING (Premium Glassmorphism) --- */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(10, 14, 20, 0.75); /* Darker backdrop */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999; /* Fix overlap issues */
  align-items: center;
  justify-content: center;
  padding: 30px 16px;
  animation: fadeIn var(--transition-fast) forwards;
  overflow-y: auto;
}

.modal-content {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp var(--transition-normal) forwards;
  max-height: 85vh; /* Prevent touching screen edges */
}

/* --- FORM MODAL SPECIFICS --- */
.modal-form-large {
  max-width: 800px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  border-bottom: 1px solid var(--border-color);
  background-color: transparent;
}

.modal-header h2 {
  font-family: var(--font-family-serif);
  font-size: 1.25rem;
  color: var(--secondary);
  font-weight: 700;
}

.form-tabs-container {
  display: flex;
  background-color: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 0 10px;
}

.form-tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 14px 10px;
  font-family: var(--font-family-sans);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-bottom: 3px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.form-tab-btn:hover {
  color: var(--text-heading);
  background-color: rgba(255, 255, 255, 0.02);
}

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

#sighting-form {
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Steps Pane Visibility & Scrolling Control */
.form-step-pane {
  display: none;
}

.form-step-pane.active-pane {
  display: block;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  animation: fadeIn var(--transition-fast) forwards;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 24px;
}

.col-span-2 {
  grid-column: span 2;
}

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

.form-group label {
  font-family: var(--font-family-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0.1px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  font-family: var(--font-family-sans);
  font-size: 0.88rem;
  color: var(--text-main);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  padding: 14px 16px;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-heading);
  font-family: var(--font-family-sans);
  font-size: 0.95rem;
  transition: all var(--transition-normal);
  backdrop-filter: blur(5px);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  background-color: rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.form-group input[readonly] {
  background-color: rgba(0, 0, 0, 0.025);
  color: var(--text-muted);
  cursor: not-allowed;
  border-color: rgba(0, 0, 0, 0.08);
}

/* Input Groups for refresh and locate buttons */
.fund-id-input-group,
.geo-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fund-id-input-group input,
.geo-input-group input {
  flex: 1;
}

.fund-id-input-group .btn,
.geo-input-group .btn {
  height: 38px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Form section headers */
.section-divider {
  grid-column: span 2;
  font-family: var(--font-family-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1.5px solid var(--primary);
  padding-bottom: 4px;
  margin-top: 14px;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}

/* Photo drag-and-drop zone */
.photo-upload-zone {
  border: 2px dashed rgba(107, 29, 36, 0.2);
  background-color: rgba(107, 29, 36, 0.01);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
  position: relative;
  min-height: 120px;
}

.photo-upload-zone:hover {
  border-color: var(--primary);
  background-color: rgba(107, 29, 36, 0.02);
}

.upload-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.photo-preview-container {
  position: relative;
  width: 140px;
  aspect-ratio: 1;
  background-color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  border-radius: 2px;
  margin-top: 8px;
}

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

.btn-remove-photo {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  background-color: var(--danger);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: background-color var(--transition-fast), transform var(--transition-fast);
  line-height: 1;
}

.btn-remove-photo:hover {
  background-color: var(--danger-hover);
  transform: scale(1.1);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-surface);
}


/* --- THE SCIENTIFIC DOSSIER (DETAILED FUND-AKTE REDESIGN) --- */
.modal-detail-large {
  max-width: 960px;
}

.btn-close-dossier {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 2.2rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  z-index: 20;
  transition: color var(--transition-fast);
  line-height: 1;
}

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

.modal-header-dossier {
  padding: 24px 30px;
  border-bottom: 2px solid var(--secondary); /* Academic Dark Navy underline */
  background-color: rgba(41, 62, 82, 0.01);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.dossier-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dossier-header-logo {
  width: 32px;
  height: 32px;
  color: var(--secondary);
}

.dossier-header-title h3 {
  font-size: 1.25rem;
  color: var(--secondary);
  line-height: 1.2;
}

.dossier-header-title span {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  display: block;
}

.dossier-header-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dossier-type {
  font-size: 0.68rem;
  color: var(--primary); /* Academic Burgundy mark */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.dossier-id-code {
  font-family: monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--secondary);
}

/* Two-column Dossier Paper Layout */
.detail-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.detail-left-pane {
  width: 34%;
  background-color: rgba(41, 62, 82, 0.015);
  border-right: 1px solid var(--border-color);
  padding: 24px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-right-pane {
  width: 66%;
  padding: 24px 30px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background-color: var(--bg-card);
}

/* Polaroid wrapper with 3D drop shadow & tilt */
.polaroid-wrapper {
  transform: rotate(-1.5deg);
  margin: 10px auto 14px auto;
  max-width: 220px;
}

.polaroid-photo {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 10px 10px 0 10px;
  aspect-ratio: 1.05;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
  position: relative;
}

/* Internal corners detailing */
.polaroid-photo::before {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 12px; height: 12px;
  border-top: 2.5px solid var(--secondary);
  border-left: 2.5px solid var(--secondary);
  z-index: 5;
}

.polaroid-photo::after {
  content: "";
  position: absolute;
  bottom: 0; right: 0; width: 12px; height: 12px;
  border-bottom: 2.5px solid var(--secondary);
  border-right: 2.5px solid var(--secondary);
  z-index: 5;
}

.polaroid-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1px;
}

.polaroid-photo svg {
  width: 32px;
  height: 32px;
  opacity: 0.2;
}

.polaroid-label {
  margin-top: 12px;
  font-family: var(--font-family-serif);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Metadata List under Stammdaten */
.metadata-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 0.84rem;
}

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

.meta-lbl {
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-family-sans);
}

.meta-val {
  color: var(--text-main);
  text-align: right;
  font-weight: 600;
}

.meta-val.code-text {
  font-family: monospace;
  font-size: 0.8rem;
  background-color: rgba(41, 62, 82, 0.05);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  color: var(--secondary);
}

/* Subject Headings on the Right Side */
.dossier-subject-header {
  margin-bottom: 8px;
  border-bottom: 2px solid var(--secondary);
  padding-bottom: 12px;
}

.dossier-subject-header h1 {
  font-family: var(--font-family-serif);
  font-size: 1.8rem;
  color: var(--secondary);
  line-height: 1.2;
}

.dossier-subject-header p {
  font-family: var(--font-family-serif);
  font-style: italic;
  font-size: 1.08rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.detail-section-box {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px;
}

.section-title {
  font-size: 0.98rem;
  color: var(--primary);
  border-bottom: 1.5px solid var(--primary); /* Thick Burgundy marker line */
  padding-bottom: 4px;
  margin-bottom: 4px;
  font-family: var(--font-family-serif);
  letter-spacing: 0.3px;
  font-weight: 700;
}

/* Dossier Document Text Area */
.report-text-block {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 3.5px solid var(--secondary); /* Left structural border */
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.6;
  box-shadow: 0 1px 3px rgba(0,0,0,0.01);
  white-space: pre-wrap;
}

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

.sub-section h5 {
  font-family: var(--font-family-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Open, clean row layout for profile steckbrief */
.detail-steckbrief-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  margin-top: 4px;
}

.detail-steckbrief-table th {
  text-align: left;
  color: var(--text-muted);
  width: 32%;
  padding: 8px 8px 8px 4px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.detail-steckbrief-table td {
  padding: 8px 4px 8px 8px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  font-weight: 500;
}

.detail-steckbrief-table tr:last-child th,
.detail-steckbrief-table tr:last-child td {
  border-bottom: none;
}

/* Section 4: Academic certificate box for Definitives Fazit */
.conclusion-highlight-box {
  background-color: rgba(107, 29, 36, 0.02);
  border: 1.5px dashed rgba(107, 29, 36, 0.25); /* Vintage certificate dash border */
  border-left: 5px solid var(--primary); /* Solid burgundy wax stamp border */
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.01);
  position: relative;
  overflow: visible !important;
  margin-top: 6px;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px;
  min-height: 120px;
  height: auto !important;
}

.dossier-seal-watermark {
  position: absolute;
  bottom: -20px;
  right: -15px;
  width: 110px;
  height: 110px;
  opacity: 0.035;
  color: var(--primary);
  pointer-events: none;
  z-index: 1;
}

.dossier-seal-watermark svg {
  width: 100%;
  height: 100%;
}

.conclusion-text {
  font-family: var(--font-family-serif);
  font-size: 1.02rem;
  color: var(--primary);
  line-height: 1.5;
  position: relative;
  z-index: 2;
}

/* Section 5: Signature line at base of form */
.dossier-signature-line {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-top: 16px;
  position: relative;
  z-index: 2;
}

.sig-line {
  width: 180px;
  border-bottom: 1.5px solid rgba(107, 29, 36, 0.25);
  margin-bottom: 4px;
}

.sig-text {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-family-sans);
  font-weight: 600;
}

/* System Action Buttons in Detail Modal footer (Dossier Footer Action Bar) */
.dossier-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background-color: rgba(41, 62, 82, 0.015);
  border-top: 1px solid var(--border-color);
}

.footer-dossier-note {
  font-family: var(--font-family-sans);
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.right-actions {
  display: flex;
  gap: 8px;
}

/* Custom Scrollbar inside detail pane & form steps */
.detail-left-pane::-webkit-scrollbar,
.detail-right-pane::-webkit-scrollbar,
.form-step-pane::-webkit-scrollbar {
  width: 6px;
}

.detail-left-pane::-webkit-scrollbar-track,
.detail-right-pane::-webkit-scrollbar-track,
.form-step-pane::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.01);
}

.detail-left-pane::-webkit-scrollbar-thumb,
.detail-right-pane::-webkit-scrollbar-thumb,
.form-step-pane::-webkit-scrollbar-thumb {
  background: rgba(107, 29, 36, 0.15);
  border-radius: 3px;
}

.detail-left-pane::-webkit-scrollbar-thumb:hover,
.detail-right-pane::-webkit-scrollbar-thumb:hover,
.form-step-pane::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 29, 36, 0.3);
}

/* --- ZEIGERWERTE SUB-GRID & BADGE CHIPS --- */
.zeigerwerte-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.zeiger-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.zeiger-field label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.zeiger-field select {
  width: 100%;
  height: 38px;
  padding: 6px 26px 6px 10px;
  font-size: 0.82rem;
  font-family: var(--font-family-sans);
  font-weight: 600;
  text-align: center;
  text-align-last: center;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23626a75' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 11px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), background-color var(--transition-fast);
}

.zeiger-field select:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-surface);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.zeiger-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.zeiger-chips-container {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.zeiger-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background-color: var(--primary-glow);
  border: 1.5px solid rgba(107, 29, 36, 0.15);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.01);
}

.zeiger-chip-label {
  color: var(--text-muted);
  font-size: 0.7rem;
}

/* --- Custom Confirm & Prompt Modals (FiveM NUI Safe, No backdrop-filter) --- */
#modal-confirm .modal-content,
#modal-prompt .modal-content {
  background: rgba(26, 26, 32, 0.95);
  border: 1px solid rgba(108, 93, 211, 0.4);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  color: #f7fafc;
  border-radius: var(--radius-md) !important;
}

/* Fix header white background clash in custom confirm/prompt modals */
#modal-confirm .modal-header,
#modal-prompt .modal-header {
  background: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  padding: 0 0 12px 0 !important;
}

#modal-confirm h3,
#modal-prompt h3 {
  color: #f7fafc;
  font-family: var(--font-family-sans) !important;
  font-size: 1.15rem !important;
  font-weight: 700 !important;
}

#modal-confirm button.btn-close,
#modal-prompt button.btn-close {
  color: #a0aec0;
  background: transparent !important;
  border: none !important;
  font-size: 1.6rem !important;
}

#modal-confirm button.btn-close:hover,
#modal-prompt button.btn-close:hover {
  color: #ffffff;
}

#modal-confirm .modal-body-confirm p,
#modal-prompt .modal-body-prompt p {
  color: #cbd5e0;
  font-size: 0.88rem;
}

#modal-prompt input {
  width: 100%;
  padding: 10px 12px;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-family: var(--font-family-sans);
  font-size: 0.88rem;
  outline: none;
  transition: all var(--transition-fast);
}

#modal-prompt input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(180, 70, 80, 0.25);
  background-color: rgba(0, 0, 0, 0.4);
}

/* ============================================= */
/* ======= DARK MODE OVERRIDES (MODALS) ======== */
/* ============================================= */

[data-theme="dark"] .modal-header {
  background-color: var(--bg-surface);
}

[data-theme="dark"] .form-tabs-container {
  background-color: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .form-tab-btn.active {
  background-color: var(--bg-surface);
}

[data-theme="dark"] .form-tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
  background-color: var(--bg-body);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus {
  box-shadow: 0 0 0 3px var(--primary-glow);
}

[data-theme="dark"] .form-group input[readonly] {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .form-actions {
  background-color: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .photo-upload-zone {
  border-color: rgba(180, 70, 80, 0.2);
  background-color: rgba(180, 70, 80, 0.03);
}

[data-theme="dark"] .photo-preview-container {
  background-color: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .zeigerwerte-grid {
  background-color: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .zeiger-field select {
  background-color: var(--bg-body);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.08);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23b44650' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
}

[data-theme="dark"] .zeiger-field select:hover {
  border-color: var(--primary);
  background-color: var(--bg-card);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .zeiger-field select:focus {
  border-color: var(--primary-hover);
  box-shadow: 0 0 0 3px rgba(180, 70, 80, 0.25);
}

/* Dossier detail dark mode */
[data-theme="dark"] .modal-header-dossier {
  background-color: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .detail-left-pane {
  background-color: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .detail-right-pane {
  background-color: var(--bg-surface);
}

[data-theme="dark"] .polaroid-photo {
  background-color: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .meta-row {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .meta-val.code-text {
  background-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .report-text-block {
  background-color: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.05);
  border-left-color: var(--secondary);
}

[data-theme="dark"] .detail-steckbrief-table th {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .detail-steckbrief-table td {
  color: var(--text-main);
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .conclusion-highlight-box {
  background-color: rgba(180, 70, 80, 0.06);
  border-color: rgba(180, 70, 80, 0.2);
}

[data-theme="dark"] .dossier-footer-actions {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Dark scrollbar */
[data-theme="dark"] .detail-left-pane::-webkit-scrollbar-track,
[data-theme="dark"] .detail-right-pane::-webkit-scrollbar-track,
[data-theme="dark"] .form-step-pane::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .detail-left-pane::-webkit-scrollbar-thumb,
[data-theme="dark"] .detail-right-pane::-webkit-scrollbar-thumb,
[data-theme="dark"] .form-step-pane::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}

/* Login modal dark */
[data-theme="dark"] #modal-login .modal-content {
  background-color: var(--bg-surface);
}

[data-theme="dark"] #modal-login input {
  background-color: var(--bg-body);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* --- SPECIES DIRECTORY TABLE --- */
.directory-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.directory-table th {
  background-color: rgba(41, 62, 82, 0.03);
  color: var(--secondary);
  font-family: var(--font-family-sans);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 18px;
  border-bottom: 2px solid var(--secondary);
  text-align: left;
}

[data-theme="dark"] .directory-table th {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  border-bottom-color: var(--border-color);
}

.directory-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-family-sans);
  font-size: 0.88rem;
  vertical-align: middle;
}

.directory-table tbody tr {
  transition: background-color var(--transition-fast);
}

.directory-table tbody tr:hover {
  background-color: rgba(107, 29, 36, 0.015);
}

[data-theme="dark"] .directory-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.01);
}

/* Zebra striping for academic document look */
.directory-table tbody tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.005);
}

[data-theme="dark"] .directory-table tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.003);
}

.directory-scientific-name {
  font-family: var(--font-family-serif);
  font-style: italic;
  font-weight: 500;
  color: var(--primary);
}

.directory-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background-color: var(--primary-glow);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
}

.directory-btn-search {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--primary);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.directory-btn-search:hover {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(107, 29, 36, 0.15);
  transform: translateY(-1px);
}

.directory-btn-search svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

.directory-empty-state {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* Category Pills Styling */
.dir-pill {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 20px;
  font-family: var(--font-family-sans);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  outline: none;
}

.dir-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.dir-pill.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

[data-theme="dark"] .dir-pill {
  background-color: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .dir-pill:hover {
  background-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .dir-pill.active {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(180, 70, 80, 0.2);
}

/* Selected row highlight with accent border on first cell */
.directory-table tbody tr.selected-row {
  background-color: var(--primary-glow) !important;
}

.directory-table tbody tr.selected-row td {
  border-bottom-color: rgba(107, 29, 36, 0.15);
}

.directory-table tbody tr.selected-row td:first-child {
  position: relative;
}

.directory-table tbody tr.selected-row td:first-child::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3.5px;
  background-color: var(--primary);
}

/* Thumbnail Visuals */
.directory-thumbnail {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: block;
}

.directory-thumbnail-fallback {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background-color: var(--bg-main);
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

[data-theme="dark"] .directory-thumbnail-fallback {
  background-color: rgba(255, 255, 255, 0.02);
}

/* --- DETAIL PANEL IMAGES & CHRONOLOGY --- */

/* Carousel Layout */
.dir-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 1.6;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.dir-carousel-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Nav-Buttons for Carousel */
.dir-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.45);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 10;
  outline: none;
}

.dir-carousel-btn:hover {
  background-color: var(--primary);
  transform: translateY(-50%) scale(1.08);
}

.dir-carousel-btn.prev {
  left: 8px;
}

.dir-carousel-btn.next {
  right: 8px;
}

.dir-carousel-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* Carousel Info Overlay */
.dir-carousel-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.76rem;
  font-family: var(--font-family-sans);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 5;
}

.dir-carousel-overlay-text {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.dir-carousel-overlay-counter {
  font-weight: 700;
  font-size: 0.72rem;
  background-color: rgba(255, 255, 255, 0.15);
  padding: 2px 6px;
  border-radius: 10px;
}

/* Chronology Timeline */
.dir-chronology-list {
  max-height: 160px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Slim scrollbars for chronology list */
.dir-chronology-list::-webkit-scrollbar {
  width: 4px;
}

.dir-chronology-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02);
}

.dir-chronology-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.dir-chronology-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.8rem;
  color: var(--text-main);
  position: relative;
  padding-left: 14px;
}

.dir-chronology-item:hover {
  border-color: var(--border-hover);
  background-color: var(--primary-glow);
  transform: translateX(2px);
}

.dir-chronology-item.active {
  background-color: var(--primary-glow);
  border-color: rgba(107, 29, 36, 0.15);
  font-weight: 600;
}

.dir-chronology-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: var(--primary);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.dir-chronology-date {
  color: var(--primary);
  font-weight: 700;
}

.dir-chronology-location {
  color: var(--text-muted);
  font-size: 0.76rem;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- PROFILE MODAL WEBKIT SCROLLBARS --- */
#profile-activity-list::-webkit-scrollbar,
.modal-body-profile::-webkit-scrollbar {
  width: 6px;
}
#profile-activity-list::-webkit-scrollbar-track,
.modal-body-profile::-webkit-scrollbar-track {
  background: transparent;
}
#profile-activity-list::-webkit-scrollbar-thumb,
.modal-body-profile::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 10px;
}
#profile-activity-list::-webkit-scrollbar-thumb:hover,
.modal-body-profile::-webkit-scrollbar-thumb:hover {
  background-color: var(--primary);
}

/* --- FORM WEBKIT SCROLLBARS --- */
#journal-form::-webkit-scrollbar,
#inventory-form::-webkit-scrollbar,
#incident-form::-webkit-scrollbar,
#expedition-form::-webkit-scrollbar,
#sop-form::-webkit-scrollbar {
  width: 6px;
}
#journal-form::-webkit-scrollbar-track,
#inventory-form::-webkit-scrollbar-track,
#incident-form::-webkit-scrollbar-track,
#expedition-form::-webkit-scrollbar-track,
#sop-form::-webkit-scrollbar-track {
  background: transparent;
}
#journal-form::-webkit-scrollbar-thumb,
#inventory-form::-webkit-scrollbar-thumb,
#incident-form::-webkit-scrollbar-thumb,
#expedition-form::-webkit-scrollbar-thumb,
#sop-form::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 10px;
}
#journal-form::-webkit-scrollbar-thumb:hover,
#inventory-form::-webkit-scrollbar-thumb:hover,
#incident-form::-webkit-scrollbar-thumb:hover,
#expedition-form::-webkit-scrollbar-thumb:hover,
#sop-form::-webkit-scrollbar-thumb:hover {
  background-color: var(--primary);
}


@media (max-width: 600px) {
  .modal-body-profile {
    grid-template-columns: 1fr !important;
  }
}

/* --- CUSTOM DROPDOWN SELECT STYLING --- */
.custom-select-container {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  height: 38px;
  padding: 6px 26px 6px 10px;
  font-size: 0.82rem;
  font-family: var(--font-family-sans);
  font-weight: 600;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), background-color var(--transition-fast);
}

.custom-select-trigger-arrow {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 11px;
  height: 11px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23626a75' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  transition: transform var(--transition-fast);
}

.custom-select-container.open .custom-select-trigger-arrow {
  transform: translateY(-50%) rotate(180deg);
}

.custom-select-trigger:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-surface);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.custom-select-container.open .custom-select-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Custom options menu */
.custom-select-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 150;
  max-height: 220px;
  overflow-y: auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  padding: 4px 0;
  opacity: 0;
  transform: scaleY(0.9);
  transform-origin: top;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.custom-select-container.open .custom-select-options {
  display: flex;
  opacity: 1;
  transform: scaleY(1);
}

.custom-select-option {
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.custom-select-option:hover {
  background-color: var(--primary-glow);
  color: var(--primary);
}

.custom-select-option.selected {
  background-color: var(--primary);
  color: #ffffff;
}

/* Options Webkit Scrollbar */
.custom-select-options::-webkit-scrollbar {
  width: 5px;
}
.custom-select-options::-webkit-scrollbar-track {
  background: transparent;
}
.custom-select-options::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 4px;
}
.custom-select-options::-webkit-scrollbar-thumb:hover {
  background-color: var(--primary);
}

/* Dark mode specific rules */
[data-theme="dark"] .custom-select-trigger {
  background-color: var(--bg-body);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .custom-select-trigger-arrow {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23b44650' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
}
[data-theme="dark"] .custom-select-trigger:hover {
  border-color: var(--primary);
  background-color: var(--bg-card);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
[data-theme="dark"] .custom-select-container.open .custom-select-trigger {
  border-color: var(--primary-hover);
  box-shadow: 0 0 0 3px rgba(180, 70, 80, 0.25);
}

[data-theme="dark"] .custom-select-options {
  background-color: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .custom-select-option:hover {
  background-color: var(--primary-glow);
  color: var(--text-heading);
}
[data-theme="dark"] .custom-select-option.selected {
  background-color: var(--primary);
  color: #ffffff;
}

/* Category Tiles Layout */
.category-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  width: 100%;
  margin-top: 6px;
}

.category-tile {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-main);
}

.category-tile:hover {
  border-color: var(--primary);
  background-color: var(--primary-glow);
  transform: translateY(-1px);
}

.category-tile.active {
  border-color: var(--primary);
  background-color: var(--primary);
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(107, 29, 36, 0.15);
}

.category-tile.active .tile-icon {
  transform: scale(1.15);
}

.tile-icon {
  font-size: 1.4rem;
  transition: transform 0.2s ease-in-out;
}

.tile-label {
  font-size: 0.74rem;
  font-weight: 600;
}

[data-theme="dark"] .category-tile {
  background-color: var(--bg-surface);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .category-tile:hover {
  background-color: var(--primary-glow);
}

/* Custom Switch Toggle Styles for Maintenance Mode */
.switch-toggle input:checked + .slider-toggle {
  background-color: var(--primary) !important;
}

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

.switch-toggle input:checked + .slider-toggle::before {
  transform: translateX(22px);
}

/* ==========================================================================
   Ökologische Wetter-Historie Modal (Modern Dashboard Theme)
   ========================================================================== */

#modal-weather-dashboard .modal-content {
  max-width: 960px;
  width: 95%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.4), 0 0 30px rgba(108, 93, 211, 0.1);
  padding: 0;
  overflow: hidden;
}

.weather-dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-color);
}

.weather-dash-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.weather-dash-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(108, 93, 211, 0.2), rgba(255, 117, 151, 0.15));
  border: 1px solid rgba(108, 93, 211, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  box-shadow: 0 4px 15px var(--primary-glow);
  flex-shrink: 0;
}

.weather-dash-icon-box svg {
  width: 24px;
  height: 24px;
}

.weather-dash-title {
  font-family: var(--font-family-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.weather-dash-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.weather-dash-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.weather-dash-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(108, 93, 211, 0.1);
  border: 1px solid rgba(108, 93, 211, 0.25);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.weather-dash-export-btn:hover {
  background: rgba(108, 93, 211, 0.2);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.weather-dash-export-btn svg {
  width: 15px;
  height: 15px;
}

.weather-dash-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.weather-dash-close-btn:hover {
  background: rgba(255, 74, 90, 0.15);
  border-color: rgba(255, 74, 90, 0.4);
  color: var(--danger);
  transform: rotate(90deg);
}

.weather-dash-body {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Toolbar & Filters */
.weather-dash-toolbar {
  display: grid;
  grid-template-columns: 1.3fr 1.1fr 1fr;
  gap: 16px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  align-items: end;
}

[data-theme="light"] .weather-dash-toolbar {
  background: rgba(0, 0, 0, 0.02);
}

.weather-control-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.weather-control-label {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.weather-control-label svg {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}

/* Segmented Buttons for Range */
.weather-range-pills {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  width: 100%;
}

.weather-pill-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 7px 8px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  white-space: nowrap;
}

.weather-pill-btn:hover {
  color: var(--text-heading);
  background: rgba(255, 255, 255, 0.04);
}

.weather-pill-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.weather-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.weather-select-wrapper select {
  width: 100%;
  padding: 9px 32px 9px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all var(--transition-fast);
}

.weather-select-wrapper select:hover:not(:disabled) {
  border-color: var(--border-hover);
}

.weather-select-wrapper select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.weather-select-wrapper select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.05);
}

.weather-select-arrow {
  position: absolute;
  right: 12px;
  pointer-events: none;
  color: var(--text-muted);
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
}

/* Stat KPI Cards */
.weather-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.weather-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.weather-stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background var(--transition-fast);
}

.weather-stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.weather-stat-card.card-current::before { background: linear-gradient(90deg, #ff7597, #ff96b0); }
.weather-stat-card.card-max::before { background: linear-gradient(90deg, #ff5722, #ffa000); }
.weather-stat-card.card-min::before { background: linear-gradient(90deg, #38bdf8, #0ea5e9); }
.weather-stat-card.card-avg::before { background: linear-gradient(90deg, #33d69f, #00b87c); }

.weather-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.weather-stat-val-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weather-stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

/* Trend Badge */
.weather-trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  line-height: 1.2;
}

.weather-trend-badge.trend-up {
  background: rgba(51, 214, 159, 0.15);
  color: #33d69f;
  border: 1px solid rgba(51, 214, 159, 0.3);
}

.weather-trend-badge.trend-down {
  background: rgba(255, 74, 90, 0.15);
  color: #ff4a5a;
  border: 1px solid rgba(255, 74, 90, 0.3);
}

.weather-trend-badge.trend-neutral {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.weather-stat-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Watermark SVG icon inside Stat-Cards */
.weather-stat-icon-bg {
  position: absolute;
  right: 10px;
  bottom: 6px;
  width: 36px;
  height: 36px;
  color: var(--text-heading);
  opacity: 0.05;
  pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.weather-stat-card:hover .weather-stat-icon-bg {
  opacity: 0.1;
  transform: scale(1.08);
}

/* Chart Area */
.weather-chart-wrapper {
  position: relative;
  height: 380px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Footer / Meta bar */
.weather-dash-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: rgba(0, 0, 0, 0.08);
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

[data-theme="light"] .weather-dash-footer {
  background: rgba(0, 0, 0, 0.02);
}

.weather-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.weather-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--emerald);
  box-shadow: 0 0 8px rgba(0, 184, 124, 0.6);
  animation: pulse-weather 2s infinite;
}

@keyframes pulse-weather {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 184, 124, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(0, 184, 124, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 184, 124, 0); }
}

.weather-coords-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-family: monospace;
}

@media (max-width: 768px) {
  .weather-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .weather-dash-header {
    padding: 16px 20px;
  }
  .weather-dash-body {
    padding: 16px 20px;
  }
  .weather-chart-wrapper {
    height: 300px;
  }
}
