/**
 * frontend.css – Basis-Styles für das Kunden-Frontend
 * 
 * Enthält alle Basis-Styles für bestelltool/index.php
 * und die darin eingebundenen Include-Dateien.
 * 
 * NICHT direkt verändern bei Projekt-Klonen!
 * Für projektspezifische Anpassungen: frontend-custom.css anlegen.
 * Diese Datei wird NACH frontend.css geladen und überschreibt gezielt.
 * 
 * Lade-Reihenfolge in index.php:
 *   <link rel="stylesheet" href="css/frontend.css">
 *   <link rel="stylesheet" href="css/frontend-custom.css">  ← optional
 */

/* ============================================================
   Reset & Basis
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: Verdana, sans-serif;
    background: #f0f0f0;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================================
   Header
   ============================================================ */
#header {
    background: #c00;
    color: #fff;
    padding: 2px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#header h1 {
    font-size: 1.4em;
    font-weight: bold;
    letter-spacing: 1px;
}
#header .logout-btn {
    margin-left: auto;
    color: #fff;
    text-decoration: none;
    font-size: 0.85em;
    border: 1px solid rgba(255,255,255,0.5);
    padding: 5px 12px;
    border-radius: 3px;
}
#header .logout-btn:hover { background: rgba(255,255,255,0.15); }

.header-mobile-logo-link {
    display: none;
    align-items: center;
    text-decoration: none;
}

.header-mobile-logo {
    display: block;
    height: 22px;
    width: auto;
    max-width: 170px;
}

/* ============================================================
   Newsticker
   ============================================================ */
#ticker {
    background: #c00;
    color: #fff;
    padding: 8px 30px;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
}
#ticker span {
    display: inline-block;
    animation: ticker-scroll 30s linear infinite;
}
@keyframes ticker-scroll {
    0%   { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}

/* ============================================================
   Kundeninfo-Leiste
   ============================================================ */
/* ---- Logo + Kundeninfo nebeneinander ---- */
#kunde-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #ddd;
}
#logo { max-height: 60px; }

#kundeninfo {
    text-align: right;
    display: flex;
    gap: 40px;
    font-size: 0.85em;
    flex-wrap: wrap;
    justify-content: flex-end;
}
#kundeninfo .info-block { line-height: 1.6em; }
#kundeninfo .label { color: #999; font-size: 0.9em; }

.liefer-tage { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.liefer-tag {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    background: #eee;
    color: #999;
}
.liefer-tag.aktiv { background: #c00; color: #fff; }

/* ============================================================
   Content-Bereich
   ============================================================ */
#content {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================================
   Login-Formular (Frontend)
   ============================================================ */
.login-wrapper {
    max-width: 400px;
    margin: 60px auto;
    background: #fff;
    padding: 40px;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}
.login-wrapper h2 {
    margin-bottom: 25px;
    color: #c00;
    font-size: 1.3em;
}
.login-error {
    background: #ffebee;
    border-left: 3px solid #f44336;
    padding: 10px 15px;
    margin-bottom: 18px;
    font-size: 0.9em;
    color: #c00;
    border-radius: 0 4px 4px 0;
}

/* ============================================================
   Formular-Elemente (Frontend)
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85em;
    color: #666;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #c00;
    box-shadow: 0 0 0 2px rgba(204,0,0,0.1);
}

/* ============================================================
   Buttons (Frontend)
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 20px;
    border-radius: 6px;
    font-size: 1.2em;
    font-weight: 500;
    font-family: Calibri, Verdana, Arial, Helvetica, sans-serif;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    line-height: 1;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
    background-image: url('../img/button.png');
    background-repeat: repeat-x;
}
.btn-primary {
    background-color: #c30000;
    border-color: #a60000;
    color: #fff;
}
.btn-secondary {
    background-color: #4b4b4b;
    border-color: #1e1e1e;
    color: #fff;
}
.btn-dark {
    background-color: #3f3f3f;
    border-color: #181818;
    color: #fff;
}
.btn-outline {
    background-color: #fff;
    color: #333;
    border-color: #999;
}

.btn:hover,
.btn:focus-visible {
    background-image: url('../img/button.png');
    background-color: #ec281b;
    color: #fff;
    border-color: #fff;
}
.btn-sm {
    height: 36px;
    padding: 0 14px;
    font-size: 1.2em;
    font-weight: 500;
}
.btn-login {
    width: 100%;
    padding: 12px;
    background: #c00;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.5px;
}
.btn-login:hover { background: #a00; }

/* ============================================================
   Bestellliste
   ============================================================ */
.bestellliste-wrapper {
    background: #fff;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.bestellliste-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.bestellliste-header h2 {
    font-size: 1.1em;
    color: #333;
}

/* Artikelgruppen-Überschriften */
.bestellliste-table thead tr th,
.warengruppe-titel {
    background: #fff;
    color: #000;
}

.bestellliste-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    table-layout: fixed;
}
.bestellliste-table,
.bestellliste-table tbody,
.bestellliste-table tr,
.bestellliste-table td {
    background: #fff;
}
.bestellliste-table th {
    background: #c00;
    color: #fff;
    padding: 10px 12px;
    text-align: left;
    font-weight: normal;
    font-size: 0.85em;
}
.bestellliste-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.bestellliste-table th {
    font-size: 1.2em;
}

.bestellliste-table th:nth-child(1),
.bestellliste-table td:nth-child(1) {
    width: 122px;
}

.bestellliste-table th:nth-child(2),
.bestellliste-table td:nth-child(2) {
    width: auto;
}

.bestellliste-table th:nth-child(3),
.bestellliste-table td:nth-child(3),
.bestellliste-table th:nth-child(4),
.bestellliste-table td:nth-child(4) {
    width: 66px;
    white-space: nowrap;
}

.bestellliste-table th:nth-child(5),
.bestellliste-table td:nth-child(5) {
/*    width: 116px; */
}

.bestellliste-table th:nth-child(3),
.bestellliste-table td:nth-child(3),
.bestellliste-table th:nth-child(4),
.bestellliste-table td:nth-child(4) {
    text-align: center;
}

.bestellliste-table th,
.bestellliste-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
}
.bestellliste-table tr:hover td { background: #fafafa; }
.bestellliste-table tr:last-child td { border-bottom: none; }

/* Tabellenzeilen Trennlinien */
.bestellliste-table tbody tr {
    border-bottom: 1px solid #eee;
}

.bestellliste-table tbody tr:nth-child(odd) {
    background: #fff;
}

.bestellliste-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.bestellliste-table tbody tr:nth-child(odd) td,
.bestellliste-table tbody tr:nth-child(even) td {
    background: inherit;
}

.bl-row-prefilled {
    background: #f0fff0;
}

.bl-row-prefilled td {
    background: inherit;
}

.bl-wg-block {
    margin-bottom: 24px;
}

.bl-controls-panel {
    position: relative;
}

.bl-controls-panel--form {
    margin-bottom: 4px;
}

.bl-wrapper-elements,
.bl-form-elements {
    padding-left: 0;
    padding-right: 0;
}

.bl-products-panel {
    position: relative;
    background: #fff;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.bl-products-panel .bl-wg-block:last-of-type {
    margin-bottom: 0;
}

.bl-wg-header {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    padding-bottom: 6px;
    margin-bottom: 10px;
}

.bl-head-row th {
    border-bottom: 1px solid #eee;
}

.bl-th-qty {
    width: 120px;
    text-align: center;
}

.bl-artnr-cell-wrap {
    font-size: 0.85em;
    color: #999;
}

.bl-artnr-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bl-artnr-media {
    position: relative;
    width: 66px;
    height: 36px;
    border-radius: 4px;
    overflow: hidden;
    background: #f2f2f2;
    border: 1px solid #e5e5e5;
    flex: 0 0 auto;
    font-size: 14px;
}

.bl-artnr-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bl-artnr-media.is-empty {
    background: linear-gradient(135deg, #f6f6f6 0%, #ececec 100%);
}

.bl-artnr-noimg {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-size: 0.68em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bl-artnr-text {
    font-size: 1.02em;
    color: #777;
    font-weight: 600;
    white-space: nowrap;
}

.bl-bez-sub {
    font-size: 0.85em;
    color: #999;
}

.bl-me-cell {
    font-size: 0.85em;
}

.bl-vpe-cell {
    font-size: 0.85em;
    color: #999;
}

.bl-qty-control {
    display: inline-flex;
    align-items: stretch;
    width: 98px;
    height: 36px;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.bl-qty-control--prefilled {
    border-color: #4caf50;
    background: #f0fff0;
}

.bl-qty-btn {
    min-width: 28px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    background: #f5f5f5;
    font-size: 1.2em;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.bl-qty-btn--minus {
    border-right: 1px solid #ccc;
}

.bl-qty-btn--plus {
    border-left: 1px solid #ccc;
}

.bl-qty-input {
    width: auto;
    flex: 1;
    min-width: 0;
    padding: 0 4px;
    border: none;
    outline: none;
    font-size: 1.05em;
    text-align: right;
    font-family: inherit;
    background: transparent;
    appearance: textfield;
    -moz-appearance: textfield;
}

.bl-note-wrap {
    margin-bottom: 20px;
    background-color: #fff;
}

.bl-note-label {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 6px;
}

.bl-note-textarea {
    width: 100%;
    max-width: 600px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9em;
    resize: vertical;
}

.bl-artnr-overlay {
    display: none;
}

.bl-mobile-headline {
    display: none;
}

.bl-meta-mobile {
    display: none;
}

.bl-bez-title {
    font-size: 1em;
    line-height: 1.35;
    color: #222;
}

.bl-submit-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    margin: 0;
    padding: 12px 8px;
    box-sizing: border-box;
    flex-wrap: wrap;
    background: #fff;
}

.bl-submit-sum {
    font-size: 0.85em;
    color: #666;
}

.bl-image-trigger {
    display: inline-flex;
    align-items: stretch;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
    text-align: left;
}

.bl-image-trigger:focus-visible {
    outline: 2px solid #c00;
    outline-offset: 2px;
}

.bl-image-trigger .bl-artnr-media {
    cursor: zoom-in;
}

body.bl-modal-open {
    overflow: hidden;
}

.bl-bild-modal {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}

.bl-bild-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.22s ease;
}

.bl-bild-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.bl-bild-modal.is-open .bl-bild-modal__backdrop {
    opacity: 1;
}

.bl-bild-modal__dialog {
    position: relative;
    z-index: 1;
    max-width: min(960px, 94vw);
    max-height: 92vh;
    width: auto;
    background: #fff;
    border-radius: 10px;
    padding: 14px;
    box-sizing: border-box;
    transform: translateY(8px) scale(0.985);
    opacity: 0;
    transition: transform 0.24s ease, opacity 0.24s ease;
}

.bl-bild-modal.is-open .bl-bild-modal__dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.bl-bild-modal__img {
    display: block;
    max-width: 100%;
    max-height: 82vh;
    width: auto;
    height: auto;
    margin: 0 auto;
    border-radius: 6px;
}

.bl-bild-modal__caption {
    margin-top: 10px;
    font-size: 0.95em;
    color: #444;
    line-height: 1.35;
}

.bl-bild-modal__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 1.25em;
    line-height: 1;
    cursor: pointer;
}

.bl-bild-modal__close:hover {
    background: rgba(0, 0, 0, 0.78);
}

@media (min-width: 769px) {
    .bestellliste-table th:nth-child(5),
    .bestellliste-table td:nth-child(5) {
        padding-right: 6px;
    }

    .bestellliste-table td.bl-menge-cell {
        text-align: left;
        padding-right: 8px !important;
    }

    .bestellliste-table td.bl-menge-cell .bl-qty-control {
        margin-right: 0 !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bl-bild-modal,
    .bl-bild-modal__backdrop,
    .bl-bild-modal__dialog {
        transition: none;
    }
}

/* Mengen-Eingabefeld */
.menge-input {
    width: 70px;
    padding: 6px 3px;
    border: 0;
    font-size: 1.2em;
    font-family: inherit;
    text-align: center;
}
.menge-input:focus {
    outline: none;
    border-color: #c00;
    box-shadow: 0 0 0 2px rgba(204,0,0,0.1);
}

.menge-input::-webkit-outer-spin-button,
.menge-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.menge-input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
}

/* Warengruppen-Überschrift */
.wg-header td {
    background: #f5f5f5;
    font-weight: bold;
    font-size: 0.85em;
    color: #666;
    padding: 8px 12px;
    border-bottom: 1px solid #ddd;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   Bestellübersicht / Zusammenfassung
   ============================================================ */
.bestellung-summary {
    background: #fff;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-top: 20px;
}
.bestellung-summary h3 {
    font-size: 1em;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 8px;
}

/* ============================================================
   Meldungen (Frontend)
   ============================================================ */
.msg-ok  { background: #e8f5e9; border-left: 3px solid #4caf50; padding: 12px 16px; margin-bottom: 16px; font-size: 0.9em; color: #2e7d32; border-radius: 0 4px 4px 0; }
.msg-err { background: #ffebee; border-left: 3px solid #f44336; padding: 12px 16px; margin-bottom: 16px; font-size: 0.9em; color: #c00; border-radius: 0 4px 4px 0; }
.msg-info { background: #e3f2fd; border-left: 3px solid #1976d2; padding: 12px 16px; margin-bottom: 16px; font-size: 0.9em; color: #1565c0; border-radius: 0 4px 4px 0; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    #header { padding: 12px 15px; }
    #header h1 { font-size: 1.1em; }
    .header-mobile-logo-link { display: inline-flex; }
    #logo-bereich { display: none; }
    #kunde-header {
        justify-content: flex-end;
        padding: 10px 6px;
    }
    #kundeninfo {
        padding: 0;
        gap: 12px;
    }
    #content {
        padding: 0;
    }
}

/* ============================================================
   Produktzeilen / Bestellliste-Tabelle: Karten-Layout
   Eigener Breakpoint (1024px), unabhängig vom Header-Breakpoint,
   damit die Zeilen zwischen 769px und 1024px nicht gestaucht werden.
   ============================================================ */
@media (max-width: 1024px) {
    .bestellliste-wrapper {
        background: #fff;
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 10px 0 14px;
    }
    .bestellliste-table {
        display: block;
        border-collapse: separate;
        border-spacing: 0;
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        min-width: 0;
        table-layout: fixed;
    }

    .bestellliste-table tbody {
        display: block;
        width: 100%;
    }

    .bestellliste-table thead {
        display: none;
    }

    .bl-products-panel {
        background: #fff;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding-bottom: 48px;
    }

    .bl-wrapper-elements,
    .bl-form-elements {
        padding-left: 8px;
        padding-right: 8px;
    }

    .bl-wg-block {
        margin-bottom: 0;
    }

    .bl-mobile-headline {
        display: table-caption;
        caption-side: top;
        text-align: left;
        padding: 2px 0 10px 8px;
        font-size: 0.95em;
        font-weight: 700;
        color: #555;
        letter-spacing: 0.02em;
    }

    .bestellliste-table tbody tr {
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr) 88px;
        grid-template-rows: auto;
        column-gap: 6px;
        row-gap: 6px;
        padding: 10px 6px;
        border-bottom: 1px solid #e9e9e9;
        width: 100%;
        max-width: 100%;
    }

    .bestellliste-table tbody td {
        border-bottom: none;
        padding: 0;
    }

    .bl-artnr-cell-wrap {
        grid-column: 1;
        grid-row: 1;
        width: 72px;
        min-width: 72px;
        padding: 0;
        margin-left: 0;
        align-self: start;
    }

    .bl-artnr-cell {
        display: block;
    }

    .bl-artnr-media {
        width: 72px;
        height: 42px;
        margin: 0;
    }

    .bl-bez-cell {
        grid-column: 2;
        grid-row: 1;
        align-self: start;
        font-size: 0.96em;
        line-height: 1.3;
        min-width: 0;
    }

    .bl-bez-title {
        display: block;
        font-size: 1.02em;
        font-weight: 300;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .bl-me-cell,
    .bl-meta-mobile {
        display: none;
    }

    .bl-vpe-cell {
        display: none;
        grid-column: 2;
        grid-row: 2;
        align-self: start;
        font-size: 0.9em;
        color: #777;
        min-width: 0;
    }

    .bl-vpe-cell::before {
        content: 'VPE: ';
        font-weight: 600;
        color: #666;
    }

    .bl-menge-cell {
        grid-column: 3;
        grid-row: 1;
        justify-self: stretch;
        align-self: start;
        min-width: 0;
        width: 88px;
    }

    .bl-menge-cell > div {
        width: 88px;
        max-width: 88px;
        height: 42px !important;
        margin-left: auto;
        margin-right: 0;
    }

    .bl-artnr-text {
        display: none;
    }

    .bl-artnr-overlay {
        display: block;
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 1px 2px;
        background: rgba(255, 255, 255, 0.82);
        color: #333;
        font-size: 1em;
        font-weight: 700;
        font-family: Calibri, Verdana, Arial, Helvetica, sans-serif;
        line-height: 1.1;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .bl-artnr-media.is-empty .bl-artnr-overlay {
        font-size: 1.02em;
        font-weight: 700;

    }

    .bl-submit-bar {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        margin-top: 0;
        padding: 12px 8px;
    }
}

