/* --------------------------------------------------------------------------------------------------
 * DB360 - (c) 2025 TURNUS Espresso GmbH
 * --------------------------------------------------------------------------------------------------
 * Lizenz   : MIT (siehe LICENSE)
 * Autor    : Andreas Goclik
 * Datei    : style.css
 * Pfad     : src/web/static/style.css
 * Erstellt : 2025-07-06
* Geaendert: 2025-07-15
 *
 * Kurzbeschreibung: Zentrales Stylesheet fuer das Dashboard
 *
 * --------------------------------------------------------------------------------------------------
 */

:root {
    --bg-gradient: #ffffff;
    --text-color: #000000;
    --header-color: #000000;
    --container-bg: #ffffff;
    --border-color: #000000;
    --accent-color: #f0f0f0;
    --container-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
        Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    --article-flag-red-bg: #e74c3c;
    --article-flag-red-fg: #ffffff;
    --article-flag-yellow-bg: #f1c40f;
    --article-flag-yellow-fg: #000000;
    --article-flag-green-bg: #2ecc71;
    --article-flag-green-fg: #ffffff;
    --article-flag-grey-bg: #7f8c8d;
    --article-flag-grey-fg: #ffffff;
}

body {
    margin: 0;
    font-family: var(--font-family);
    color: var(--text-color);
    background: var(--bg-gradient);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background: var(--header-color);
    color: #fff;
    /* erhoehten Abstand oberhalb des Suchfeldes */
    padding: 1.05rem 1rem 0.75rem;
    display: grid;
    grid-template-columns: 25% 50% 25%;
    align-items: center;
    box-shadow: var(--container-shadow);
}

.logo {
    font-size: 3rem;
    font-weight: bold;
    color: #fff;
    display: flex;
    align-items: center;
    width: 100%;
    text-decoration: none;
}
.logo-icon {
    display: inline-flex;
    margin-right: 0.5rem;
    margin-top: 0.24rem;
}
.logo-icon svg {
    width: 1em;
    height: 1em;
}

.logo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.action-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-start;
    align-self: flex-start;
}

.action-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: nowrap;
}

.action-menu {
    display: none;
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    flex: 0 0 auto;
}

.action-button {
    display: none;
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--header-color);
    color: #fff;
    cursor: pointer;
    margin-top: 0;
    flex: 0 0 auto;
    white-space: nowrap;
}

.import-button {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    background: #2f6f6f;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    margin-top: 0;
}

.import-button:hover {
    background: #245a5a;
}

.action-feedback {
    color: #fff;
    font-size: 0.9rem;
}

.action-hint {
    display: none;
    color: #f7f7f7;
    font-size: 0.75rem;
    line-height: 1.3;
    max-width: 22rem;
}

.search-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* etwas mehr Luft zwischen Sucheingabe und den Elementen darunter */
    gap: 1rem;
    width: 100%;
}

.search-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calc-icon {
    cursor: pointer;
    font-size: 1.2rem;
    color: #fff;
}
.calc-icon svg,
.toggle-icon svg {
    width: 1em;
    height: 1em;
}
.brand-cart {
    display: inline-flex;
    vertical-align: middle;
    margin-left: 0.25rem;
    color: var(--text-color);
}
.brand-cart svg {
    width: 1em;
    height: 1em;
}

.calculator-input {
    display: none;
    width: 14rem;
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
}

.search-row.with-calculator input[type="search"] {
    width: 30rem;
}

.search-row.with-calculator .calculator-input {
    display: block;
}

.search-options {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.summary-header {
    color: #fff;
    font-size: 1.75rem;
    line-height: 0.8;
    display: flex;
    align-items: center;
    width: fit-content;
    margin-left: auto;
}

.summary-header table {
    border-collapse: collapse;
    margin: 0;
    /* Schriftgroesse fuer die Zusammenfassungstabelle */
    font-size: 0.9rem;
}

.summary-header td:first-child {
    text-align: left;
    padding-right: 1rem;
}

.summary-header td:last-child {
    text-align: right;
}

.summary-value {
    font-weight: bold;
}

.type-filter,
.status-filter {
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
}
.brand-filter {
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-color);
}
.brand-status {
    display: none;
    cursor: help;
}

.table-info {
    font-size: 0.9rem;
    white-space: nowrap;
    min-width: 12rem;
}


.search-container input[type="search"] {
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    width: 45rem;
    font-size: 1rem;
}

/* Zeige den Clear-Button im Suchfeld */
.search-container input::-webkit-search-cancel-button {
    cursor: pointer;
}


main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem 2rem 2rem 1rem;
}


h1 {
    color: var(--header-color);
    margin-top: 0;
}

button {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    background: var(--header-color);
    color: #fff;
    cursor: pointer;
    transition: background 0.3s ease;
}

button:hover {
    background: #555;
}

footer {
    background: var(--header-color);
    color: #fff;
    text-align: center;
    padding: 1rem;
    box-shadow: var(--container-shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.7rem;
    table-layout: auto;
}

th,
td {
    border: none;
    padding: 0.5rem;
    text-align: left;
    white-space: nowrap;
    box-sizing: border-box;
}

th {
    cursor: pointer;
    text-align: center;
    box-sizing: border-box;
}

/* Tabellenueberschrift zentrieren */
.data-table thead th {
    text-align: center !important;
}

/* Table caption zentriert unter der DataTable */
.data-table caption {
    caption-side: bottom;
    display: block;
    margin: 0 auto;
    text-align: center;
}

/* Spaltenausrichtung */

.data-table td:nth-child(1),
.data-table td:nth-child(2),
.data-table td:nth-child(5) {
    text-align: center;
}

.data-table td:nth-child(6),
.data-table td:nth-child(7),
.data-table td:nth-child(8),
.data-table td:nth-child(9),
.data-table td:nth-child(10),
.data-table td:nth-child(11),
.data-table td:nth-child(12),
.data-table td:nth-child(13),
.data-table td:nth-child(14),
.data-table td:nth-child(15),
.data-table td:nth-child(16),
.data-table td:nth-child(17),
.data-table td:nth-child(18),
.data-table td:nth-child(19) {
    text-align: right;
}

/* PG-Spalte immer rechtsbuendig */
.data-table td:last-child {
    text-align: right;
}


/* Wert-Spalte rechtsbuendig */
.data-table td:nth-child(15) {
    text-align: right;
}

/* Null-Bestand rot hervorheben */
.data-table td.stock-zero {
    color: #e74c3c;
}

/* Beschreibung in der Tabelle */
.data-table td.description {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bezeichnung in der Tabelle */
.data-table td.title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: bold;
}

/* Bestandsspalte */
.data-table td.stock {
    font-weight: bold;
}

/* Schalter fuer VPE-Anzeige */
.toggle-icon {
    cursor: pointer;
    margin-left: 0.25rem;
    font-size: 0.8em;
}

.brand-alert {
    font-weight: bold;
    color: #e74c3c;
}

.metric-cell {
    width: 6.25rem;
}

.metric-bar {
    display: block;
    border-radius: 4px;
    overflow: hidden;
}

.metric-dots {
    display: block;
}

thead {
    background: var(--header-color);
    color: #fff;
}

/* Alternierende Zeilenfarbe */
.data-table tbody tr:nth-child(even) {
    background: #f2f2f2;
}

/* Login-Seite */
.login-bg {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #000 0%, #444 100%);
    color: #fff;
    padding: 1rem;
    position: relative;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: #fff;
    color: #000;
    padding: 3rem 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 28rem;
}

.login-form h1 {
    margin: 0;
    text-align: center;
    font-size: 1.75rem;
}

.login-form input {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.login-form button {
    padding: 0.75rem;
    font-size: 1rem;
}

.login-footer {
    margin-top: 2rem;
    color: #ccc;
    text-align: center;
    width: 100%;
    position: absolute;
    bottom: 1rem;
}

/* DataTable Anpassungen */
.dataTables_wrapper {
    width: 100%;
    margin: 0;
    overflow-x: auto;
}
.dataTables_scrollHeadInner table {
    width: 100%;
}


.dataTables_scrollBody {
    overflow-y: hidden;
}
.dataTables_filter,
.dataTables_length,
.dataTables_info {
    display: none;
}


.dataTables_wrapper .dt-buttons {
    float: none;
    margin-left: 1rem;
}

.search-options .dt-buttons {
    float: none;
    margin-left: auto;
    display: flex;
}

.dataTables_wrapper .dt-buttons,
.search-options .dt-buttons {
    display: none;
}

/* Kleinere Buttons in der DataTable */
.dataTables_wrapper .dt-button,
.search-options .dt-button {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1;
    margin-right: 0.25rem;
}

/* Einfaches Lade-Modal */
.loading-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 1.25rem;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-modal.visible {
    display: flex;
}

/* Ampelanzeige für die Marge */
.margin-cell {
    text-align: right;
}

.margin-flag {
    display: inline-block;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    /* Breite nicht erzwingen, damit die Marge-Spalte schmal bleibt */
}

.margin-flag.red {
    background: linear-gradient(
        to bottom,
        #ed7b6f,
        #e74c3c 50%,
        #cf2a19
    );
    color: #fff;
}

.margin-flag.yellow {
    background: linear-gradient(
        to bottom,
        #f3cf3f,
        #f1c40f 50%,
        #c19d0b
    );
    color: #000;
}

.margin-flag.green {
    background: linear-gradient(
        to bottom,
        #53d88b,
        #2ecc71 50%,
        #24a35a
    );
    color: #fff;
}

/* Ampelanzeige für die Lagerdauer */
.inv-days-flag {
    display: inline-block;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.inv-days-flag.red {
    background: linear-gradient(
        to bottom,
        #ed7b6f,
        #e74c3c 50%,
        #cf2a19
    );
    color: #fff;
}

.inv-days-flag.yellow {
    background: linear-gradient(
        to bottom,
        #f3cf3f,
        #f1c40f 50%,
        #c19d0b
    );
    color: #000;
}

.inv-days-flag.green {
    background: linear-gradient(
        to bottom,
        #53d88b,
        #2ecc71 50%,
        #24a35a
    );
    color: #fff;
}

/* Ampelanzeige für den Ø-Bestand */
.avg-stock-flag {
    display: inline-block;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.avg-stock-flag.red {
    background: linear-gradient(
        to bottom,
        #ed7b6f,
        #e74c3c 50%,
        #cf2a19
    );
    color: #fff;
}

.avg-stock-flag.yellow {
    background: linear-gradient(
        to bottom,
        #f3cf3f,
        #f1c40f 50%,
        #c19d0b
    );
    color: #000;
}

.avg-stock-flag.green {
    background: linear-gradient(
        to bottom,
        #53d88b,
        #2ecc71 50%,
        #24a35a
    );
    color: #fff;
}

.article-flag {
    display: inline-block;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.article-flag.red {
    background: linear-gradient(
        to bottom,
        #ed7b6f,
        var(--article-flag-red-bg) 50%,
        #cf2a19
    );
    color: var(--article-flag-red-fg);
}

.article-flag.yellow {
    background: linear-gradient(
        to bottom,
        #f3cf3f,
        var(--article-flag-yellow-bg) 50%,
        #c19d0b
    );
    color: var(--article-flag-yellow-fg);
}

.article-flag.green {
    background: linear-gradient(
        to bottom,
        #53d88b,
        var(--article-flag-green-bg) 50%,
        #24a35a
    );
    color: var(--article-flag-green-fg);
}

.article-flag.grey {
    background: linear-gradient(
        to bottom,
        #99a6a7,
        var(--article-flag-grey-bg) 50%,
        #667071
    );
    color: var(--article-flag-grey-fg);
}

.status-box {
    display: inline-block;
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 2px;
}

.select-cell {
    width: 1.5rem;
    text-align: center;
}

.status-green {
    background-color: #2ecc71;
}

.status-yellow {
    background-color: #f1c40f;
}

.status-red {
    background-color: #e74c3c;
}

.status-grey {
    background-color: #7f8c8d;
}

.content-wrapper {
    display: flex;
    width: 100%;
    align-items: flex-start;
    flex-wrap: nowrap;
}


.table-container {
    /* nutzt nun die volle Bildschirmbreite */
    flex: 0 0 100%;
    width: 100%;
}


@media (max-width: 60rem) {
    .content-wrapper {
        flex-wrap: wrap;
    }

    .table-container {
        flex: 0 0 100%;
    }
}

.weight-summary {
    margin-top: 0.5rem;
    font-weight: bold;
}
