/* --- GLOBALES RESET FÜR SAUBERE BREITEN --- */
*, *::before, *::after {
    box-sizing: border-box !important;
}

/* --- Grund-Design (Desktop & Tablet) --- */
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f6f9; color: #333; margin: 0; padding: 20px; }
.container { max-width: 1200px; margin: 0 auto; background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 100%; }
h2 { color: #2c3e50; margin-top: 0; }

/* --- NEUE DROPDOWN-NAVIGATION --- */
.main-nav { background-color: #2c3e50; border-radius: 6px; margin-bottom: 30px; position: relative; display: block; }

.mobile-menu-toggle { display: none; background: #2c3e50; color: #fff; border: none; padding: 15px 20px; font-size: 16px; font-weight: bold; text-align: left; cursor: pointer; border-radius: 6px; width: 100%; box-sizing: border-box; }
.mobile-menu-toggle:hover { background-color: #1a252f; }

.nav-menu-items { display: flex; flex-direction: row; flex-wrap: nowrap; width: 100%; padding: 0 10px; margin: 0; align-items: center; list-style: none; }
.nav-item { position: relative; flex: 0 0 auto; }
.nav-item > a { display: block; color: #fff; text-decoration: none; padding: 15px 20px; font-size: 14px; font-weight: bold; transition: background 0.2s; white-space: nowrap; }
.nav-item > a:hover { background-color: #1a252f; }

.dropdown-menu { display: none; position: absolute; top: 100%; left: 0; background-color: #fff; min-width: 220px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); border-radius: 0 0 6px 6px; z-index: 1000; overflow: hidden; border: 1px solid #ddd; padding: 0; margin: 0; }
.dropdown-menu a { display: block; color: #333; padding: 12px 20px; font-weight: normal; border-bottom: 1px solid #f1f1f1; text-decoration: none; }
.dropdown-menu a:last-child { border-bottom: none; }
.dropdown-menu a:hover { background-color: #f8f9fa; color: #0056b3; }
.nav-item:hover .dropdown-menu { display: block; }
.nav-item.open .dropdown-menu { display: block; }

.nav-right { margin-left: auto; display: flex; align-items: center; flex-wrap: nowrap; padding-right: 10px; }
.nav-right-info { font-size: 13px; color: #fff; background: rgba(0,0,0,0.2); padding: 6px 12px; border-radius: 4px; text-align: center; margin-right: 10px; white-space: nowrap; }

/* --- DASHBOARD GRID --- */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(48%, 1fr)); gap: 20px; align-items: stretch; margin-bottom: 20px; }
.grid-item { display: flex; flex-direction: column; min-width: 0; }
.grid-item > .content-box { flex-grow: 1; margin-top: 0 !important; margin-bottom: 0 !important; box-sizing: border-box; height: 100%; width: 100%; overflow-wrap: break-word; word-wrap: break-word; }
.header-flex-container { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid #ccc; padding-bottom: 5px; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.action-buttons-wrap { display: flex; gap: 10px; flex-wrap: wrap; }
.content-box { background: #fff; padding: 30px; border: 1px solid #ccc; border-radius: 5px; margin-bottom: 20px; width: 100%; }

/* --- GLOBALE TABELLEN-STYLES --- */
.table-responsive, .desktop-view-rf, .desktop-view-sl {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 15px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.table-responsive table, .rf-table, .logbook-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
    margin: 0;
    table-layout: auto; /* WICHTIG: Erlaubt dynamische Breiten, verhindert Quetschen */
}

.table-responsive th, .rf-table th, .logbook-table th {
    background-color: #f1f5f9;
    border-bottom: 2px solid #94a3b8;
    padding: 12px 10px;
    text-align: left;
    color: #334155;
    font-weight: bold;
}

.table-responsive td, .rf-table td, .logbook-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    line-height: 1.4;
    white-space: normal; /* WICHTIG: Erlaubt Umbrüche */
    word-wrap: break-word;
}

.table-responsive tbody tr:nth-child(even), .rf-table tbody tr:nth-child(even), .logbook-table tbody tr:nth-child(even) { background-color: #f8fafc; }
.table-responsive tbody tr:hover, .rf-table tbody tr:hover, .logbook-table tbody tr:hover { background-color: #e2e8f0; }

/* Spezifische Tabelle Bordbuch (Papier-Stil) */
.logbook-table th { font-size: 11px; padding: 6px 4px; border-bottom: 2px solid #ccc; background-color: #f1f1f1; vertical-align: bottom; }
.logbook-table td { padding: 6px 4px; border-bottom: 1px solid #eee; }
.paper-style th { font-weight: bold; border-right: 1px solid #e0e0e0; text-align: center; }
.paper-style th:last-child { border-right: none; }
.paper-style td { border-right: 1px solid #e0e0e0; text-align: center; padding: 4px !important; }
.paper-style td:last-child { border-right: none; }
.stacked-cell div:first-child { border-bottom: 1px dashed #ccc; padding-bottom: 3px; margin-bottom: 3px; }
.stacked-cell div { min-height: 16px; }

/* --- FORMULARE --- */
.form-row { display: flex; gap: 15px; flex-wrap: wrap; width: 100%; margin-bottom: 15px; }
.form-group { flex: 1 1 100%; min-width: 0; display: flex; flex-direction: column; }
@media (min-width: 768px) { .form-group { flex: 1; } }
label { display: block; margin-bottom: 5px; font-weight: bold; color: #555; font-size: 13px; }
input[type="text"], input[type="time"], input[type="date"], input[type="datetime-local"],
input[type="month"], input[type="number"], input[type="password"], input[type="email"],
select, textarea { width: 100%; max-width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-family: inherit; font-size: 16px; margin: 0; background-color: #fff; }

/* --- BUTTON KLASSEN --- */
.btn { display: inline-block; padding: 8px 16px; text-decoration: none; border-radius: 4px; border: none; cursor: pointer; font-size: 14px; font-weight: bold; text-align: center; transition: all 0.2s; }
.btn-primary { background-color: #0056b3; color: #fff; }
.btn-primary:hover { background-color: #004494; color: #fff; }
.btn-danger { background-color: #dc3545; color: #fff; }
.btn-danger:hover { background-color: #c82333; color: #fff; }
.btn-success { background-color: #28a745; color: #fff; }
.btn-success:hover { background-color: #218838; color: #fff; }
.btn-purple { background-color: #6f42c1; color: #fff; }
.btn-purple:hover { background-color: #5a32a3; color: #fff; }
.btn-info { background-color: #17a2b8; color: #fff; }
.btn-info:hover { background-color: #138496; color: #fff; }
.btn-warning { background-color: #d97706; color: #fff; }
.btn-warning:hover { background-color: #b45309; color: #fff; }
.btn-secondary { background-color: #6c757d; color: #fff; }
.btn-secondary:hover { background-color: #5a6268; color: #fff; }
.btn-outline { background-color: #fff; color: #333; border: 1px solid #ccc; }
.btn-outline:hover { background-color: #f8f9fa; }
.btn-sm { padding: 4px 8px; font-size: 12px; border-radius: 3px; }

/* --- SPEZIFISCHES CSS --- */
.angebot-card:hover { border-color: #28a745 !important; background-color: #f0fdf4 !important; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
.flight-form-container { background: #fff; padding: 20px; border-radius: 8px; border: 1px solid #cbd5e1; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.action-buttons { margin-top: 20px; display: flex; gap: 10px; justify-content: flex-end; }

.mobile-cards-view { display: none; }
.desktop-table-view { display: block; }

/* --- KALENDER --- */
.kalender-container { background: #fff; border: 1px solid #cbd5e1; border-radius: 8px; padding: 20px; margin-bottom: 25px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.cal-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; text-align: center; }
.cal-header { font-weight: bold; color: #4a76a8; padding-bottom: 10px; font-size: 15px; border-bottom: 2px solid #e2e8f0; margin-bottom: 5px; }
.day-cell { display: flex; flex-direction: column; align-items: stretch; border-radius: 6px; padding: 8px 4px; text-decoration: none; color: #334155; transition: all 0.2s; min-height: 100px; box-sizing: border-box; cursor: pointer; }
.day-cell:hover { filter: brightness(0.96); }
.day-number { font-size: 16px; font-weight: bold; margin-bottom: 6px; text-align: right; padding-right: 5px; }
.res-badge { color: white; font-size: 11px; padding: 4px 6px; border-radius: 3px; margin-bottom: 4px; box-shadow: 1px 1px 2px rgba(0,0,0,0.15); white-space: normal; overflow-wrap: break-word; line-height: 1.3; text-align: left; }
.res-badge.wartung { background-color: #ef4444 !important; }
.res-badge.gesperrt { background-color: #f59e0b !important; }
.res-badge.storniert { background-color: #cbd5e1 !important; text-decoration: line-through; color: #64748b !important; }

/* --- MOBIL-DESIGN MEDIA QUERIES --- */
@media (max-width: 950px) {
    body { padding: 10px; }
    .container { padding: 15px; margin-top: 10px !important; }
    .content-box { padding: 15px; }
    .mobile-menu-toggle { display: flex; justify-content: space-between; align-items: center; }
    .nav-menu-items { display: none; flex-direction: column; align-items: stretch; width: 100%; padding: 0; }
    .nav-menu-items.show { display: flex; }
    .nav-item { width: 100%; border-top: 1px solid #34495e; display: block; flex: none; }
    .nav-item > a { width: 100%; white-space: normal; }
    .nav-right { margin-left: 0; flex-direction: column; width: 100%; border-top: 1px solid #34495e; padding: 15px 20px; gap: 10px; align-items: stretch; }
    .nav-right .nav-item { border-top: none; }
    .nav-right .nav-item a { padding: 10px; text-align: center; border-radius: 4px; border: 1px solid #4a6278; }
    .nav-right-info { margin-right: 0; margin-bottom: 5px; }
    .dropdown-menu { position: static; width: 100%; box-shadow: none; border: none; border-left: 4px solid #0056b3; display: none; border-radius: 0; }
}

@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    table { font-size: 12px !important; }
    th, td { padding: 8px 4px !important; }
    .action-buttons-wrap { flex-direction: column; width: 100%; }
    .action-buttons-wrap .btn { width: 100%; text-align: center; margin-bottom: 5px; box-sizing: border-box; }
    h3 { font-size: 16px !important; }

    .desktop-view-rf, .desktop-view-sl, .desktop-table-view, .desktop-view { display: none !important; }
    .mobile-view-rf, .mobile-view-sl, .mobile-cards-view, .mobile-view { display: block !important; }

    .kalender-container { padding: 10px; }
    .day-cell { min-height: 65px; padding: 4px 2px; }
    .day-number { font-size: 14px; text-align: center; padding-right: 0; }
    .res-badge { font-size: 9px; padding: 2px; text-align: center; }
    .hide-mobile { display: none; }
    .flight-form-container { padding: 15px; }
    .action-buttons { flex-direction: column; width: 100%; }
    .action-buttons .btn { width: 100%; text-align: center; margin-bottom: 5px; }
}