/* css/dashboard.css
 *
 * Globales modernes Layout fuer das Webinterface (Desktop + Mobile).
 * Farb-Tokens und Navbar-Styles liegen in modern_menu.css.
 * Tablet-Views nutzen diese Datei nicht.
 */

/* Globale Typografie + Hintergrund */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #fafafa;
    color: #222;
}

h1, .h1, h2, .h2, h3, .h3 {
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1, .h1 { margin-bottom: 1.25rem; }

/* Karten weicher und ohne harten Border */
.card {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f1f1f1;
    font-weight: 600;
    border-top-left-radius: 14px !important;
    border-top-right-radius: 14px !important;
}

/* Buttons konsistent abrunden */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
}

.btn-sm { border-radius: 0.4rem; }

/* Brand-Buttons: Markenrot fuer Primaer- und Sekundaer-CTAs.
 * Btn-primary bleibt gruen (Bearbeiten/Speichern) - bewusste Semantik. */
.btn-brand {
    background: linear-gradient(135deg, #a02622 0%, #d9534f 100%);
    border: 0;
    color: #fff;
    box-shadow: 0 4px 14px rgba(201, 48, 44, 0.22);
    transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn-brand:hover,
.btn-brand:focus,
.btn-brand:active {
    color: #fff;
    filter: brightness(1.05);
    box-shadow: 0 6px 18px rgba(201, 48, 44, 0.32);
    transform: translateY(-1px);
}

.btn-brand-outline {
    background: #fff;
    border: 1.5px solid #d9534f;
    color: #a02622;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn-brand-outline:hover,
.btn-brand-outline:focus,
.btn-brand-outline:active {
    background: linear-gradient(135deg, #a02622 0%, #d9534f 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(201, 48, 44, 0.22);
}

/* Sanftere Toolbar-Buttons (info/warning/secondary) - ergibt mit Brand-Buttons
 * eine ruhigere, kohaerente Action-Bar statt Bootstrap-Buntheit. */
.btn-info {
    background-color: #e8f1f5 !important;
    border-color: #d4e3eb !important;
    color: #2c5868 !important;
}
.btn-info:hover, .btn-info:focus, .btn-info:active {
    background-color: #d4e3eb !important;
    border-color: #b9cfd9 !important;
    color: #1e3f4a !important;
}

.btn-warning {
    background-color: #fff4e0 !important;
    border-color: #f3e2c0 !important;
    color: #8a5a16 !important;
}
.btn-warning:hover, .btn-warning:focus, .btn-warning:active {
    background-color: #f3e2c0 !important;
    border-color: #e3cea1 !important;
    color: #6b4410 !important;
}

.btn-secondary {
    background-color: #f1f3f5 !important;
    border-color: #e3e6ea !important;
    color: #4a5159 !important;
}
.btn-secondary:hover, .btn-secondary:focus, .btn-secondary:active {
    background-color: #e3e6ea !important;
    border-color: #cfd3d8 !important;
    color: #2f343a !important;
}

/* Toolbar-Wrapper: konsistenter Abstand bei mehreren Action-Buttons. */
.action-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Brand-Text-Utility (analog zu Bootstrap .text-primary, aber Markenrot). */
.text-brand { color: #c9302c !important; }

/* Artikel-Detailseite: Hero-Block fuer ArtNr + Bezeichnung. */
.article-hero {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #fff 0%, #fff7f6 100%);
    border: 1px solid #f5dcda;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(201, 48, 44, 0.05);
}
.article-hero-artnr {
    font-size: 1.9rem;
    font-weight: 700;
    color: #a02622;
    letter-spacing: -0.02em;
    margin: 0;
}
.article-hero-bezeichnung {
    font-size: 1.1rem;
}

/* Drop-Zone fuer "Alte Zaehler" auf article_view.php. */
.article-dropzone {
    border: 2px dashed #e3c8c6;
    background: #fdf7f6;
    border-radius: 14px;
    padding: 1.75rem 1rem;
    text-align: center;
    cursor: pointer;
    color: #5a6068;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.article-dropzone:hover { background: #fbeeed; border-color: #d9534f; }
.article-dropzone.is-active {
    background: #fbeeed;
    border-color: #c9302c;
    transform: scale(1.005);
}

/* Forms */
.form-control,
.form-select {
    border-radius: 0.5rem;
}

/* Alerts */
.alert {
    border: 0;
    border-radius: 12px;
}

/* Badges */
.badge { font-weight: 500; }

/* Tabellen-Look: weiche Borders, mehr Luft, dezente Hover-Zeile.
 * Greift global ueber alle .table-Elemente, daher kein Page-Edit noetig. */
.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
    color: #2a2d33;
}

.table > :not(caption) > * > * {
    padding: 0.85rem 0.9rem;
    border-bottom-color: #f0f1f3;
    vertical-align: middle;
}

.table > thead {
    background: #fafbfc;
}

.table > thead th {
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5a6068;
}

.table > tbody > tr {
    transition: background-color 0.12s ease;
}

.table > tbody > tr:hover {
    background-color: rgba(217, 83, 79, 0.04);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: rgba(0, 0, 0, 0.015);
}

/* Tabellen optisch in eine Karte einbetten - keine nackten Tabellen mehr. */
.table-responsive {
    background: #fff;
    border: 1px solid #eef0f2;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

/* DataTables steuert seinen eigenen Wrapper - die "Suchen"-Zeile und Pagination
 * bekommen leichten Innenabstand, damit sie nicht am Rand kleben. */
.dataTables_wrapper > .row:first-child,
.dataTables_wrapper > .row:last-child {
    padding: 0.75rem 1rem;
}
.dataTables_wrapper .dataTables_info {
    color: #6c737a;
    font-size: 0.85rem;
}

/* DataTables Wrapper soll mit anderen Komponenten optisch matchen */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border-radius: 0.5rem;
    border: 1px solid #ced4da;
    padding: 0.25rem 0.5rem;
}

/* Dashboard-Kacheln: gleicher Gradient wie Navbar */
.dashboard-tile {
    display: block;
    background: linear-gradient(135deg, #a02622 0%, #d9534f 100%);
    color: #fff;
    text-align: center;
    padding: 36px 22px;
    border-radius: 16px;
    text-decoration: none;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    box-shadow: 0 6px 20px rgba(201, 48, 44, 0.18);
}

.dashboard-tile:hover,
.dashboard-tile:focus {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(201, 48, 44, 0.28);
    filter: brightness(1.04);
    color: #fff;
    text-decoration: none;
}

.dashboard-tile i {
    opacity: 0.95;
}

.dashboard-tile h3 {
    margin-top: 18px;
    margin-bottom: 0;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Counter-Badge auf Kachel: weisses Pill, gut lesbar */
.dashboard-tile .badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background-color: #fff;
    color: #a02622;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Globale Artikelsuche im Header */
.global-search-dropdown {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border: none;
    border-radius: 12px;
    padding: 1rem !important;
}

.global-search-dropdown input {
    font-size: 1rem;
    padding: 10px 12px;
    border-radius: 0.5rem;
}

.global-search-results {
    max-height: 400px;
    overflow-y: auto;
}

.global-search-results .list-group {
    margin-bottom: 0;
    border-radius: 10px;
    overflow: hidden;
}

.global-search-results .list-group-item {
    border-left: none;
    border-right: none;
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.global-search-results .list-group-item:first-child { border-top: none; }
.global-search-results .list-group-item:last-child { border-bottom: none; }

.global-search-results .list-group-item:hover,
.global-search-results .list-group-item.selected {
    background-color: rgba(217, 83, 79, 0.08);
}

.global-search-results .badge { font-size: 0.75rem; }
.global-search-results .text-muted { font-size: 0.9rem; }

/* Mobile-Tweaks */
@media (max-width: 768px) {
    .global-search-dropdown {
        min-width: 280px !important;
        left: auto !important;
        right: 0 !important;
    }
    .global-search-results { max-height: 300px; }

    .dashboard-tile {
        padding: 28px 18px;
        border-radius: 14px;
    }
    .dashboard-tile h3 { font-size: 1.15rem; }
}
