/* site.css
 *
 * Gemeinsames Design der Plattform (oeffentliche Seiten UND Admin-Bereich):
 * Farben/Abstaende als Variablen, Seitenrahmen mit Kopfzeile, Navigation
 * (Desktop-Leiste mit Aufklappmenues, mobil ein Drawer), Fuss, sowie die
 * Bausteine der oeffentlichen Seiten (Suche, Club-Info, Scorecards, Rechner).
 * Formulare/Tabellen der Verwaltung liegen in content.css (gleiche Variablen).
 *
 * Mobile first: Eingabefelder haben 16px Schrift (sonst zoomt iOS-Safari beim
 * Fokussieren hinein), Tippflaechen sind mindestens 44px hoch.
 */

:root {
    --accent: #1a7a4c;
    --accent-dark: #145c3a;
    --accent-soft: #eaf5ef;
    --danger: #c0392b;
    --warn: #9a6b00;
    --text: #1c1e21;
    --text-muted: #65676b;
    --border: #e4e6ea;
    --bg: #f4f6f5;
    --card-bg: #ffffff;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 20, .05), 0 6px 18px rgba(16, 24, 20, .05);
    --header-h: 60px;
    --maxw: 1120px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
body {
    margin: 0; min-height: 100vh; display: flex; flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text); background: var(--bg); line-height: 1.5;
}
a { color: var(--accent-dark); }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; line-height: 1.25; }
h2 { font-size: 1.25rem; margin: 0 0 .4rem; }
h3 { font-size: 1.05rem; margin: 1.4rem 0 .6rem; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 1.25rem 1rem 3rem; flex: 1; }
body.narrow .container { max-width: 760px; }

/* ---------- Kopfzeile + Navigation ---------- */
.site-header { position: sticky; top: 0; z-index: 60; background: #fff; border-bottom: 1px solid var(--border); }
.site-header-inner {
    max-width: var(--maxw); margin: 0 auto; padding: 0 1rem; min-height: var(--header-h);
    display: flex; align-items: center; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--text); font-weight: 800; letter-spacing: -.01em; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 1.15rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark)); flex-shrink: 0;
}
.brand small { display: block; font-weight: 500; color: var(--text-muted); font-size: .72rem; margin-top: -.1rem; letter-spacing: 0; }

.site-nav { display: flex; align-items: center; gap: .15rem; margin-left: auto; }
.site-nav a, .nav-group-label {
    display: inline-flex; align-items: center; gap: .3rem; padding: .55rem .8rem; border-radius: 8px;
    color: var(--text); text-decoration: none; font-size: .92rem; font-weight: 600;
    background: none; border: none; cursor: pointer; margin: 0; font-family: inherit; line-height: 1.2;
}
.site-nav a:hover, .nav-group-label:hover, .nav-group.open > .nav-group-label { background: var(--accent-soft); color: var(--accent-dark); }
.site-nav a.active, .nav-group.active > .nav-group-label { color: var(--accent-dark); background: var(--accent-soft); }
.site-nav .nav-cta { background: var(--accent); color: #fff; }
.site-nav .nav-cta:hover { background: var(--accent-dark); color: #fff; }
.nav-badge { background: var(--danger); color: #fff; border-radius: 99px; font-size: .72rem; padding: .05rem .45rem; font-weight: 700; }

.nav-group { position: relative; }
.nav-group-label::after { content: "▾"; font-size: .75rem; opacity: .6; }
.nav-menu {
    display: none; position: absolute; top: calc(100% + .35rem); left: 0; min-width: 14rem; z-index: 70;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .35rem;
}
.nav-menu a { display: flex; width: 100%; font-weight: 500; }
.nav-group:hover > .nav-menu, .nav-group:focus-within > .nav-menu, .nav-group.open > .nav-menu { display: block; }

.nav-toggle {
    display: none; margin-left: auto; width: 44px; height: 44px; padding: 0; margin-top: 0;
    border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--text);
    font-size: 1.3rem; line-height: 1; cursor: pointer;
}

@media (max-width: 860px) {
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .site-nav {
        display: none; position: absolute; top: 100%; left: 0; right: 0; margin: 0; padding: .6rem .75rem 1rem;
        flex-direction: column; align-items: stretch; gap: .1rem; background: #fff;
        border-bottom: 1px solid var(--border); box-shadow: 0 12px 24px rgba(16, 24, 20, .12);
        max-height: calc(100vh - var(--header-h)); overflow-y: auto;
    }
    .site-nav.open { display: flex; }
    .site-nav a, .nav-group-label { width: 100%; min-height: 44px; font-size: 1rem; }
    .nav-group-label { cursor: default; color: var(--text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; pointer-events: none; padding-bottom: .1rem; }
    .nav-group-label::after { content: none; }
    .nav-menu { display: block; position: static; box-shadow: none; border: none; padding: 0 0 .4rem .4rem; min-width: 0; }
    .nav-group:hover > .nav-menu { display: block; }
}

/* ---------- Fuss ---------- */
.site-footer { border-top: 1px solid var(--border); background: #fff; color: var(--text-muted); font-size: .85rem; }
.site-footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 1.1rem 1rem; display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; align-items: center; }
.site-footer a { color: var(--text-muted); }
.site-footer .grow { flex: 1; min-width: 12rem; }

/* ---------- Einbett-Modus (?embed=1): kein Rahmen ---------- */
body.embed { background: transparent; }
body.embed .container { padding: .5rem; max-width: none; }

/* ---------- Oeffentliche Seiten ---------- */
.hero { padding: 1.4rem 0 .6rem; }
.hero h1 { font-size: 1.9rem; margin-bottom: .35rem; }
.hero p { color: var(--text-muted); margin: 0; max-width: 40rem; }

.search-box { position: relative; margin-top: 1rem; }
.search-box input {
    width: 100%; padding: .95rem 1rem .95rem 2.9rem; font-size: 1.05rem; border-radius: 14px;
    border: 1px solid var(--border); background: #fff; box-shadow: var(--shadow);
}
.search-box::before { content: "🔎"; position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); font-size: 1.05rem; opacity: .7; pointer-events: none; }
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26, 122, 76, .15); }
.search-results {
    margin-top: .5rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); max-height: 55vh; overflow-y: auto;
}
.search-results:empty { display: none; }
.search-results .club-result { padding: .85rem 1rem; min-height: 44px; }

.panel { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-top: 1rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.club-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .8rem; }
.club-title h1 { margin: 0; }
.club-sub { color: var(--text-muted); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .65rem; border-radius: 99px; background: var(--accent-soft); color: var(--accent-dark); font-size: .82rem; font-weight: 600; }
.chip.neutral { background: #eef0f2; color: var(--text-muted); }

.facts { display: grid; gap: .1rem; margin: .6rem 0 0; padding: 0; list-style: none; }
.facts li { display: grid; grid-template-columns: 1.6rem 1fr; gap: .5rem; padding: .55rem 0; border-bottom: 1px solid var(--border); align-items: start; }
.facts li:last-child { border-bottom: none; }
.facts .ico { text-align: center; }
.facts .lbl { display: block; color: var(--text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.facts a { word-break: break-word; }

.tee-list { display: grid; gap: .6rem; margin-top: .7rem; }
.tee { border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.tee > summary { list-style: none; cursor: pointer; padding: .8rem .9rem; display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: center; min-height: 44px; }
.tee > summary::-webkit-details-marker { display: none; }
.tee > summary::after { content: "▾"; margin-left: auto; color: var(--text-muted); }
.tee[open] > summary::after { content: "▴"; }
.tee-dot { width: .9rem; height: .9rem; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); flex-shrink: 0; }
.tee-name { font-weight: 700; }
.tee-meta { color: var(--text-muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: .1rem .9rem; }
.tee-body { padding: 0 .9rem .9rem; }
.course-heading { margin: 1.1rem 0 .1rem; font-size: 1rem; color: var(--accent-dark); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.holes { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
table.holes th, table.holes td { padding: .35rem .5rem; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.holes th:first-child, table.holes td:first-child { text-align: left; }
table.holes thead th { color: var(--text-muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; background: #f8faf9; position: sticky; top: 0; }
table.holes tr.sum td { font-weight: 700; background: #f3f7f5; }

.note { color: var(--text-muted); font-size: .82rem; margin-top: 1rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-top: 1rem; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.stat .num { font-size: 1.6rem; font-weight: 800; color: var(--accent-dark); }
.stat .lbl { color: var(--text-muted); font-size: .85rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem; margin-top: 1rem; }
.tile {
    display: block; text-decoration: none; color: var(--text); background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; transition: transform .12s, border-color .12s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.tile .tile-ico { font-size: 1.5rem; }
.tile strong { display: block; margin-top: .3rem; }
.tile span { color: var(--text-muted); font-size: .88rem; }

/* ---------- Rechner ---------- */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
.calc-grid label { margin-top: 0; }
.result-box { margin-top: 1rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid #cfe6d9; }
.result-box .big { font-size: 2rem; font-weight: 800; color: var(--accent-dark); line-height: 1.1; }
.result-box .small { color: var(--text-muted); font-size: .85rem; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }
.tabs button { margin: 0; background: #fff; color: var(--text); border: 1px solid var(--border); padding: .6rem 1rem; }
.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab-panel[hidden] { display: none; }
table.calc-holes { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
table.calc-holes th, table.calc-holes td { padding: .25rem .3rem; text-align: center; border-bottom: 1px solid var(--border); }
table.calc-holes th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
table.calc-holes input { width: 3.4rem; padding: .4rem .25rem; text-align: center; }
table.calc-holes tr.sum td { font-weight: 800; background: #f3f7f5; }
pre.code { background: #10201a; color: #d7efe2; border-radius: 10px; padding: .8rem 1rem; overflow-x: auto; font-size: .82rem; }

/* ---------- Admin-Startseite ---------- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-top: 1rem; }
.admin-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.admin-card h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.admin-card ul { list-style: none; margin: 0; padding: 0; }
.admin-card li a { display: flex; justify-content: space-between; gap: .6rem; padding: .6rem .2rem; min-height: 44px; align-items: center; border-top: 1px solid var(--border); text-decoration: none; color: var(--text); font-weight: 600; }
.admin-card li:first-child a { border-top: none; }
.admin-card li a small { color: var(--text-muted); font-weight: 500; }
.admin-card li a:hover { color: var(--accent-dark); }

/* Login */
.login-box { max-width: 420px; margin: 2rem auto; }
.alert { padding: .7rem 1rem; border-radius: 10px; margin: .8rem 0; font-size: .95rem; }
.alert.error-box, .alert.err { background: #fde4e4; color: #9a1f1f; }
.alert.ok { background: #e6f4ea; color: var(--accent-dark); }

@media (max-width: 720px) {
    .container { padding: 1rem .8rem 3rem; }
    .hero h1 { font-size: 1.5rem; }
    h1 { font-size: 1.4rem; }
    .layout { flex-direction: column; gap: 1rem; }
    .left-panel { flex: none; width: 100%; }
    #clubResults { max-height: 40vh; }
    .hole-table td input { width: 3.5rem; }
    button:not(.btn-danger):not(.btn-small):not(.btn-secondary):not(.nav-toggle):not(.nav-group-label):not([data-tab]):not(.tee-calc):not(.calc-dialog-close) { width: 100%; }
    .scorecard-item-actions { flex-direction: column; align-items: stretch !important; }
    .row2, .row3 { flex-direction: column; gap: 0; }
    .row3 > div.narrow { flex: 1; }
}

@media print {
    .site-header, .site-footer, .search-box, .search-results, .tabs { display: none !important; }
    body { background: #fff; }
    .panel, .tee { box-shadow: none; }
}

/* --- Rechner-Popup am Tee (Club-Seite) --- */
.tee > summary.has-calc::after { margin-left: 0; }
.tee > summary .tee-calc {
    margin: 0 0 0 auto; width: 40px; height: 40px; flex-shrink: 0; padding: 0; line-height: 1;
    border: 1px solid var(--border); border-radius: 10px; background: var(--accent-soft);
    font-size: 1.2rem; cursor: pointer;
}
.tee > summary .tee-calc:hover, .tee > summary .tee-calc:focus-visible { border-color: var(--accent); background: #dff0e6; color: var(--text); }
.calc-dialog {
    border: 0; border-radius: 14px; padding: 1.1rem 1.2rem 1.2rem; width: min(440px, calc(100vw - 24px));
    max-height: calc(100vh - 24px); overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
    color: var(--text); background: var(--card-bg);
}
.calc-dialog::backdrop { background: rgba(0, 0, 0, .5); }
.calc-dialog-head { display: flex; align-items: center; justify-content: space-between; margin: 0; }
.calc-dialog-head h2 { margin: 0; font-size: 1.2rem; }
.calc-dialog .calc-dialog-close {
    margin: 0; padding: 0; color: var(--text); width: 40px; height: 40px; border: 0; border-radius: 20px; background: #f0f2f5;
    font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.calc-dialog-sub { color: var(--text-muted); margin: .2rem 0 .9rem; font-size: .92rem; }
.calc-dialog label { display: block; font-weight: 600; margin-bottom: .3rem; }
.calc-dialog input { width: 100%; font-size: 1.1rem; }
.calc-strokes { display: flex; flex-wrap: wrap; gap: .25rem; }
.calc-stroke {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    min-width: 2.1rem; padding: .15rem .3rem; border: 1px solid var(--border); border-radius: 8px;
    font-weight: 700; color: var(--text-muted); font-size: .95rem; line-height: 1.2;
}
.calc-stroke small { font-weight: 400; font-size: .68rem; }
.calc-stroke.has { background: var(--accent-soft); border-color: #cfe6d9; color: var(--accent-dark); }
.calc-dialog-links { margin: .9rem 0 0; }

/* --- Sprachauswahl --- */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.nav-lang .nav-menu { left: auto; right: 0; min-width: 11rem; }
.nav-lang .nav-menu a.active { color: var(--accent-dark); background: var(--accent-soft); }
@media (max-width: 860px) {
    .nav-lang .nav-group-label .visually-hidden { position: static; width: auto; height: auto; margin: 0; clip: auto; }
}

/* --- Kontaktformular --- */
.contact-form label { display: block; font-weight: 600; margin: 1rem 0 .3rem; }
.contact-form label:first-child, .contact-form .contact-club + label { margin-top: 0; }
.contact-form textarea { font-family: inherit; font-size: 1rem; height: auto; min-height: 9rem; resize: vertical; }
.contact-form .contact-club { margin: 0 0 1rem; color: var(--accent-dark); }
.contact-form button[type="submit"] { margin-top: 1.2rem; }
.contact-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- Impressum --- */
.legal h2 { font-size: 1.05rem; margin: 1.3rem 0 .3rem; }
.legal h2:first-child { margin-top: 0; }
.legal p { margin: 0 0 .4rem; }

/* --- Scorecard-Scan --- */
.scan-step h2 { margin-top: 0; }
.scan-step label { display: block; font-weight: 600; margin-bottom: .3rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.btn-row button { margin-top: 0; }
.photo-preview { margin-top: .8rem; }
.photo-preview img { max-width: 100%; max-height: 360px; border-radius: 10px; border: 1px solid var(--border); }
.scan-step textarea { width: 100%; font-family: ui-monospace, monospace; font-size: .85rem; height: auto; }
.prompt-box { margin-top: .8rem; }
.prompt-box summary { cursor: pointer; color: var(--accent-dark); font-weight: 600; }
.prompt-box textarea { margin-top: .5rem; }
#scanTable input { width: 2.7rem; padding: .35rem .15rem; }
@media (max-width: 480px) {
    table.calc-holes th, table.calc-holes td { padding: .25rem .12rem; }
    table.calc-holes th { font-size: .62rem; letter-spacing: 0; }
}
