/* =========================================================================
   Dorfflohmarkt — ruhiges, warmes Design (angelehnt an Claude/Anthropic)
   ========================================================================= */

:root {
    --bg:            #F7F6F1;  /* Seiten-Hintergrund, warmes Grau/Beige */
    --panel:         #FFFFFF;  /* Karten/Panels */
    --clay:          #C2571A;  /* Akzent — sparsam für den 1 wichtigsten CTA */
    --clay-hover:    #A8481470;
    --clay-strong:   #A84814;
    --text:          #2B2A27;  /* dunkles warmes Grau statt reinem Schwarz */
    --text-secondary:#6B6863;  /* Labels, Hinweise, Zeitstempel */
    --border:        #E7E4DC;  /* sehr dünne Trennlinien */
    --border-strong: #D9D5CC;
    --focus:         #C2571A55;
    --danger:        #B23B3B;
    --ok:            #3E7C4E;
    --radius-lg:     12px;
    --radius-sm:     7px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--clay-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 600; line-height: 1.25; color: var(--text); }
h1 { font-size: 1.6rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.2rem; margin: 0 0 0.5rem; }
h3 { font-size: 1.02rem; margin: 0 0 0.35rem; }

p { margin: 0 0 0.75rem; }

.muted { color: var(--text-secondary); }
.small { font-size: 0.86rem; }

/* --- Layout-Container --- */
.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}
.container-wide { max-width: 1240px; }

/* --- Topbar --- */
.topbar {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.topbar .brand {
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.topbar .brand:hover { text-decoration: none; }
.topbar nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.topbar nav a { color: var(--text-secondary); font-size: 0.92rem; }
.topbar nav a:hover { color: var(--text); text-decoration: none; }

/* --- Cards / Panels --- */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    transition: border-color .12s ease, background .12s ease;
}
.btn:hover { border-color: #C3BEB2; text-decoration: none; }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

/* Genau ein Clay-CTA pro Ansicht */
.btn-primary {
    background: var(--clay);
    border-color: var(--clay);
    color: #fff;
}
.btn-primary:hover { background: var(--clay-strong); border-color: var(--clay-strong); }

.btn-danger { color: var(--danger); border-color: #E3C9C9; }
.btn-danger:hover { background: #FBF4F4; border-color: #D8B4B4; }

.btn-sm { padding: 0.38rem 0.7rem; font-size: 0.86rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --- Formulare --- */
.field { margin-bottom: 1rem; }
.field label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--text);
}
.field .hint { font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.25rem; }
input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=date], select, textarea {
    width: 100%;
    font: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.7rem;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--clay);
    box-shadow: 0 0 0 3px var(--focus);
}
.field-error input, .field-error select, .field-error textarea { border-color: var(--danger); }
.error-text { color: var(--danger); font-size: 0.84rem; margin-top: 0.3rem; }

/* Honeypot — visuell entfernt, aber für Bots vorhanden */
.hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px; height: 1px;
    overflow: hidden;
}

/* --- Meldungen --- */
.alert {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.92rem;
    background: var(--panel);
}
.alert-ok     { border-color: #CBE0D0; background: #F3F8F4; color: #2F5E3C; }
.alert-error  { border-color: #E7CDCD; background: #FBF4F4; color: #8A2F2F; }

/* --- Tabellen --- */
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data th, table.data td {
    text-align: left;
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
table.data th { color: var(--text-secondary); font-weight: 500; }

/* --- Badges / Status --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    background: var(--panel);
}
.badge-num {
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
}
.cat-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Status-Tags in der Standverwaltung */
.status-tag {
    display: inline-block;
    font-size: 0.78rem;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--panel);
    color: var(--text-secondary);
    white-space: nowrap;
}
.status-ok        { border-color: #CBE0D0; background: #F3F8F4; color: #2F5E3C; }
.status-attention { border-color: #E4C9A8; background: #FBF3E8; color: var(--clay-strong); }
.status-off       { border-color: #E0DCD3; background: #F1EFE9; color: #8A857C; }

/* --- Kategorie-Legende --- */
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.legend .item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.86rem; color: var(--text-secondary); }

/* --- Karte --- */
#map, .map {
    width: 100%;
    height: 520px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    z-index: 1;
}
.map-page { position: relative; }

/* Schwebender + Button */
.fab {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 500;
    background: var(--clay);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.8rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.fab:hover { background: var(--clay-strong); }

/* --- Modal / Drawer für Anmeldeformular --- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(43,42,39,0.35);
    z-index: 900;
    display: none;
}
.modal-backdrop.open { display: block; }
.modal {
    position: fixed;
    z-index: 1000;
    top: 0; right: 0; bottom: 0;
    width: min(440px, 100%);
    background: var(--panel);
    border-left: 1px solid var(--border);
    padding: 1.5rem 1.35rem 2rem;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform .18s ease;
}
.modal.open { transform: translateX(0); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-close {
    background: none; border: none; font-size: 1.4rem; line-height: 1;
    color: var(--text-secondary); cursor: pointer; padding: 0.2rem 0.4rem;
}

/* Kategorie-Auswahl mit Icon-Vorschau */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.cat-option {
    display: flex; align-items: center; gap: 0.5rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.6rem;
    cursor: pointer;
    font-size: 0.88rem;
    background: var(--panel);
}
.cat-option:hover { border-color: #C3BEB2; }
.cat-option.selected { border-color: var(--clay); box-shadow: 0 0 0 2px var(--focus); }
.cat-option svg { width: 22px; height: 22px; flex: none; }
.cat-option input { display: none; }

/* Hinweis über der Karte im Formular */
.map-hint {
    font-size: 0.84rem;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.5rem;
}

/* --- Marker-Icons (divIcon) --- */
.booth-marker { display: flex; align-items: center; justify-content: center; }
.booth-marker svg { width: 18px; height: 18px; }
.booth-pin {
    width: 30px; height: 30px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
    display: flex; align-items: center; justify-content: center;
}
.booth-pin > * { transform: rotate(45deg); }
.booth-number-badge {
    background: var(--text);
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.82rem; font-weight: 700;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

.leaflet-popup-content { font-family: var(--font); }
.popup-title { font-weight: 600; margin-bottom: 0.15rem; }
.popup-cat { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 0.35rem; }

/* --- Grids --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
@media (max-width: 760px) {
    .grid-2 { grid-template-columns: 1fr; }
}

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.stack > * + * { margin-top: 0.75rem; }
.inline-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Zähler-Chips im Dashboard */
.counts { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.count-chip {
    display: inline-flex; align-items: baseline; gap: 0.35rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0.3rem 0.6rem; font-size: 0.84rem; color: var(--text-secondary);
    background: var(--bg);
}
.count-chip b { color: var(--text); font-size: 1rem; }
.count-chip.attention { border-color: #E4C9A8; background: #FBF3E8; color: var(--clay-strong); }
