/* ===========================================================================
   postleitzahlenkarten-software.de · p17 GmbH
   Corporate Design: Premium-Gold + Geschäftsbereich Geomarketing
   Schriften: Oswald (Texte/Überschriften) · Caveat (Buttons)
   =========================================================================== */

:root {
    /* Premium-Gold (Leitfarbe der Marke) */
    --gold:        #C6A75C;
    --gold-light:  #D8BF86;
    --gold-dark:   #9E8444;
    --gold-deep:   #6B5D37;
    --gold-soft:   #f3ecdc;   /* sehr heller Goldton für Flächen */

    /* Geomarketing (Akzent) */
    --geo:         #a7323d;
    --geo-light:   #c85a65;
    --geo-dark:    #801f28;
    --geo-comp:    #32a798;   /* Komplementär (türkis) */

    /* Basis / Neutraltöne */
    --ink:     #191919;
    --ink-2:   #323232;
    --gray:    #595959;
    --gray-2:  #737373;
    --line:    #e6e1d6;
    --bg:      #ffffff;
    --surface: #ffffff;

    --radius: 12px;
    --radius-sm: 7px;
    --shadow: 0 2px 12px rgba(107,93,55,.10);
    --shadow-lg: 0 14px 36px rgba(25,25,25,.16);
    --maxw: 1280px;
    --topbar-h: 40px;
    --nav-h: 72px;

    --f-body: "Oswald", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --f-hand: "Caveat", "Segoe UI", cursive;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: var(--f-body);
    font-weight: 300;
    color: var(--ink-2);
    background: var(--bg);
    line-height: 1.65;
    font-size: 16px;
    letter-spacing: .15px;
    -webkit-font-smoothing: antialiased;
}

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

a { color: var(--geo); text-decoration: none; }
a:hover { color: var(--geo-dark); text-decoration: underline; }

h1, h2, h3, h4 { font-weight: 500; line-height: 1.2; color: var(--ink); letter-spacing: .3px; }

/* ----------------------------- Buttons (Caveat) ----------------------------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--f-hand); font-weight: 700; font-size: 1.35rem; line-height: 1;
    cursor: pointer; padding: 10px 26px 8px; border-radius: var(--radius-sm);
    border: 2px solid transparent; transition: background .15s, border-color .15s, color .15s, transform .05s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--gold); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--gold-dark); color: #fff; }
.btn-accent  { background: var(--geo); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--geo-dark); color: #fff; }
.btn-ghost   { background: #fff; color: var(--gold-deep); border-color: var(--gold); }
.btn-ghost:hover:not(:disabled) { background: var(--gold-soft); color: var(--gold-deep); }
.btn-block { width: 100%; }

/* ----------------------------- Header / Nav ----------------------------- */

.site-header { position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow); }

.topbar {
    background: var(--gold-dark); color: #fff8ec;
    font-size: .82rem; letter-spacing: .4px;
}
.topbar .container { display: flex; align-items: center; justify-content: space-between;
    min-height: var(--topbar-h); gap: 16px; flex-wrap: wrap; }
.topbar a { color: #fff; }
.topbar a:hover { color: #fff; text-decoration: underline; }
.topbar-left  { display: flex; gap: 18px; flex-wrap: wrap; }
.topbar-right { display: flex; gap: 18px; flex-wrap: wrap; }

.navbar { background: #fff; }
.navbar .container { display: flex; align-items: center; justify-content: space-between;
    min-height: var(--nav-h); gap: 16px; }

.brand { display: flex; align-items: center; gap: 14px; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; border-radius: 8px; box-shadow: 0 2px 8px rgba(167,50,61,.25); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-weight: 600; font-size: 1.15rem; color: var(--ink); text-transform: uppercase;
    letter-spacing: .5px; }
.brand-sub   { font-size: .72rem; color: var(--gold-dark); text-transform: uppercase;
    letter-spacing: 1.6px; font-weight: 400; }

.site-nav { display: flex; gap: 6px; align-items: center; }
.nav-link {
    color: var(--ink-2); font-size: 1rem; font-weight: 400; text-transform: uppercase;
    letter-spacing: .6px; padding: 10px 16px; border-radius: var(--radius-sm);
    transition: background .15s, color .15s; white-space: nowrap;
}
.nav-link:hover { background: var(--gold-soft); color: var(--gold-deep); text-decoration: none; }
.nav-link.is-active { color: #fff; background: var(--gold); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0;
    cursor: pointer; padding: 10px; }
.nav-toggle span { width: 26px; height: 3px; background: var(--gold-dark); display: block; border-radius: 3px;
    transition: transform .2s, opacity .2s; }

/* ----------------------------- Footer ----------------------------- */

.site-footer { background: var(--gold-soft); color: var(--ink-2); margin-top: 56px;
    border-top: 4px solid var(--gold); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between;
    padding: 44px 24px; }
.footer-col { min-width: 240px; }
.footer-contact { display: flex; gap: 16px; }
.footer-logo { border-radius: 8px; flex: 0 0 auto; box-shadow: 0 2px 8px rgba(167,50,61,.25); }
.footer-address { display: flex; flex-direction: column; gap: 2px; font-size: .95rem; }
.footer-address strong { color: var(--ink); font-size: 1.1rem; font-weight: 600; margin-bottom: 4px;
    text-transform: uppercase; letter-spacing: .5px; }
.footer-address a { color: var(--geo-dark); }

.footer-heading { color: var(--gold-deep); font-size: .92rem; text-transform: uppercase;
    letter-spacing: 1.6px; font-weight: 600; margin: 0 0 14px; }
.footer-links ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.footer-links a { color: var(--ink-2); font-size: .95rem; }
.footer-links a:hover { color: var(--gold-deep); }

.footer-bottom { border-top: 1px solid var(--gold-light); font-size: .85rem; color: var(--gold-deep); }
.footer-bottom .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
    padding-top: 16px; padding-bottom: 16px; }

/* ----------------------------- Cookie-Banner ----------------------------- */

.cookie-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    background: #fff; border-top: 4px solid var(--gold); box-shadow: 0 -8px 28px rgba(0,0,0,.18); }
.cookie-inner { display: flex; align-items: center; gap: 24px; padding: 18px 24px; flex-wrap: wrap; }
.cookie-text { margin: 0; font-size: .92rem; color: var(--ink-2); flex: 1 1 420px; }
.cookie-actions { display: flex; gap: 12px; flex: 0 0 auto; }

/* ----------------------------- Inhalts-Seiten ----------------------------- */

.content-page { padding: 52px 24px; max-width: 900px; }
.content-page h1 { font-size: 2.4rem; margin: 0 0 10px; color: var(--gold-deep); }
.content-page h1 + .lead { color: var(--gray); font-size: 1.2rem; font-weight: 300; margin-bottom: 30px; }
.content-page h2 { font-size: 1.55rem; margin: 40px 0 12px; padding-bottom: 8px; color: var(--gold-dark);
    border-bottom: 2px solid var(--gold-light); }
.content-page h3 { font-size: 1.2rem; margin: 26px 0 8px; color: var(--ink); }
.content-page p, .content-page li { color: var(--ink-2); }
.content-page ul { padding-left: 22px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 22px;
    margin: 30px 0; }
.card { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--gold);
    border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; color: var(--gold-dark); }

.cta-box { background: var(--gold); color: #fff; border-radius: var(--radius); padding: 30px;
    margin: 36px 0; display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center;
    justify-content: space-between; box-shadow: var(--shadow); }
.cta-box h2 { color: #fff; border: 0; margin: 0; }
.cta-box p { color: #fff8ec; margin: 4px 0 0; }
.cta-box .btn-accent { background: var(--geo); }
.cta-box .btn-accent:hover { background: var(--geo-dark); }

/* ============================ ANWENDUNG ============================ */

.page-app .site-main { padding: 0; }

.app { display: grid; grid-template-columns: 390px 1fr; gap: 0; align-items: stretch;
    min-height: calc(100vh - var(--topbar-h) - var(--nav-h)); }

.app-panel { background: #fff; border-right: 1px solid var(--line); padding: 26px;
    overflow-y: auto; max-height: calc(100vh - var(--topbar-h) - var(--nav-h)); }
.app-title { font-size: 1.7rem; margin: 0 0 8px; color: var(--gold-deep); }
.app-intro { font-size: .96rem; color: var(--gray); margin: 0 0 24px; }

.ctl { margin-bottom: 24px; }
.ctl-label { display: block; font-size: .82rem; font-weight: 500; text-transform: uppercase;
    letter-spacing: 1px; color: var(--gold-deep); margin-bottom: 9px; }
.ctl-hint { font-size: .86rem; color: var(--gray); margin: 0 0 9px; font-weight: 300; }
.ctl-hint code { background: var(--gold-soft); padding: 1px 6px; border-radius: 4px; font-size: .9em;
    color: var(--gold-deep); }
.ctl-actions { border-top: 1px solid var(--line); padding-top: 20px; display: flex;
    flex-direction: column; gap: 12px; }

.seg { display: inline-flex; background: var(--gold-soft); border: 1px solid var(--gold-light);
    border-radius: var(--radius-sm); padding: 4px; gap: 4px; width: 100%; }
.seg-btn { flex: 1; border: 0; background: transparent; color: var(--gold-deep); cursor: pointer;
    font-family: var(--f-body); font-size: .92rem; font-weight: 400; text-transform: uppercase;
    letter-spacing: .4px; padding: 9px 6px; border-radius: 5px; transition: background .15s, color .15s; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active { background: var(--gold); color: #fff; }
.seg-small { max-width: 200px; }
.seg-small .seg-btn { padding: 7px; }

.select, .textarea, .color-input, .text-input {
    width: 100%; font-family: var(--f-body); font-weight: 300; font-size: .95rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 11px;
    background: #fff; color: var(--ink); }
.select:focus, .textarea:focus, .text-input:focus { outline: 2px solid var(--gold-light);
    border-color: var(--gold); }
.textarea { resize: vertical; margin-bottom: 10px; }
.color-input { height: 44px; padding: 4px; cursor: pointer; }
#numeric-options .ctl-label { margin-top: 16px; }
#numeric-options .ctl-label:first-child { margin-top: 0; }

.table-wrap > summary { cursor: pointer; font-weight: 400; color: var(--gold-dark);
    text-transform: uppercase; letter-spacing: .5px; padding: 8px 0; font-size: .9rem; }
.plz-table-scroll { max-height: 320px; overflow-y: auto; border: 1px solid var(--line);
    border-radius: var(--radius-sm); margin-top: 8px; }
.plz-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.plz-table th { position: sticky; top: 0; background: var(--gold-soft); text-align: left;
    padding: 9px 10px; font-size: .74rem; text-transform: uppercase; letter-spacing: .6px;
    color: var(--gold-deep); font-weight: 500; border-bottom: 1px solid var(--gold-light); }
.plz-table td { padding: 4px 8px; border-bottom: 1px solid var(--gold-soft); }
.plz-table tr:hover td { background: var(--gold-soft); }
.plz-table .pcode { font-weight: 500; color: var(--geo); width: 46px; }
.plz-table input { width: 100%; border: 1px solid transparent; background: transparent;
    font-family: var(--f-body); font-weight: 300; font-size: .9rem; padding: 4px 6px; border-radius: 4px; }
.plz-table input:hover { border-color: var(--line); }
.plz-table input:focus { outline: 0; border-color: var(--gold); background: #fff; }

.export-group { display: flex; gap: 12px; }
.export-group .btn { flex: 1; }
.export-hint { font-size: .82rem; color: var(--gray); margin: 0; font-weight: 300; }

/* ----------------------------- Karte ----------------------------- */

.app-map { display: flex; flex-direction: column; background: var(--gold-soft); }
.map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 22px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.check { font-size: .92rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer; }
.check input { accent-color: var(--gold); }
.map-status { font-size: .85rem; color: var(--gold-deep); }

.map-stage { position: relative; flex: 1; padding: 18px; display: flex; min-height: 480px; }
.map-svg-host { flex: 1; display: flex; align-items: center; justify-content: center; }
.map-svg-host svg { width: 100%; height: 100%;
    max-height: calc(100vh - var(--topbar-h) - var(--nav-h) - 130px); }

.plz-shape { stroke: #ffffff; stroke-width: .5; cursor: pointer;
    transition: fill .12s, stroke .12s; }
.plz-shape:hover { stroke: var(--ink); stroke-width: 1.2; }
.plz-label { font: 600 9px var(--f-body); fill: #2c2c2c; pointer-events: none; text-anchor: middle; }

.legend { position: absolute; top: 30px; right: 30px; background: rgba(255,255,255,.97);
    border: 1px solid var(--gold-light); border-top: 4px solid var(--gold); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 15px 17px; max-width: 270px; max-height: 70%; overflow-y: auto; }
.legend-title { font-weight: 500; font-size: .84rem; text-transform: uppercase; letter-spacing: .8px;
    color: var(--gold-deep); margin-bottom: 11px; }
.legend-items { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--ink-2); }
.legend-swatch { width: 18px; height: 18px; border-radius: 4px; flex: 0 0 auto;
    border: 1px solid rgba(0,0,0,.15); }
.legend-item input[type=color] { width: 24px; height: 24px; padding: 0; border: 0; background: none;
    cursor: pointer; flex: 0 0 auto; }

.map-tooltip { position: absolute; pointer-events: none; background: var(--ink); color: #fff;
    padding: 8px 12px; border-radius: 7px; font-size: .86rem; box-shadow: var(--shadow-lg);
    z-index: 5; max-width: 240px; transform: translate(-50%, -125%); }
.map-tooltip b { color: var(--gold-light); }

.map-credit { position: absolute; left: 18px; right: 18px; bottom: 18px; font-size: .74rem;
    color: var(--gold-deep); background: rgba(255,255,255,.88); padding: 7px 11px; border-radius: 7px;
    line-height: 1.4; pointer-events: none; font-weight: 300; }

/* ----------------------------- Modal (E-Mail-Gate) ----------------------------- */

.modal-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(25,25,25,.55);
    display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay[hidden] { display: none; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
    border-top: 5px solid var(--gold); max-width: 480px; width: 100%; padding: 30px;
    max-height: 90vh; overflow-y: auto; }
.modal h2 { color: var(--gold-deep); font-size: 1.5rem; margin: 0 0 6px; }
.modal p { font-size: .95rem; color: var(--ink-2); margin: 0 0 18px; font-weight: 300; }
.modal label { display: block; font-size: .82rem; font-weight: 500; text-transform: uppercase;
    letter-spacing: .8px; color: var(--gold-deep); margin-bottom: 8px; }
.modal .checkbox-row { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 6px;
    font-size: .88rem; font-weight: 300; color: var(--gray); }
.modal .checkbox-row input { margin-top: 4px; accent-color: var(--gold); flex: 0 0 auto; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 22px; }
.modal-error { color: var(--geo); font-size: .86rem; margin: 8px 0 0; min-height: 1em; }
.modal-close { float: right; background: none; border: 0; font-size: 1.6rem; line-height: 1;
    color: var(--gray-2); cursor: pointer; margin: -10px -8px 0 0; }
.modal-close:hover { color: var(--ink); }

/* ----------------------------- Responsiv ----------------------------- */

@media (max-width: 980px) {
    .site-nav { position: absolute; top: calc(var(--topbar-h) + var(--nav-h)); left: 0; right: 0;
        background: #fff; flex-direction: column; padding: 8px 16px 18px; gap: 2px; display: none;
        box-shadow: var(--shadow-lg); border-top: 1px solid var(--line); }
    .site-nav.open { display: flex; }
    .nav-link { padding: 14px; width: 100%; }
    .nav-toggle { display: flex; }

    .app { grid-template-columns: 1fr; }
    .app-panel { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
    .app-map { min-height: 72vh; }
    .map-svg-host svg { max-height: 64vh; }
    .legend { position: static; max-width: none; margin-top: 12px; }
    .map-stage { flex-direction: column; }
}

@media (max-width: 600px) {
    .topbar { font-size: .76rem; }
    .topbar .container { justify-content: center; gap: 10px 16px; }
    .brand-title { font-size: 1rem; }
    .content-page { padding: 36px 20px; }
    .content-page h1 { font-size: 1.9rem; }
    .footer-inner { flex-direction: column; gap: 30px; }
    .cookie-actions { width: 100%; }
    .cookie-actions .btn { flex: 1; }
    .cta-box { flex-direction: column; align-items: flex-start; }
    .modal { padding: 22px; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .btn { width: 100%; }
}

@media (max-width: 380px) {
    .container { padding: 0 16px; }
    .app-panel { padding: 18px; }
}
