/**
 * FILE:    assets/css/cookie.css
 * PATH:    gerust-bau/assets/css/cookie.css
 * FUNCTION: Cookie consent banner + legal modals. WCAG 2.2 AA, min contrast 5:1.
 * VERSION: 2.0.0
 * HISTORY:
 *   1.0.0 - 2025-04-01 - Initial release.
 *   2.0.0 - 2025-04-01 - Banner always visible until confirmed (no auto-dismiss).
 *                         Added dark overlay backdrop. Improved mobile layout.
 *                         Higher z-index (9999) to sit above all page elements.
 */

/* ── Cookie banner backdrop ──────────────────────────────────────────── */
/* Darkens the page behind the banner to draw attention */
#cookie-banner::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 42, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: -1;
  opacity: 0;
  transition: opacity .4s;
  pointer-events: none;
}
#cookie-banner.cb-show::before {
  opacity: 1;
}

/* ── Cookie banner ────────────────────────────────────────────────────── */
#cookie-banner {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 3rem));
  z-index: 9999;           /* above everything */
  width: min(660px, calc(100vw - 2rem));
  background: #0c1028;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, .6),
    0 0 0 1px rgba(255, 255, 255, .05);
  opacity: 0;
  transition:
    transform .45s cubic-bezier(.19, 1, .22, 1),
    opacity .35s ease;
  will-change: transform, opacity;
}

#cookie-banner.cb-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Inner layout ────────────────────────────────────────────────────── */
.cb-inner {
  padding: 1.35rem 1.5rem;
}

.cb-body {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.cb-icon {
  font-size: 1.85rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: .05rem;
}

.cb-text strong {
  display: block;
  font-size: .975rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: .4rem;
  font-family: 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.cb-text p {
  font-size: .84rem;
  color: rgba(255, 255, 255, .62);
  line-height: 1.65;
  margin: 0 0 .5rem;
}

.cb-link {
  font-size: .79rem;
  color: #C9D2FF;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color .2s;
}
.cb-link:hover { color: #fff; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.cb-actions {
  display: flex;
  gap: .65rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.cb-btn {
  font-family: 'Barlow Condensed', 'Source Sans 3', sans-serif;
  font-size: .88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .6rem 1.35rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background .2s, transform .15s, box-shadow .2s;
  white-space: nowrap;
}

.cb-btn:focus-visible {
  outline: 3px solid #C9D2FF;
  outline-offset: 3px;
}

.cb-reject {
  background: rgba(255, 255, 255, .09);
  color: rgba(255, 255, 255, .8);
  border: 1px solid rgba(255, 255, 255, .18);
}
.cb-reject:hover {
  background: rgba(255, 255, 255, .15);
  color: #fff;
  transform: translateY(-1px);
}

.cb-accept {
  background: #1331D4;
  color: #fff;
  box-shadow: 0 2px 12px rgba(19, 49, 212, .45);
}
.cb-accept:hover {
  background: #1E3FE8;
  box-shadow: 0 4px 20px rgba(19, 49, 212, .6);
  transform: translateY(-1px);
}

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  #cookie-banner {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    transform: translateY(calc(100% + 1rem));
    border-radius: 12px 12px 0 0;
  }
  #cookie-banner.cb-show {
    transform: translateY(0);
  }
  .cb-inner { padding: 1.1rem 1.15rem; }
  .cb-actions { flex-direction: column; gap: .5rem; }
  .cb-btn { width: 100%; text-align: center; padding: .7rem 1rem; }
  .cb-accept { order: -1; } /* Accept first on mobile */
}

/* ==========================================================================
   LEGAL MODALS  (Impressum / Datenschutz)
   ========================================================================== */
.legal-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1900;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.legal-modal.open { display: flex; }

.legal-modal-card {
  background: #fff;
  border-radius: 12px;
  width: min(780px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 80px rgba(0, 0, 0, .35);
  overflow: hidden;
}

.legal-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, .09);
  background: #0A1A63;
  flex-shrink: 0;
}
.legal-modal-head h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #fff;
  margin: 0;
}

.legal-modal-close {
  background: rgba(255, 255, 255, .12);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  flex-shrink: 0;
}
.legal-modal-close:hover { background: rgba(255, 255, 255, .22); }
.legal-modal-close:focus-visible { outline: 3px solid #C9D2FF; }

.legal-modal-body {
  overflow-y: auto;
  padding: 1.75rem 2rem;
  flex: 1;
  font-size: .92rem;
  line-height: 1.8;
  color: #1e293b;
}
.legal-modal-body h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #0A1A63;
  margin: 1.5rem 0 .5rem;
  padding-bottom: .35rem;
  border-bottom: 2px solid #C9D2FF;
}
.legal-modal-body h3:first-child { margin-top: 0; }
.legal-modal-body p  { margin-bottom: .75rem; }
.legal-modal-body a  { color: #1331D4; }
.legal-modal-body a:hover { text-decoration: underline; }
.legal-modal-body strong { color: #0A1A63; }
.legal-modal-body ul { padding-left: 1.4rem; margin-bottom: .75rem; }
.legal-modal-body ul li { margin-bottom: .3rem; }
.legal-modal-body .address-block {
  background: #F7F8FD;
  border-left: 3px solid #1331D4;
  padding: .75rem 1rem;
  border-radius: 0 6px 6px 0;
  margin: .75rem 0;
  font-size: .88rem;
}

@media (max-width: 600px) {
  .legal-modal-body { padding: 1.25rem; }
  .legal-modal-head { padding: .9rem 1.1rem; }
}
