/* =========================================================
   ALDI DX – EDI Download Hub
   Stylesheet (ALDI DX Visual Guideline konform)
   ========================================================= */

/* ---------------------------------------------------------
   1) Schrift einbinden
   Dateien liegen in assets/fonts/ – siehe SCHRIFT-UND-LOGO.md
   Nur Regular (400) und Bold (700) vorhanden!
   --------------------------------------------------------- */
@font-face{
  font-family: "ALDI SUED Office";
  src: url("../assets/fonts/ALDI-SUED-Office-Regular.woff2") format("woff2"),
       url("../assets/fonts/ALDI-SUED-Office-Regular.ttf")   format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face{
  font-family: "ALDI SUED Office";
  src: url("../assets/fonts/ALDI-SUED-Office-Bold.woff2") format("woff2"),
       url("../assets/fonts/ALDI-SUED-Office-Bold.ttf")   format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root{
  /* --- Schrift --- */
  --font-brand: "ALDI SUED Office", system-ui, -apple-system, "Segoe UI",
                Roboto, Helvetica, Arial, sans-serif;

  /* Nur 400 und 700 sind als Schnitte vorhanden.
     Keine Zwischenwerte verwenden – sonst rechnet der Browser
     einen künstlichen Fettschnitt (Faux Bold) hoch. */
  --fw-body: 400;
  --fw-med:  400;
  --fw-bold: 700;

  /* --- Farben laut Visual Guideline --- */
  --aldi-blue:      #00005e;              /* ALDI dark blue, Hauptfarbe */
  --aldi-blue-80:   rgba(0,0,94,.80);
  --aldi-blue-soft: rgba(0,0,94,.25);
  --aldi-blue-faint:rgba(0,0,94,.07);
  --aldi-yellow:    #ffc700;
  --aldi-orange:    #ff7800;
  --aldi-red:       #d70000;

  --bg:#f5f6fa;
  --surface:#ffffff;
  --text:#11142b;
  --muted:#5b6476;
  --border: rgba(0,0,94,.14);
  --border-soft: rgba(0,0,94,.07);
  --danger: var(--aldi-red);

  --radius:14px;
  --radius-sm:10px;
  --container: 1180px;

  /* --- Logo --- */
  /* ADX_Logo: Mindesthöhe 5 mm | 75 px laut Guideline */
  --logo-h: 76px;
  /* Schutzzone = Höhe des "A". Im ADX_Logo entspricht das
     rund der halben Logohöhe – bei Bedarf hier nachjustieren. */
  --logo-safe: calc(var(--logo-h) * .5);
}

*{ box-sizing:border-box; }

html{ scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
}

body{
  margin:0;
  font-family: var(--font-brand);
  background: var(--bg);
  color: var(--text);
  line-height:1.5;
  font-weight: var(--fw-body);
  /* Verhindert künstliche Schnitte, wenn ein Gewicht fehlt */
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}

body.is-modal-open{ overflow: hidden; }

.container{
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

a{ color: inherit; }

.visually-hidden{
  position:absolute;
  width:1px; height:1px;
  padding:0; margin:-1px;
  overflow:hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border:0;
}

/* ---------- Fokus (A11y) ---------- */
:focus-visible{
  outline: 3px solid var(--aldi-blue);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link{
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--aldi-blue);
  color:#fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: var(--fw-bold);
  text-decoration: none;
}
.skip-link:focus{ left: 0; }

/* ---------- Topbar ---------- */
.topbar{
  background:#fff;
  border-bottom: 1px solid var(--border);
}
.topbar-inner{
  padding: 14px 0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- Logo ----------
   Positivversion (dark blue) auf weißem Grund.
   Keine Beschneidung, kein Rahmen, keine Verzerrung –
   ausschließlich die Höhe wird gesetzt, die Breite folgt.
   Die Schutzzone wird als Innenabstand reserviert.        */
.brand{
  display:inline-flex;
  align-items:center;
  /* Schutzzone links/oben/unten; rechts trennt der Flex-Gap */
  padding: calc(var(--logo-safe) * .5) var(--logo-safe)
           calc(var(--logo-safe) * .5) 0;
  text-decoration: none;
}

.brand-logo{
  height: var(--logo-h);
  width: auto;            /* niemals fixieren – sonst Verzerrung */
  max-width: 100%;
  display: block;
}

/* Kompaktvariante: ADX_Icon ab kleinen Viewports */
.brand-logo--icon{ display: none; }

@media (max-width: 640px){
  :root{ --logo-h: 40px; }
  .brand-logo--full{ display: none; }
  .brand-logo--icon{ display: block; }
}

.topbar-right{
  display:flex;
  align-items:center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content:flex-end;
}

/* ---------- Selects / Sprache ---------- */
.lang{ display:flex; align-items:center; gap: 10px; }
.lang-label{ color: var(--muted); font-size: .9rem; }

.select{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 10px;
  background: #fff;
  font-family: inherit;
  font-size: .95rem;
  font-weight: var(--fw-med);
  color: var(--text);
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero{ padding: 26px 0 12px; }
.hero h1{
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem);
  font-weight: var(--fw-bold);
  color: var(--aldi-blue);
  letter-spacing: -.01em;
}
.lead{ margin:0; color: var(--muted); max-width: 70ch; }

/* ---------- Panels / Sections ---------- */
.panel{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.section{
  margin: 18px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow:hidden;
}

.section-head{
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.section-head h2{
  margin:0;
  font-weight: var(--fw-bold);
  font-size: 1.1rem;
  color: var(--aldi-blue);
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}

.count-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 26px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--aldi-blue-faint);
  color: var(--aldi-blue);
  font-size: .82rem;
  font-weight: var(--fw-bold);
  line-height: 1.6;
}
.count-badge.is-empty{
  background: rgba(17,20,43,.06);
  color: var(--muted);
}

.section.is-empty .section-head h2 > span:first-child{ color: var(--muted); }

.section-actions{ display:flex; gap: 10px; align-items:center; }

.js-toggle{ display:inline-flex; align-items:center; gap: 8px; }
.chev{
  display:inline-block;
  transition: transform .18s ease;
  font-size: .9em;
  line-height: 1;
}
.section.is-collapsed .chev{ transform: rotate(-90deg); }

/* ---------- Filter ---------- */
.filter-panel{ padding: 16px; }

.filter-row--search{ margin-bottom: 12px; }

.filter-row--selects{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.filter-footer{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 860px){
  .filter-row--selects{ grid-template-columns: 1fr; }
  .filter-footer{ align-items: stretch; }
}

.field{
  display:flex;
  flex-direction:column;
  gap: 7px;
  min-width: 0;
}
.field label{
  font-weight: var(--fw-bold);
  color: var(--text);
  font-size: .92rem;
}

.filter-hint{
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
}

/* ---------- Inputs ---------- */
.input{
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: inherit;
  font-weight: var(--fw-body);
  color: var(--text);
  font-size: 0.98rem;
}
.input::placeholder{ color: rgba(91,100,118,.85); }
.input:hover{ border-color: var(--aldi-blue-soft); }
.input:focus{ border-color: var(--aldi-blue); }

/* ---------- Buttons ---------- */
.btn{
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background:#fff;
  cursor:pointer;
  font-weight: var(--fw-bold);
  font-family: inherit;
  font-size: .95rem;
  color: var(--text);
  text-decoration: none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
}

.btn.primary{
  background: var(--aldi-blue);
  border-color: var(--aldi-blue);
  color: #fff;
}
.btn.primary:hover{ background: var(--aldi-blue-80); }

.btn.ghost{
  background: #fff;
  color: var(--aldi-blue);
  border-color: var(--aldi-blue-soft);
}
.btn.ghost:hover{ border-color: var(--aldi-blue); background: var(--aldi-blue-faint); }

.smallbtn{
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
}

/* ---------- Dateiliste ---------- */
.filelist{
  list-style:none;
  padding: 6px 18px 14px;
  margin:0;
}

.filerow{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  transition: background-color .3s ease;
}
.filerow:last-child{ border-bottom:0; }

.filerow.is-highlighted{
  background: var(--aldi-blue-faint);
  box-shadow: 0 0 0 8px var(--aldi-blue-faint);
}

.filemeta{
  display:flex;
  flex-direction:column;
  gap: 4px;
  min-width:0;
}

.filetitle{
  font-weight: var(--fw-bold);
  word-break: break-word;
}

.filedes{
  color: var(--muted);
  font-size: .92rem;
}

.filetags{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.tag{
  font-size: .78rem;
  font-weight: var(--fw-med);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
}

.fileside{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap: 8px;
  min-width: 220px;
}

.filedetails{
  color: var(--muted);
  font-size: .88rem;
  text-align:right;
  line-height: 1.35;
}

.fileactions{
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.dl{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 104px;
  height: 40px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--aldi-blue-soft);
  background: #fff;
  color: var(--aldi-blue);
  font-weight: var(--fw-bold);
  font-size: .95rem;
  line-height: 1;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
}

.dl:hover{
  border-color: var(--aldi-blue);
  background: var(--aldi-blue-faint);
}

/* Leerzustand – sichtbar auf- UND zugeklappt */
.placeholder{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 16px 0;
  color: var(--muted);
}

.js-filelist.is-collapsed > li{ display:none; }
.js-filelist.is-collapsed > li.placeholder{ display:flex; }

/* ---------- Footer ---------- */
.footer{ padding: 18px 0 34px; }
.footer-links{
  display:flex;
  gap: 18px;
  flex-wrap:wrap;
}
.footer-links a{
  color: var(--aldi-blue);
  text-decoration:none;
  font-weight: var(--fw-med);
}
.footer-links a:hover{ text-decoration: underline; }

/* ---------- Suche / Autocomplete ---------- */
.search-wrap{ position: relative; }

.search-dropdown{
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  margin: 0;
  padding: 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0,0,94,.14);
  z-index: 30;
  overflow: hidden;
  max-height: 340px;
  overflow-y: auto;
  transform-origin: top;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .14s ease, transform .18s ease;
  pointer-events: none;
}

.search-dropdown.is-open{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.search-item{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  background: transparent;
  text-align:left;
}

.search-item + .search-item{ border-top: 1px solid var(--border-soft); }

.search-item:hover,
.search-item.is-active{ background: var(--aldi-blue-faint); }

.search-item .left{ min-width: 0; }

.search-item .title{
  font-weight: var(--fw-bold);
  color: var(--text);
  word-break: break-word;
}

.search-item .sub{
  color: var(--muted);
  font-size: .88rem;
  margin-top: 2px;
  word-break: break-word;
}

.search-item .cat{
  white-space: nowrap;
  color: var(--muted);
  font-weight: var(--fw-med);
  font-size: .85rem;
  margin-top: 2px;
}

.search-empty{
  padding: 12px 14px;
  color: var(--muted);
  font-size: .92rem;
}

/* ---------- Modal ---------- */
.modal{
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(255,255,255,.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal.is-open{ display:flex; }

.modal-card{
  width: min(980px, 100%);
  height: min(84vh, 760px);
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0,0,0,.35);
  display:flex;
  flex-direction:column;
}

.modal-head{
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}

.modal-title{
  margin: 0;
  font-size: 1rem;
  font-weight: var(--fw-bold);
  color: var(--aldi-blue);
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-actions{
  display:flex;
  gap: 8px;
  align-items:center;
  flex-shrink: 0;
}

.icon-x{
  border: 1px solid var(--border);
  background:#fff;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor:pointer;
  font-weight: var(--fw-bold);
  font-family: inherit;
  line-height: 1;
}
.icon-x:hover{ background: var(--aldi-blue-faint); }

/* PDF-Host: iframe wird zur Laufzeit erzeugt und beim Schließen entfernt */
.modal-body{
  flex: 1;
  background: #f8fafc;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.modal-body iframe{
  flex: 1;
  width: 100%;
  border: 0;
  display: block;
  min-height: 0;
}

/* ---------- Impressum-Modal ---------- */
.legal-modal-body{
  padding: 20px;
  overflow: auto;
  display: block;
}

.legal-content{ max-width: 820px; }

.legal-content h3{
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: var(--fw-bold);
  color: var(--aldi-blue);
}

.legal-content h3:not(:first-child){ margin-top: 22px; }

.legal-content p{
  margin: 0;
  white-space: pre-line;
  line-height: 1.6;
  color: var(--text);
  font-size: .97rem;
}

/* ---------- Datenschutz-Modal ----------
   Nutzt dieselbe Basis wie das Impressum (.legal-content)
   und ergänzt nur Listen, Unterüberschriften und Links.   */
.privacy-content > p:not(:first-child){ margin-top: 10px; }

.privacy-content h4{
  margin: 18px 0 6px;
  font-size: .97rem;
  font-weight: var(--fw-bold);
  color: var(--text);
}

.privacy-content .legal-basis{
  font-weight: var(--fw-body);
  color: var(--muted);
}

.privacy-content ul{
  margin: 8px 0 0;
  padding-left: 22px;
  line-height: 1.6;
  font-size: .97rem;
  color: var(--text);
}

.privacy-content ul ul{ margin-top: 4px; }

.privacy-content li + li{ margin-top: 4px; }

.privacy-content a{
  color: var(--aldi-blue);
  word-break: break-word;
}

.privacy-content .legal-meta{
  margin-top: 26px;
  color: var(--muted);
  font-size: .88rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px){
  .filerow{ flex-direction: column; gap: 10px; }

  .fileside{
    min-width: 0;
    width: 100%;
    align-items: flex-start;
  }

  .filedetails{ text-align:left; }

  .fileactions{ justify-content: flex-start; width: 100%; }
  .dl{ flex: 1 1 auto; }

  .modal-card{ width: 100%; height: 92vh; }
  .legal-modal-body{ padding: 16px; }
}
