/* ==============================================================
   style.css – Kassabon‑Bestellsystem (kompakte Abstände)
   ==============================================================
   • Alle Maße in rem → leicht skalierbar
   • Button‑Höhe bleibt touch‑freundlich (≥ 48 px)
   • Grid‑/Flex‑Abstände (gap) wurden reduziert
   • Responsives Layout: 2 Spalten → 1 Spalte ab 600 px
   ============================================================== */

/* -------------------- 1. CSS‑Variablen -------------------- */
:root {
    /* Grundmaße --------------------------------------------------- */
    --btn-height:   2.75rem;   /* 52 px – kleiner, aber tip‑freundlich */
    --btn-radius:   1rem;      /* 16 px */
    --clear-width:  4.5rem;    /* 104 px */

    /* Schriftgrößen ------------------------------------------------ */
    --font-base:    1.125rem;  /* 18 px – Text auf Buttons */
    --font-count:   2.75rem;   /* 44 px – Counter im Produkt‑Button */

    --font-h2:      1.375rem;  /* 38 px – Überschrift Kassabon */
    --font-td:      1.25rem;  /* 30 px – Tabellenzellen */
    --font-sum:     2.5rem;  /* 34 px – Summenzeile */
    --font-clear:   2.25rem;   /* 36 px – CLEAR‑ALL‑Button */
}

/* -------------------- 2. Grundlayout -------------------- */
html, body {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;   /* flüssiges Scrollen iOS */
}
body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background-color: #eeeeee;
    color: #000000;
}

/* Container – etwas weniger Außen‑Padding und kleinerer Abstand */
.container {
    display: flex;
    flex-wrap: wrap;
    width: 100vw;
    min-height: 100vh;
    box-sizing: border-box;
    padding: 1rem;               /* 16 px außen */
    gap: 1rem;                   /* Abstand zwischen linker & rechter Spalte */
}

/* -------------------- 3. Linke Seite – Buttons -------------------- */
#buttons {
    flex: 1 1 60%;               /* bis zu 60 % des verfügbaren Platzes */
    display: grid;
    /* 2 Spalten ab ca. 600 px, sonst 1 Spalte */
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));

    /* Abstand zwischen den Zeilen (vertikal) und Spalten (horizontal) */
    gap: 1.25rem 1.25rem;         /* 4 px vertikal, 8 px horizontal */

    align-content: start;
}

/* Eine Zeile = [Clr‑Button] + [Produkt‑Button] */
.row {
    display: flex;
    /* Abstand zwischen den beiden Buttons in einer Zeile */
    gap: 0.5rem;               /* 2 px */
    min-height: var(--btn-height);
}

/* Clear‑Button (links) */
.row button:first-child {
    flex: 0 0 var(--clear-width);
    min-height: var(--btn-height);
    border-radius: var(--btn-radius);
    border: 1px solid #000;
    background-color: #d9d9d9;
    font-size: var(--font-base);
    font-weight: bold;
    cursor: pointer;
    margin: 0;                  /* sicherheitshalber */
}

/* Produkt‑Button (rechts) */
.product {
    flex: 1;
    min-height: var(--btn-height);
    border-radius: var(--btn-radius);
    border: 1px solid #000;
    padding: 0 1rem;
    font-size: var(--font-base);
    font-weight: bold;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    margin: 0;
}

/* Produktname (linker Teil) */
.product span { text-align: left; }

/* Counter (rechter Teil) – nur sichtbar, wenn > 0 */
.product b {
    font-size: var(--font-count);
    font-weight: 900;
    line-height: 1;
}

/* Button‑Effekt beim Drücken */
button:active { transform: scale(0.97); }

/* Entferne Hover‑Effekte auf reinen Touch‑Geräten */
@media (hover: none) { button:hover { background: inherit; } }

/* -------------------- 4. Rechte Seite – Kassabon -------------------- */
.display {
    flex: 1 1 35%;               /* bis zu 35 % des Platzes */
    padding: 2.5rem 1rem;
    box-sizing: border-box;
}

/* Überschrift */
.display h2 {
    margin: 0 0 2.375rem 0;      /* 70 px unten */
    font-size: var(--font-h2);
    font-weight: 900;
}

/* Tabelle */
#receipt {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}
#receipt tr { height: 2.875rem; }   /* 46 px */
#receipt td {
    padding: 0.25rem 0.5rem;
    font-size: var(--font-td);
    font-weight: bold;
    white-space: nowrap;
}
#receipt td:nth-child(1) { width: 4.375rem; }   /* 70 px */
#receipt td:nth-child(2) { text-align: left; }
#receipt td:nth-child(3) { text-align: right; }

/* Summenzeile */
#sum {
    margin-top: 1.1875rem;      /* 35 px */
    font-size: var(--font-sum);
    font-weight: 900;
}

/* CLEAR‑ALL‑Button (großer Button unten rechts) */
.clear-all {
    margin-top: 2rem;           /* Abstand zur Tabelle */
    width: 100%;
    min-height: 6rem;           /* 96 px – bleibt gut zu tippen */
    border-radius: var(--btn-radius);
    border: 2px solid #000;
    background-color: #d9d9d9;
    font-size: var(--font-clear);
    font-weight: 900;
    cursor: pointer;
}

/* -------------------- 5. Media Queries (Tablet & Handy) -------------------- */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
        padding: 1.25rem;      /* 20 px */
    }
    #buttons {
        width: 100%;
        grid-template-columns: 1fr;   /* nur eine Spalte */
        gap: 0.5rem 1rem;      /* noch kompakter im Tablet‑Modus */
    }
    .display { width: 100%; }
    .clear-all { margin-top: 1.5rem; }
}

/* Sehr kleine Bildschirme (z. B. iPhone SE, Android‑Mini) */
@media (max-width: 420px) {
    .product,
    .row button:first-child { font-size: 1rem; }   /* 16 px */
    .product b { font-size: 2.25rem; }            /* 36 px */
    .clear-all { font-size: 2rem; }               /* 32 px */
}

/* -------------------- 6. Globale Reset‑Regeln -------------------- */
/* Entferne ungewollte Margin an allen Buttons (falls irgendwo gesetzt) */
button { margin: 0; }