/**
 * Zentrales Stylesheet des Fulfillment-Portals.
 * Enthält alle seitenübergreifend genutzten Design-Elemente (Layout, Sidebar, Karten,
 * Buttons, Formulare, Tabellen, Badges, Tabs, Pagination). Seiten sollten hier nur noch
 * seitenspezifische Ergänzungen in einem eigenen, kurzen <style>-Block ergänzen.
 */

/* --- Basis-Layout --- */
body { font-family: Arial, sans-serif; background: #f4f6f9; margin: 0; padding: 0; display: flex; }
.content { margin-left: 250px; padding: 40px; width: 100%; box-sizing: border-box; }

/* --- Sidebar --- */
.sidebar { width: 250px; background: #2c3e50; color: #fff; height: 100vh; padding: 20px; box-sizing: border-box; position: fixed; overflow-y: auto; z-index: 1000; }
.sidebar h3 { margin-top: 0; border-bottom: 1px solid #4f5d73; padding-bottom: 10px; }
.sidebar a { display: block; color: #abd1c6; padding: 10px 0; text-decoration: none; }
.sidebar a:hover { color: #fff; }
.sidebar a.active { color: #fff; font-weight: bold; }

.mobile-menu-toggle { display: none; position: fixed; top: 15px; left: 15px; z-index: 1100; background: #2c3e50; color: #fff; border: 0; width: 42px; height: 42px; border-radius: 6px; font-size: 20px; cursor: pointer; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 999; }
.sidebar-backdrop.open { display: block; }

/* --- Karten --- */
.card { background: #fff; padding: 20px; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 25px; }

/* --- Buttons --- */
.btn, .btn-submit { padding: 8px 16px; border: 0; border-radius: 4px; color: #fff; cursor: pointer; font-size: 14px; font-weight: bold; text-decoration: none; display: inline-block; }
.btn-primary, .btn-submit { background: #007bff; }
.btn-primary:hover, .btn-submit:hover { background: #0056b3; }
.btn-success { background: #28a745; }
.btn-danger { background: #dc3545; }
.btn-info { background: #17a2b8; }
.btn-secondary { background: #6c757d; }
.btn-reset { color: #4a5568; text-decoration: none; font-size: 13px; font-weight: bold; }

/* --- Formulare --- */
.form-group { margin-bottom: 12px; }
.form-group label, label { display: block; margin-bottom: 4px; font-weight: bold; font-size: 13px; color: #333; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="email"], input[type="file"], select, textarea {
    width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; font-family: inherit; background: #fff;
}
textarea { resize: vertical; min-height: 80px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }

.checkbox-container { max-height: 120px; overflow-y: auto; border: 1px solid #ddd; padding: 8px; border-radius: 4px; background: #fafafa; }
.checkbox-item { display: flex; align-items: center; margin-bottom: 4px; font-weight: normal; }
.checkbox-item input { margin-right: 8px; width: auto; }

/* --- Tabellen --- */
table { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid #e2e8f0; text-align: left; }
th { background: #f8f9fa; color: #475569; }
th a { color: #475569; text-decoration: none; }
th a:hover { color: #007bff; }

.tarif-table th { text-align: left; font-size: 13px; text-transform: uppercase; color: #2c3e50; }
.tarif-table .tarif-preis { text-align: right; font-weight: bold; }

/* --- Meldungen --- */
.alert { padding: 12px; border-radius: 4px; margin-bottom: 20px; font-weight: bold; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* --- Badges --- */
.badge { background: #007bff; color: white; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: bold; }
.badge-admin { background: #dc3545; }
.badge-client { background: #28a745; }

.status-badge { padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: bold; color: #fff; display: inline-block; }
.status-vorlaeufig { background: #f39c12; }
.status-final { background: #27ae60; }
.status-offen { background: #95a5a6; }
.status-abgerechnet { background: #27ae60; }
.status-gesperrt { background: #dc3545; }

/* --- Tabs (Reports, Import etc.) --- */
.nav-tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid #ddd; padding-bottom: 10px; flex-wrap: wrap; }
.tab-link { padding: 10px 15px; text-decoration: none; background: #e2e8f0; color: #4a5568; border-radius: 4px; font-weight: bold; font-size: 14px; border: 0; cursor: pointer; }
.tab-link.active { background: #007bff; color: white; }

/* --- Filter-/Suchboxen --- */
.admin-filter-box, .search-box { background: #e2e8f0; padding: 15px; border-radius: 6px; margin-bottom: 20px; display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.admin-filter-box label, .search-box label { font-weight: bold; font-size: 14px; color: #2c3e50; }
.admin-filter-box select, .search-box input[type="text"] { padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 4px; background: #fff; font-size: 14px; min-width: 200px; width: auto; }

.filter-card { background: #fff; padding: 20px; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 25px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) 120px; gap: 12px; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; }
.filter-group label { font-size: 12px; font-weight: bold; color: #475569; margin-bottom: 4px; }
.filter-group input, .filter-group select { padding: 8px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 13px; background: #fff; }

/* --- KPI-/Statistik-Kacheln (Dashboard, Analytics) --- */
.header-bar { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #ddd; padding-bottom: 20px; margin-bottom: 20px; }
.grid-stats, .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 25px; }
.stat-card, .kpi-box { background: #fff; padding: 20px; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); border-left: 5px solid #007bff; }
.stat-card h4, .kpi-title { margin: 0; color: #7f8c8d; font-size: 13px; text-transform: uppercase; font-weight: bold; }
.stat-card .value, .kpi-value { font-size: 22px; font-weight: bold; margin: 10px 0 5px 0; color: #2c3e50; }
.stat-card .sub, .kpi-sub { font-size: 12px; color: #95a5a6; }
.stat-card.versand, .kpi-box.fracht { border-left-color: #2ecc71; }
.stat-card.retoure, .kpi-box.retoure { border-left-color: #e67e22; }
.stat-card.anlieferung, .kpi-box.eingang { border-left-color: #f1c40f; }
.stat-card.total { border-left-color: #9b59b6; background: #fdfefe; }
.kpi-box.avg { border-left-color: #9b59b6; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card-table { background: #fff; padding: 20px; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-top: 25px; }

/* --- Pagination --- */
.pagination { display: flex; justify-content: center; gap: 5px; list-style: none; padding: 0; margin: 20px 0 10px 0; }
.pagination li a, .pagination li span { display: block; padding: 8px 12px; border: 1px solid #cbd5e1; color: #4a5568; text-decoration: none; border-radius: 4px; font-size: 13px; font-weight: bold; }
.pagination li a:hover { background: #f1f5f9; }
.pagination li.active span { background: #007bff; color: white; border-color: #007bff; }
.pagination li.disabled span, .pagination li.disabled a { color: #94a3b8; background: #f8fafc; border-color: #e2e8f0; cursor: not-allowed; }

/* --- Sonstige wiederkehrende Elemente --- */
.pkg-box { background: #eef2f7; padding: 8px; border-radius: 4px; margin-top: 5px; font-size: 12px; border-left: 3px solid #2ecc71; }
.btn-quick-add { background: #28a745; color: white; border: 0; padding: 2px 6px; border-radius: 4px; font-weight: bold; cursor: pointer; font-size: 12px; margin-left: 5px; }
.quick-form-panel { background: #fcfcfc; border: 1px dashed #28a745; padding: 10px; margin-top: 8px; border-radius: 4px; display: none; }
.quick-form-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.quick-form-grid input, .quick-form-grid select { padding: 5px; font-size: 12px; }
.quick-form-submit { background: #28a745; color: white; border: 0; font-weight: bold; border-radius: 4px; cursor: pointer; font-size: 11px; height: 26px; }

.log-item { border-left: 4px solid #2980b9; padding-left: 15px; margin-bottom: 30px; position: relative; }
.log-item.version-latest { border-left-color: #27ae60; }
.log-header { margin-bottom: 8px; }
.log-title { font-size: 18px; font-weight: bold; color: #2c3e50; }
.log-meta { font-size: 13px; color: #7f8c8d; margin-top: 4px; }
.log-body { font-size: 14px; color: #333; line-height: 1.6; }

/* --- Mobile / Tablet (Sidebar wird zum ausklappbaren Menü, Layouts stapeln sich) --- */
@media (max-width: 768px) {
    .mobile-menu-toggle { display: block; }
    .sidebar { left: -260px; transition: left 0.25s ease; }
    .sidebar.open { left: 0; }
    .content { margin-left: 0; padding: 20px; padding-top: 75px; }

    .grid-2, .grid-3, .grid-4, .grid-5, .split-grid, .quick-form-grid,
    .grid-stats, .kpi-grid, .filter-grid { grid-template-columns: 1fr; }

    table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

    .admin-filter-box, .search-box { flex-direction: column; align-items: stretch; }
    .admin-filter-box select, .search-box input[type="text"] { width: 100%; min-width: 0; }

    .header-bar { flex-direction: column; align-items: flex-start; gap: 10px; }
    .nav-tabs { gap: 6px; }
}
