/* ── Reset & Basis ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #1a1a2e;
    --surface:     #16213e;
    --card:        #0f3460;
    --accent:      #e94560;
    --success:     #27ae60;
    --danger:      #e74c3c;
    --text:        #eaeaea;
    --text-muted:  #8899aa;
    --border:      #1e3a5f;
    --green:       #6fcf7f;
    --nav-h:       64px;
    --cart-w:      360px;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    /* Verhindert versehentliches Scrollen / Zoom bei Touch */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* ── Navbar ──────────────────────────────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: var(--surface);
    border-bottom: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 100;
}

.nav-brand {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: .04em;
}

.nav-tabs { display: flex; gap: .75rem; }

.nav-auth {
    display: flex;
    align-items: center;
    gap: .7rem;
}

.auth-user {
    font-size: .85rem;
    color: var(--text-muted);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-tab {
    padding: .55rem 1.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s, border-color .18s, color .18s;
    min-height: 44px;   /* WCAG touch target */
    min-width: 100px;
}

.nav-tab.active,
.nav-tab:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── Views ───────────────────────────────────────────────────────────────── */
.view {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0; bottom: 0;
}
.view.active { display: flex; }

/* ── Kassen-Layout ───────────────────────────────────────────────────────── */
.kasse-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

/* ── Produkte-Bereich ────────────────────────────────────────────────────── */
.produkte-bereich {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    background: var(--bg);
}

.produkte-grid {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.produkt-kategorie {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .85rem;
}

.produkt-kategorie-titel {
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: .75rem;
}

.produkte-kategorie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

/* Produkt-Kachel – Herzstück der Touch-UI */
.produkt-kachel {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem .75rem;
    min-height: 148px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: transform .10s ease, background .12s, border-color .12s;
    -webkit-tap-highlight-color: transparent;
}

.produkt-kachel:active {
    transform: scale(.93);
    background: var(--accent);
    border-color: var(--accent);
}

@media (hover: hover) {
    .produkt-kachel:hover {
        border-color: var(--accent);
        background: #15284d;
    }
}

.kachel-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: .55rem;
    word-break: break-word;
    line-height: 1.3;
}

.kachel-preis {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--green);
}

/* ── Warenkorb ───────────────────────────────────────────────────────────── */
.warenkorb-bereich {
    width: var(--cart-w);
    background: var(--surface);
    border-left: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.warenkorb-titel {
    font-size: 1.2rem;
    font-weight: 700;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: .75rem;
}

.warenkorb-liste {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.warenkorb-leer {
    color: var(--text-muted);
    text-align: center;
    margin-top: 2rem;
    font-size: .95rem;
}

.warenkorb-item {
    background: var(--card);
    border-radius: 10px;
    padding: .6rem .85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
}

.item-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.item-name {
    font-weight: 600;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-menge {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: .1rem;
}

.item-rechts {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-shrink: 0;
}

.item-preis {
    font-weight: 700;
    font-size: .95rem;
    color: var(--green);
}

.btn-remove {
    background: transparent;
    border: none;
    color: var(--danger);
    font-size: 1.05rem;
    cursor: pointer;
    padding: .25rem .45rem;
    border-radius: 6px;
    line-height: 1;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-remove:hover { background: rgba(231,76,60,.15); }

.warenkorb-summe {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.3rem;
    font-weight: 800;
    padding: .75rem 0;
    border-top: 2px solid var(--border);
    margin-top: .75rem;
}

#gesamt-preis { color: var(--green); }

.warenkorb-buttons {
    display: flex;
    gap: .75rem;
    margin-top: .75rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    flex: 1;
    padding: .9rem .5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s, transform .1s;
    min-height: 52px;
    letter-spacing: .02em;
}

.btn:active    { transform: scale(.95); }
.btn:disabled  { opacity: .5; cursor: not-allowed; transform: none; }

.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:not(:disabled):hover  { filter: brightness(1.12); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:not(:disabled):hover { filter: brightness(1.12); }

.btn-sm {
    flex: none;
    padding: .45rem .9rem;
    font-size: .85rem;
    min-height: 38px;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    width: min(480px, 94vw);
    display: flex;
    flex-direction: column;
    gap: 1.3rem;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .55);
}

.modal h2 {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
}

.modal-zeile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
}

.modal-betrag {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--green);
}

.modal-betrag.negativ { color: var(--danger); }

.rueckgeld-zeile {
    background: var(--card);
    border-radius: 10px;
    padding: .75rem 1rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: .25rem;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 350;
    background: rgba(0, 0, 0, .8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-box {
    width: min(420px, 92vw);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.4rem;
}

.auth-box h2 {
    margin-bottom: 1rem;
}

/* ── Formulare ───────────────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.form-group label {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input,
.form-group select {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1.15rem;
    padding: .75rem 1rem;
    outline: none;
    transition: border-color .2s;
    min-height: 52px;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus { border-color: var(--accent); }

/* ── Verwaltungs-Ansicht ─────────────────────────────────────────────────── */
#view-verwaltung {
    overflow-y: auto;
    background: var(--bg);
}

.verwaltung-container {
    max-width: 620px;
    margin: 2rem auto;
    padding: 0 1.5rem 3rem;
}

.verwaltung-container h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

#produkt-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lokal-drucker-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    margin-top: .5rem;
}

.form-meldung {
    margin-top: .5rem;
    font-size: .9rem;
    font-weight: 600;
    min-height: 1.3em;
}
.form-meldung.erfolg { color: var(--success); }
.form-meldung.fehler { color: var(--danger);  }

.verwaltung-liste {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: .75rem;
}

.verwaltung-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.benutzer-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.benutzer-liste {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: .75rem;
}

.benutz-name { flex: 1; font-weight: 600; }
.benutz-tag {
    border-radius: 999px;
    padding: .2rem .6rem;
    font-size: .75rem;
    font-weight: 700;
    white-space: nowrap;
}
.benutz-tag.admin {
    background: rgba(233, 69, 96, .18);
    border: 1px solid rgba(233, 69, 96, .35);
    color: var(--accent);
}
.benutz-tag.kassierer {
    background: rgba(39, 174, 96, .18);
    border: 1px solid rgba(39, 174, 96, .35);
    color: var(--success);
}
.benutz-datum { font-size: .85rem; color: var(--text-muted); min-width: 85px; text-align: right; }

.vw-name  { flex: 1; font-weight: 600; word-break: break-word; }
.vw-kategorie {
    background: rgba(233, 69, 96, .18);
    border: 1px solid rgba(233, 69, 96, .35);
    color: var(--accent);
    border-radius: 999px;
    padding: .18rem .65rem;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}
.vw-preis { font-weight: 700; color: var(--green); min-width: 85px; text-align: right; }

/* ── Feedback-Texte ──────────────────────────────────────────────────────── */
.hinweis, .fehler {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
}
.fehler { color: var(--danger); }

/* ── Checkbox ────────────────────────────────────────────────────────────── */
.checkbox-group { align-items: center; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-size: .95rem;
    color: var(--text-muted);
    font-weight: 400;
    user-select: none;
    -webkit-user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--success);
}

/* ── Scrollbar (Webkit) ──────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Surface Pro Anpassungen ─────────────────────────────────────────────── */
@media (min-width: 1200px) {
    .produkte-kategorie-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    .produkt-kachel { min-height: 160px; }
}

@media (max-width: 768px) {
    :root { --cart-w: 280px; }
    .kachel-name  { font-size: 1rem; }
    .kachel-preis { font-size: 1.1rem; }
}
