/**
 * Presqo Design System
 * Angelehnt an PRD3 Corporate Design
 * Gemeinsame Styles für alle Module
 */

/* ===== RESET & BASE ===== */
* { margin:0; padding:0; box-sizing:border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a1a;
    font-size: 13px;
    line-height: 1.5;
}

/* ===== PAGE HEADER ===== */
.page-header {
    background: #3b5a7c;
    color: #fff;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header h1 {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-header h1 i { color: #93c5fd; font-size: 16px; }
.page-header .subtitle { font-size: 12px; color: #94a3b8; }
.page-header .badge-count {
    background: rgba(255,255,255,0.15);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
}

/* ===== TABS (PRD3 Style) ===== */
.tabs { display: flex; gap: 0; }
.tab-btn {
    padding: 8px 18px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid #c5cfd8;
    border-bottom: none;
    background: #e8ecf0;
    border-radius: 4px 4px 0 0;
    transition: background 0.1s;
    font-weight: 500;
    color: #555;
    font-family: inherit;
}
.tab-btn:hover { background: #d4dce3; }
.tab-btn.active {
    background: #fff;
    border-bottom-color: #fff;
    font-weight: 600;
    color: #3b5a7c;
}

/* Header-inline Tabs (für dunklen Header) */
.page-header .tabs { margin-left: auto; }
.page-header .tab-btn {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
}
.page-header .tab-btn.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}
.page-header .tab-btn:hover:not(.active) {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== PANELS/CARDS (PRD3 Style) ===== */
.card, .panel {
    background: #fff;
    border: 1px solid #d4dce3;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 12px;
}
.card h2, .panel h3 {
    font-size: 14px;
    font-weight: 600;
    color: #3b5a7c;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e8ecf0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card h2 i, .panel h3 i { font-size: 13px; }

/* ===== FILTER BAR ===== */
.filter-bar {
    background: #fff;
    border: 1px solid #d4dce3;
    border-radius: 4px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.filter-bar label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}
.filter-bar input,
.filter-bar select {
    padding: 6px 8px;
    border: 1px solid #c5cfd8;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
}
.filter-bar input:focus,
.filter-bar select:focus {
    border-color: #3b5a7c;
    outline: none;
    box-shadow: 0 0 0 2px rgba(59,90,124,0.12);
}

/* ===== BUTTONS (PRD3 Style) ===== */
.btn {
    padding: 6px 14px;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.1s;
    font-family: inherit;
    line-height: 1.4;
}
.btn i { font-size: 12px; }
.btn-primary {
    background: #3b5a7c;
    color: #fff;
    border-color: #2d4a68;
}
.btn-primary:hover { background: #2d4a68; }
.btn-secondary {
    background: #e8ecf0;
    color: #3b5a7c;
    border-color: #c5cfd8;
}
.btn-secondary:hover { background: #d4dce3; }
.btn-success {
    background: #22c55e;
    color: #fff;
    border-color: #16a34a;
}
.btn-success:hover { background: #16a34a; }
.btn-danger {
    background: #ef4444;
    color: #fff;
    border-color: #dc2626;
}
.btn-danger:hover { background: #dc2626; }
.btn-warning {
    background: #eab308;
    color: #fff;
    border-color: #ca8a04;
}
.btn-warning:hover { background: #ca8a04; }
.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}
.btn-sm i { font-size: 11px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ===== TABLES (PRD3 Style) ===== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
}
th {
    text-align: left;
    padding: 8px 12px;
    background: #e8ecf0;
    color: #3b5a7c;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #c5cfd8;
    white-space: nowrap;
}
td {
    padding: 7px 12px;
    border-bottom: 1px solid #e8ecf0;
}
tbody tr:hover td { background: #e8f0fe; }
tbody tr:nth-child(even) td { background: #f5f7f9; }
tbody tr:nth-child(even):hover td { background: #e8f0fe; }
tbody tr.selected td,
tbody tr.active td { background: #c8ddf5; }
.col-num, .col-right { text-align: right; }

/* Klickbare Zeilen */
.produkt-row { cursor: pointer; }
.produkt-row:hover td { background: #e8f0fe; }
.produkt-row.active td { background: #c8ddf5; }

/* ===== FORMS (PRD3 Style) ===== */
.form-section {
    background: #fff;
    border: 1px solid #d4dce3;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 12px;
}
.form-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #3b5a7c;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e8ecf0;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.form-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 10px;
}
.form-group label, .field-label {
    font-size: 11px;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.form-group input,
.form-group select,
.form-group textarea {
    padding: 6px 8px;
    border: 1px solid #c5cfd8;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #3b5a7c;
    outline: none;
    box-shadow: 0 0 0 2px rgba(59,90,124,0.12);
}
.form-group input[readonly] { background: #f0f0f0; color: #666; }
.form-group textarea { resize: vertical; min-height: 80px; }
.field-wide { grid-column: 1 / -1; }

/* ===== MODALS (PRD3 Style) ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s;
}
.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}
.modal {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    max-width: 600px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(10px);
    transition: transform 0.15s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-wide { max-width: 900px; }
.modal-header {
    padding: 14px 18px;
    background: #3b5a7c;
    color: #fff;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
}
.modal-close, .close-btn {
    cursor: pointer;
    font-size: 18px;
    opacity: 0.7;
    background: none;
    border: none;
    color: #fff;
}
.modal-close:hover, .close-btn:hover { opacity: 1; }
.modal-body {
    padding: 18px;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid #e8ecf0;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* Status dots (PRD3) */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}
.status-dot.gray { background: #9ca3af; }
.status-dot.green { background: #22c55e; }
.status-dot.red { background: #ef4444; }
.status-dot.yellow { background: #eab308; }

/* ===== SUMMARY BAR ===== */
.summary-bar {
    display: flex;
    gap: 20px;
    padding: 8px 12px;
    background: #f0f2f5;
    border-top: 1px solid #d4dce3;
    font-size: 13px;
    margin-top: 8px;
    border-radius: 0 0 4px 4px;
}
.summary-bar span { color: #555; }
.summary-bar strong { color: #1a1a1a; }

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    z-index: 9999;
    transition: bottom 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast.show { bottom: 24px; }
.toast.success { background: #22c55e; color: white; }
.toast.error { background: #ef4444; color: white; }

/* ===== GRID LAYOUTS ===== */
.lager-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}

/* ===== LAGER CARDS ===== */
.lager-card {
    background: #fff;
    border: 1px solid #d4dce3;
    border-radius: 4px;
    padding: 16px;
    overflow: hidden;
}
.lager-card h3 {
    font-size: 15px;
    font-weight: 700;
    color: #3b5a7c;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.lager-card h3 i { color: #3b5a7c; }
.lager-card .subtitle { font-size: 12px; color: #666; margin-bottom: 10px; }
.lager-card .info-row {
    font-size: 12px;
    color: #555;
    padding: 3px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.lager-card .info-row i { width: 14px; text-align: center; color: #999; }
.lager-card .actions {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e8ecf0;
    display: flex;
    gap: 8px;
}

/* ===== OPENING HOURS ===== */
.oz-preview {
    display: flex;
    gap: 4px;
    margin-top: 10px;
}
.oz-dot {
    width: 24px;
    height: 24px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}
.oz-dot.open { background: #dcfce7; color: #15803d; }
.oz-dot.closed { background: #fee2e2; color: #b91c1c; }

.oz-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f2f5;
}
.oz-tag { font-size: 12px; font-weight: 600; width: 24px; color: #555; }
.oz-times { display: flex; align-items: center; gap: 6px; }
.oz-times input[type="time"] {
    padding: 4px 6px;
    border: 1px solid #c5cfd8;
    border-radius: 3px;
    font-size: 12px;
}
.oz-closed { font-size: 12px; color: #999; font-style: italic; }

/* Switch Toggle */
.oz-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}
.oz-switch input { opacity: 0; width: 0; height: 0; }
.oz-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #cbd5e1;
    transition: 0.2s;
    border-radius: 10px;
}
.oz-switch .slider:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: white;
    transition: 0.2s;
    border-radius: 50%;
}
.oz-switch input:checked + .slider { background: #22c55e; }
.oz-switch input:checked + .slider:before { transform: translateX(16px); }

/* ===== FORECAST HINT ===== */
.forecast-hint {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #3b5a7c;
}
.forecast-hint i { margin-right: 6px; }

/* ===== DETAIL SECTION ===== */
.buchungen-detail {
    margin-top: 16px;
}
.buchungen-detail h3 {
    font-size: 14px;
    font-weight: 600;
    color: #3b5a7c;
    margin-bottom: 8px;
}

/* ===== SPLIT VIEW ===== */
.split-h { display: flex; gap: 12px; }
.split-h > * { flex: 1; min-width: 0; }

/* ===== PAGE LAYOUT (Sidebar Offset) ===== */
.page-wrapper, .page {
    position: absolute;
    top: 0;
    left: 240px;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    background: #e8ecf0;
    transition: left 0.25s ease;
}
body.kp-sidebar-collapsed .page-wrapper,
body.kp-sidebar-collapsed .page { left: 56px; }
@media (max-width: 768px) {
    .page-wrapper, .page { left: 0; top: 48px; }
}

/* ===== LOADING / EMPTY STATE ===== */
.loading { text-align: center; padding: 30px; color: #999; }
.loading i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 30px; color: #999; font-size: 13px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c5cfd8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a8b5c4; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .container { padding: 12px; }
    .page-header { padding: 12px 16px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .form-row { grid-template-columns: 1fr; }
    .lager-grid { grid-template-columns: 1fr; }
    .split-h { flex-direction: column; }
}

/* ===== PRINT ===== */
@media print {
    .page-header, .filter-bar, .btn, .kp-sidebar { display: none !important; }
    body { padding: 0 !important; background: white !important; }
    .container { max-width: none; padding: 0; }
    table { font-size: 11px; }
    .card, .panel { border: 1px solid #ccc; box-shadow: none; }
}
