/**
 * BAB-Tool Rettungsdienst - Stylesheet
 * Betriebsabrechnungsbogen gemäß Kostenrichtlinie NDS
 */

:root {
    --primary-color: #1e3a5f;
    --secondary-color: #2d5a87;
    --accent-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #c0392b;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #333;
    --text-muted: #6c757d;
    
    /* Kostenstellen-Farben */
    --hauptkst-color: #e8f4fd;
    --hilfskst-color: #fff3cd;
    --allgkst-color: #d4edda;
    --summen-color: #f0f0f0;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    background-color: #f5f6fa;
    margin: 0;
    padding: 0;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.header .subtitle {
    opacity: 0.8;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Navigation */
.nav {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 2rem;
}

.nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1rem;
}

.nav a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}

.nav a:hover, .nav a.active {
    background: var(--accent-color);
    color: white;
}

/* Main Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.card-header {
    background: var(--light-bg);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 1.5rem;
}

/* Formular-Elemente */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #219a52;
}

.btn-secondary {
    background: var(--text-muted);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 12px;
}

/* BAB-Tabelle */
.bab-table-wrapper {
    overflow-x: auto;
    margin: -1.5rem;
    padding: 1.5rem;
}

.bab-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 1200px;
}

.bab-table th,
.bab-table td {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
}

.bab-table thead th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.bab-table thead th.rotate {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    height: 100px;
    padding: 0.5rem 0.25rem;
    white-space: nowrap;
}

/* Kostenstellentyp-Farben in Header */
.bab-table th.hauptkst {
    background: #1a4c7c;
}

.bab-table th.hilfskst {
    background: #8b6914;
}

.bab-table th.allgkst {
    background: #1a6331;
}

/* Zeilen-Styling */
.bab-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.bab-table tbody tr:hover {
    background: #f0f7ff;
}

/* Summenzeilen */
.bab-table tr.summe td {
    background: var(--summen-color);
    font-weight: 600;
}

.bab-table tr.summe-zs td {
    background: #d9e7f5;
    font-weight: 700;
}

/* Kategorie-Header */
.bab-table tr.kategorie-header td {
    background: var(--secondary-color);
    color: white;
    font-weight: 600;
    padding: 0.5rem;
}

/* Spaltenbreiten */
.bab-table .col-zeile {
    width: 40px;
    text-align: center;
}

.bab-table .col-kostenart {
    width: 250px;
    min-width: 200px;
}

.bab-table .col-summe {
    width: 100px;
    text-align: right;
    font-weight: 600;
}

.bab-table .col-betrag {
    width: 90px;
    text-align: right;
}

/* Input in Tabelle */
.bab-table input.betrag-input {
    width: 100%;
    padding: 0.25rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-align: right;
    font-size: 12px;
    background: white;
}

.bab-table input.betrag-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: #fff8e1;
}

.bab-table input.betrag-input:disabled {
    background: #f5f5f5;
    color: #666;
}

/* Statusanzeige */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.status-planung {
    background: #fff3cd;
    color: #856404;
}

.status-erfassung {
    background: #cce5ff;
    color: #004085;
}

.status-abgeschlossen {
    background: #d4edda;
    color: #155724;
}

/* Filter-Bereich */
.filter-bar {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.filter-bar .form-group {
    margin-bottom: 0;
}

.filter-bar select {
    min-width: 200px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--text-color);
}

.tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    font-weight: 600;
}

/* Alert/Messages */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

/* Statistik-Boxen */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-box .label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-box .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 0.25rem;
}

.stat-box.highlight {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.stat-box.highlight .label,
.stat-box.highlight .value {
    color: white;
}

/* Legende */
.legend {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Print-Styles */
@media print {
    .nav, .filter-bar, .btn, .no-print {
        display: none !important;
    }
    
    .header {
        background: white;
        color: black;
        border-bottom: 2px solid black;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .bab-table {
        font-size: 10px;
    }
}
