/* ============================================================
   JANNING GROUP – Baustellenanmeldung BG BAU  |  page-baustellenanmeldung-bgbau.css
   Theme: Verdant (Light & Dark)
   ============================================================ */

/* Verdant Color System - Light Mode */
:root {
  --primary: #2e7d32;
  --primary-foreground: #ffffff;
  --background: #f8f5f0;
  --foreground: #3e2723;
  --card: #f8f5f0;
  --card-foreground: #3e2723;
  --secondary: #e8f5e9;
  --secondary-foreground: #1b5e20;
  --accent: #c8e6c9;
  --accent-foreground: #1b5e20;
  --muted: #f0e9e0;
  --muted-foreground: #6d4c41;
  --border: #e0d6c9;
  --destructive: #c62828;
  --destructive-foreground: #ffffff;
  --ring: #2e7d32;

  --font-sans: Montserrat, sans-serif;
  --font-condensed: Montserrat, sans-serif;
}

/* Verdant Color System - Dark Mode */
:root.dark {
  --primary: #4caf50;
  --primary-foreground: #0a1f0c;
  --background: #1c2a1f;
  --foreground: #f0ebe5;
  --card: #2d3a2e;
  --card-foreground: #f0ebe5;
  --secondary: #3e4a3d;
  --secondary-foreground: #d7e0d6;
  --accent: #388e3c;
  --accent-foreground: #f0ebe5;
  --muted: #2d3a2e;
  --muted-foreground: #d7cfc4;
  --border: #3e4a3d;
  --destructive: #c62828;
  --destructive-foreground: #f0ebe5;
  --ring: #4caf50;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }
body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  min-height: 100vh;
  line-height: 1.55;
  padding-top: 80px;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ---- HEADER ---- */
.bgbau-header {
  background: var(--card);
  border-bottom: 4px solid var(--primary);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 2px 16px rgba(0,0,0,0.1);
  transition: transform 0.3s ease-in-out, background 0.3s ease, border-color 0.3s ease;
}
.bgbau-header.header-hidden {
  transform: translateY(-100%);
}
.bgbau-header-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 70px;
}
.bgbau-header-stripe {
  width: 2px;
  height: 36px;
  background: var(--primary);
  opacity: 0.5;
  flex-shrink: 0;
}
.bgbau-form-title-block { flex: 1; }
.bgbau-form-title {
  font-family: var(--font-condensed);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  color: var(--muted-foreground);
  text-transform: uppercase;
}

/* Theme Toggle Button */
.bgbau-theme-toggle {
  background: var(--muted);
  border: 1px solid var(--border);
  color: var(--foreground);
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.bgbau-theme-toggle:hover {
  background: var(--primary);
  color: var(--primary-foreground);
}

/* ---- MAIN ---- */
.bgbau-form-container {
  max-width: 1040px;
  margin: 36px auto 60px;
  padding: 0 24px;
}

/* ---- VORLAGEN BUTTONS ---- */
.bgbau-template-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 28px;
  padding: 20px;
  background: var(--card);
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  transition: background 0.3s ease, border-color 0.3s ease;
}
.bgbau-template-label {
  font-family: var(--font-condensed);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  text-transform: uppercase;
  margin-right: 6px;
}
.bgbau-template-btn {
  padding: 10px 20px;
  background: var(--background);
  border: 2px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.2s;
}
.bgbau-template-btn:hover {
  background: rgba(46,125,50,0.1);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}
.bgbau-template-btn:active { transform: translateY(0); }

/* ---- SECTION ---- */
.bgbau-form-section {
  background: var(--card);
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  margin-bottom: 28px;
  overflow: hidden;
  animation: bgbauFadeUp 0.4s ease both;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.bgbau-form-section:nth-child(1) { animation-delay: 0.05s; }
.bgbau-form-section:nth-child(2) { animation-delay: 0.1s; }
.bgbau-form-section:nth-child(3) { animation-delay: 0.15s; }
.bgbau-form-section:nth-child(4) { animation-delay: 0.2s; }

@keyframes bgbauFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bgbau-section-label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  background: var(--background);
  border-bottom: 2px solid var(--primary);
  transition: background 0.3s ease, border-color 0.3s ease;
}
.bgbau-section-num {
  font-family: var(--font-condensed);
  font-weight: 800;
  font-size: 1.65rem;
  color: var(--primary);
  letter-spacing: 0.02em;
  line-height: 1;
  min-width: 36px;
  transition: color 0.3s ease;
}
.bgbau-section-name {
  font-family: var(--font-condensed);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--foreground);
  text-transform: uppercase;
  flex: 1;
  transition: color 0.3s ease;
}

/* ---- FIELDS GRID ---- */
.bgbau-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 24px;
}
.bgbau-field-group { display: flex; flex-direction: column; gap: 6px; }
.bgbau-field-group.full-width { grid-column: 1 / -1; }

.bgbau-field-label {
  font-size: 0.83rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  text-transform: uppercase;
  transition: color 0.3s ease;
}
.bgbau-field-label.required::after {
  content: " *";
  color: var(--primary);
  font-weight: 700;
}

.bgbau-field-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 9px 13px;
  font-family: var(--font-sans);
  font-size: 0.93rem;
  color: var(--foreground);
  background: var(--background);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.3s ease, color 0.3s ease;
  outline: none;
}
.bgbau-field-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46,125,50,0.15);
}
.bgbau-field-input:read-only {
  background: var(--card);
  cursor: default;
}

/* MAP field */
.bgbau-map-field-row {
  display: flex;
  gap: 10px;
  align-items: center;
  position: relative;
}
.bgbau-map-field-row .bgbau-field-input { flex: 1; }

.bgbau-suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 4px 4px;
  z-index: 1000;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transition: background 0.3s ease, border-color 0.3s ease;
}
.bgbau-suggestions-dropdown.hidden { display: none; }
.bgbau-suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
  transition: background 0.2s ease, color 0.2s ease;
}
.bgbau-suggestion-item:hover { background: rgba(46,125,50,0.1); color: var(--primary); }

.bgbau-map-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: var(--card);
  color: var(--foreground);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
  flex-shrink: 0;
}
.bgbau-map-btn:hover { background: rgba(46,125,50,0.1); border-color: var(--primary); color: var(--primary); }
.bgbau-map-btn svg { flex-shrink: 0; }

/* CHECKBOX GROUP */
.bgbau-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 0;
}
.bgbau-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.93rem;
  user-select: none;
  color: var(--foreground);
  transition: color 0.3s ease;
}
.bgbau-check-item input[type="checkbox"] { display: none; }
.bgbau-check-box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--background);
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}
.bgbau-check-item input[type="checkbox"]:checked + .bgbau-check-box {
  background: rgba(46,125,50,0.1);
  border-color: var(--primary);
}
.bgbau-check-item input[type="checkbox"]:checked + .bgbau-check-box::after {
  content: "";
  position: absolute;
  left: 4px; top: 1px;
  width: 6px; height: 10px;
  border: 2px solid var(--primary);
  border-top: none; border-left: none;
  transform: rotate(45deg);
}

/* RADIO GROUP */
.bgbau-radio-group {
  display: flex;
  gap: 16px;
  padding: 4px 0;
}
.bgbau-radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.93rem;
  user-select: none;
  color: var(--foreground);
  transition: color 0.3s ease;
}
.bgbau-radio-item input[type="radio"] { display: none; }
.bgbau-radio-btn {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--background);
  transition: border-color 0.15s;
  position: relative;
}
.bgbau-radio-item input[type="radio"]:checked + .bgbau-radio-btn {
  background: rgba(46,125,50,0.1);
  border-color: var(--primary);
}
.bgbau-radio-item input[type="radio"]:checked + .bgbau-radio-btn::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
}

/* ---- SUBMIT ---- */
.bgbau-submit-area {
  display: flex;
  justify-content: flex-end;
  padding: 8px 0 24px;
}
.bgbau-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 32px;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: 6px;
  font-family: var(--font-condensed);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.12s, box-shadow 0.18s, background 0.3s ease;
  box-shadow: 0 4px 14px rgba(46,125,50,0.3);
}
.bgbau-submit-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(46,125,50,0.4);
}
.bgbau-submit-btn:active { transform: translateY(0); }
.bgbau-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ---- FORM MESSAGE ---- */
.bgbau-form-message {
  padding: 16px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 8px;
  animation: bgbauFadeUp 0.3s ease;
}
.bgbau-form-message.hidden { display: none !important; }
.bgbau-form-message.success {
  background: rgba(46,125,50,0.1);
  border: 1.5px solid rgba(46,125,50,0.3);
  color: var(--primary);
}
.bgbau-form-message.error {
  background: rgba(198,40,40,0.1);
  border: 1.5px solid rgba(198,40,40,0.3);
  color: var(--destructive);
}

/* ---- MAP MODAL ---- */
.bgbau-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bgbauFadeIn 0.2s ease;
  padding: 16px;
}
.bgbau-modal-overlay.hidden { display: none !important; }
@keyframes bgbauFadeIn { from { opacity: 0; } to { opacity: 1; } }

.bgbau-modal-box {
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 740px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.bgbau-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-condensed);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--primary);
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.bgbau-modal-close {
  background: none;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s;
}
.bgbau-modal-close:hover { color: var(--primary); }

.bgbau-map-search-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.3s ease;
}
.bgbau-map-search-row .bgbau-field-input { flex: 1; }
.bgbau-map-search-btn {
  padding: 9px 16px;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.87rem;
  cursor: pointer;
  transition: opacity 0.15s, background 0.3s ease;
  white-space: nowrap;
}
.bgbau-map-search-btn:hover { opacity: 0.85; }

#bgbau-leafletMap {
  flex: 1;
  min-height: 360px;
  width: 100%;
}

.bgbau-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  gap: 12px;
  background: var(--card);
  transition: background 0.3s ease, border-color 0.3s ease;
}
.bgbau-selected-addr {
  font-size: 0.85rem;
  color: var(--muted-foreground);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s ease;
}
.bgbau-selected-addr.has-addr { color: var(--foreground); font-weight: 600; }

/* ---- UTILITIES ---- */
.hidden { display: none !important; }

/* ---- VALIDATION ---- */
.bgbau-field-input.invalid {
  border-color: var(--destructive);
  background: rgba(198,40,40,0.05);
}
.bgbau-invalid-msg {
  font-size: 0.78rem;
  color: var(--destructive);
  margin-top: 3px;
}

/* ---- LOADING SPINNER ---- */
.bgbau-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(46,125,50,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: bgbauSpin 0.7s linear infinite;
}
@keyframes bgbauSpin { to { transform: rotate(360deg); } }

/* ---- RESPONSIVE ---- */
@media (max-width: 680px) {
  .bgbau-fields-grid { grid-template-columns: 1fr; }
  .bgbau-field-group.full-width { grid-column: 1; }
  .bgbau-header-inner { height: auto; padding: 14px 16px; flex-wrap: wrap; gap: 12px; }
  .bgbau-form-container { padding: 0 12px; margin-top: 20px; }
  .bgbau-fields-grid { padding: 16px; gap: 14px; }
  .bgbau-template-buttons { padding: 14px; flex-direction: column; align-items: stretch; }
  .bgbau-template-label { width: 100%; margin-bottom: 8px; }
  .bgbau-template-btn { width: 100%; }
}
