/**
 * Touren-Planer v3 CSS
 * Exakt extrahiert aus dem Monolith (planer-view.php Zeile 488-1084)
 * Plus Base-Event-Styles die im Monolith implizit waren.
 */

:root { --primary: #667eea; }

/* ═══ HEADER ═══ */
.planer-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.planer-title { margin: 0; font-size: 1.4rem; font-weight: 700; color: #1f2937; }
.planer-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.planer-select { padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; background: white; }
.planer-select.primary { border: 2px solid #3b82f6; background: #eff6ff; font-weight: 600; }
.planer-btn { padding: 8px 14px; border: none; border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.planer-btn.map-toggle { background: #6b7280; color: white; }
.planer-btn.map-toggle.active { background: #3b82f6; }

/* ═══ 3-TAGE NAVIGATION ═══ */
.planer-date-nav { display: flex; align-items: center; gap: 4px; background: #f3f4f6; padding: 4px; border-radius: 8px; }
.planer-date-btn { padding: 8px 10px; border: none; background: transparent; cursor: pointer; border-radius: 6px; font-size: 1rem; }
.planer-date-btn:hover { background: #e5e7eb; }
.planer-today-btn { padding: 8px 12px; border: none; background: #10b981; color: white; cursor: pointer; border-radius: 6px; font-size: 0.8rem; font-weight: 600; margin-left: 8px; }
.planer-date-tabs { display: flex; gap: 2px; }
.planer-date-tab { padding: 6px 14px; border: none; background: transparent; cursor: pointer; border-radius: 6px; text-align: center; transition: all 0.2s; }
.planer-date-tab .tab-label { display: block; font-size: 0.7rem; color: #6b7280; font-weight: 500; }
.planer-date-tab .tab-date { display: block; font-size: 0.85rem; font-weight: 600; color: #374151; }
.planer-date-tab:hover { background: #e5e7eb; }
.planer-date-tab.active { background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.planer-date-tab.active .tab-label { color: #3b82f6; }
.planer-date-tab.active .tab-date { color: #1e40af; }

/* ═══ MAIN LAYOUT ═══ */
.planer-main-layout { display: flex; gap: 16px; height: calc(100vh - 180px); min-height: 600px; }

/* ═══ 3-SPALTEN GANTT ═══ */
.planer-3day-container { flex: 1; display: flex; gap: 8px; background: white; border-radius: 12px; padding: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); overflow: hidden; }
.planer-day-column { flex: 1; display: flex; flex-direction: column; min-width: 0; border-radius: 8px; overflow: hidden; }
.planer-day-column.yesterday { opacity: 0.7; }
.planer-day-column.tomorrow { opacity: 0.9; }
.planer-day-column.today { box-shadow: 0 0 0 2px #3b82f6; }
.planer-day-header { padding: 10px 12px; text-align: center; font-weight: 600; border-bottom: 2px solid #e5e7eb; cursor: pointer; transition: background 0.2s; }
.planer-day-header:hover { background: #f9fafb; }
.planer-day-column.yesterday .planer-day-header { background: #f3f4f6; color: #6b7280; }
.planer-day-column.today .planer-day-header { background: #eff6ff; color: #1e40af; }
.planer-day-column.tomorrow .planer-day-header { background: #fef3c7; color: #92400e; }
.planer-day-header .day-name { font-size: 0.75rem; display: block; }
.planer-day-header .day-date { font-size: 1rem; }
.planer-day-header .day-count { font-size: 0.7rem; background: rgba(0,0,0,0.1); padding: 2px 8px; border-radius: 10px; margin-top: 4px; display: inline-block; }
.planer-day-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; background: #fafbfc; }
.planer-day-events { position: relative; height: 1440px; min-height: 100%; }

/* Stunden-Linien */
.planer-hour-line { position: absolute; left: 0; right: 0; height: 1px; background: #e5e7eb; z-index: 1; }
.planer-hour-label { position: absolute; left: 4px; font-size: 0.65rem; color: #9ca3af; z-index: 2; transform: translateY(-50%); }

/* ═══ EVENT CARDS ═══ */
.planer-event { position: absolute; border-radius: 8px; background: white; box-shadow: 0 1px 4px rgba(0,0,0,0.12); overflow: visible; cursor: pointer; transition: box-shadow 0.15s; z-index: 5; }
.planer-event:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.15); z-index: 10; }
.planer-event.dragging { opacity: 0.5; z-index: 50; }
.planer-event-header { display: flex; align-items: center; gap: 6px; padding: 6px 8px; color: white; font-size: 0.7rem; position: relative; overflow: visible; border-radius: 8px 8px 0 0; }
.planer-event-content { padding: 6px 8px; font-size: 0.7rem; }
.planer-event-title { font-size: 0.75rem; font-weight: 600; color: #1f2937; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.planer-event-info { font-size: 0.65rem; color: #6b7280; line-height: 1.4; }
.planer-step-bubble { width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,0.3); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.6rem; flex-shrink: 0; }
.planer-event-phase { font-weight: 700; font-size: 0.65rem; text-transform: uppercase; opacity: 0.9; }
.planer-event-time { position: absolute; top: -10px; right: 6px; background: inherit; color: inherit; padding: 2px 10px; border-radius: 6px; font-weight: 700; font-size: 0.82rem; box-shadow: 0 1px 4px rgba(0,0,0,0.2); z-index: 4; line-height: 1.4; }
.planer-event-drag-handle { position: absolute; top: 4px; right: 4px; font-size: 0.7rem; color: rgba(255,255,255,0.6); cursor: grab; z-index: 5; user-select: none; }
.planer-event-drag-handle:active { cursor: grabbing; }
.planer-day-events .planer-event { left: 4px; right: 4px; width: auto !important; max-width: none; }

/* ═══ EVENT STATES ═══ */
.planer-event.selected { outline: 3px solid #8b5cf6; outline-offset: 2px; box-shadow: 0 0 12px rgba(139,92,246,0.4); z-index: 100; }
.planer-event.event-changed { box-shadow: 0 0 0 3px rgba(245,158,11,0.6); }

/* Tour-Divider (LADEN) */
.planer-tour-divider { position: absolute; left: 4px; right: 4px; background: linear-gradient(90deg, #fef3c7, #fde68a); border: 2px dashed #f59e0b; border-radius: 8px; padding: 8px 12px; font-size: 0.8rem; font-weight: 600; color: #92400e; z-index: 5; display: flex; align-items: center; gap: 8px; cursor: grab; }
.planer-tour-divider .remove-btn { margin-left: auto; background: none; border: none; font-size: 1rem; cursor: pointer; color: #92400e; opacity: 0.6; }
.planer-tour-divider .remove-btn:hover { opacity: 1; }

/* Preset-Event (Pause/Tanken/Werkstatt) */
.planer-preset-event { opacity: 0.85; }
.planer-preset-event .planer-event-edit-btn { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,0.3); border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 0.7rem; cursor: pointer; color: white; display: flex; align-items: center; justify-content: center; z-index: 5; }
.planer-preset-event .planer-event-edit-btn:hover { background: rgba(255,255,255,0.5); }

/* ═══ TIME DRAG MAGNIFIER ═══ */
.planer-drag-magnifier { position: fixed; z-index: 99999; pointer-events: none; background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; padding: 12px 20px; border-radius: 12px; box-shadow: 0 8px 24px rgba(59,130,246,0.4), 0 0 0 3px rgba(59,130,246,0.2); transition: opacity 0.15s; }
.magnifier-time { font-size: 24px; font-weight: 700; letter-spacing: 0.5px; text-align: center; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.magnifier-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.9; text-align: center; margin-top: 4px; }

/* ═══ SAVE BAR ═══ */
.planer-save-bar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%) translateY(100%); z-index: 9999; background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 -4px 20px rgba(245,158,11,0.3); border-radius: 12px 12px 0 0; padding: 16px 24px; min-width: 500px; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.planer-save-bar.visible { transform: translateX(-50%) translateY(0); }
.save-bar-content { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: white; }
.save-bar-info strong { display: block; font-size: 14px; margin-bottom: 4px; }
.save-bar-info span { font-size: 12px; opacity: 0.9; }
.save-bar-btn { padding: 10px 20px; border: none; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; transition: all 0.2s; }
.save-bar-btn-reset { background: rgba(255,255,255,0.2); color: white; }
.save-bar-btn-reset:hover { background: rgba(255,255,255,0.3); }
.save-bar-btn-save { background: white; color: #d97706; }
.save-bar-btn-save:hover { background: #f9fafb; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

/* ═══ DROP INDICATOR ═══ */
.planer-day-events.drag-over { background: #eff6ff; }
.planer-drop-indicator { position: absolute; left: 4px; right: 4px; height: 3px; background: #3b82f6; border-radius: 2px; display: none; z-index: 200; }
.planer-drop-indicator.visible { display: block; }

/* ═══ KARTEN-PANEL ═══ */
.planer-map-panel { width: 0; overflow: hidden; transition: width 0.3s ease; background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.planer-map-panel.open { width: 400px; padding: 12px; }
.planer-map-panel .map-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 1px solid #e5e7eb; margin-bottom: 10px; }
.planer-map-panel .map-header h3 { margin: 0; font-size: 1rem; }
.planer-map-panel #planer-map-container { height: 250px; border-radius: 8px; overflow: hidden; }
.planer-cargo-stats { margin-top: 12px; padding: 12px; background: #f9fafb; border-radius: 8px; }
.planer-cargo-stats h4 { margin: 0 0 10px; font-size: 0.9rem; }
.cargo-weight-bar { height: 20px; background: #e5e7eb; border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.cargo-weight-fill { height: 100%; background: linear-gradient(90deg, #10b981, #3b82f6); transition: width 0.3s; }
.cargo-weight-fill.warning { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.cargo-modules-list { max-height: 150px; overflow-y: auto; font-size: 0.8rem; }
.cargo-module-item { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid #e5e7eb; }

/* ═══ PRESET SIDEBAR ═══ */
.planer-presets-panel { position: fixed; left: 20px; top: 50%; transform: translateY(-50%); background: white; border-radius: 12px; padding: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); z-index: 100; width: 140px; }
.planer-presets-panel .preset-title { font-size: 0.8rem; font-weight: 600; color: #374151; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 2px solid #e5e7eb; }
.planer-presets-panel .preset-group { margin-bottom: 12px; }
.planer-presets-panel .preset-group-title { font-size: 0.7rem; color: #6b7280; margin-bottom: 6px; }
.preset-btn { display: block; width: 100%; padding: 8px 10px; margin-bottom: 4px; border: none; background: #f3f4f6; border-radius: 6px; font-size: 0.8rem; cursor: pointer; text-align: left; transition: all 0.2s; }
.preset-btn:hover { background: #e5e7eb; }
.preset-btn.lade-btn { background: #fef3c7; }
.preset-btn.lade-btn:hover { background: #fde68a; }
.preset-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ═══ LADE-TERMIN MODAL ═══ */
.lade-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; justify-content: center; align-items: center; z-index: 10000; }
.lade-modal-overlay.open { display: flex; }
.lade-modal { background: white; border-radius: 16px; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.lade-modal-header { padding: 16px 20px; border-bottom: 2px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; }
.lade-modal-header h2 { margin: 0; font-size: 1.2rem; }
.lade-modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #6b7280; }
.lade-modal-body { padding: 20px; }
.lade-form-group { margin-bottom: 16px; }
.lade-form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: #374151; margin-bottom: 6px; }
.lade-form-group input, .lade-form-group select { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.9rem; box-sizing: border-box; }
.lade-events-list { max-height: 200px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px; }
.lade-event-checkbox { display: flex; align-items: center; padding: 8px; border-radius: 6px; margin-bottom: 4px; cursor: pointer; transition: background 0.2s; }
.lade-event-checkbox:hover { background: #f3f4f6; }
.lade-event-checkbox input { margin-right: 10px; }
.lade-event-checkbox .event-info { flex: 1; }
.lade-event-checkbox .event-name { font-weight: 500; }
.lade-event-checkbox .event-meta { font-size: 0.75rem; color: #6b7280; }
.lade-modules-list { border: 1px solid #e5e7eb; border-radius: 8px; max-height: 200px; overflow-y: auto; }
.lade-modules-header { display: flex; justify-content: space-between; padding: 10px 12px; background: #f9fafb; border-bottom: 1px solid #e5e7eb; font-weight: 600; font-size: 0.85rem; }
.lade-module-item { display: flex; align-items: center; padding: 8px 12px; border-bottom: 1px solid #f3f4f6; }
.lade-module-item input { margin-right: 10px; }
.lade-module-item .module-name { flex: 1; }
.lade-module-item .module-weight { color: #6b7280; font-size: 0.8rem; }
.lade-capacity-warning { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: 10px 14px; border-radius: 8px; margin-top: 12px; font-size: 0.85rem; }
.lade-modal-footer { padding: 16px 20px; border-top: 1px solid #e5e7eb; display: flex; justify-content: flex-end; gap: 12px; }
.lade-modal-footer button { padding: 10px 20px; border: none; border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.lade-btn-cancel { background: #f3f4f6; color: #374151; }
.lade-btn-submit { background: #3b82f6; color: white; }
.lade-btn-submit:hover { background: #2563eb; }

/* ═══ GENERIC MODAL ═══ */
.planer-modal { position: fixed; inset: 0; z-index: 100000; display: none; align-items: center; justify-content: center; }
.planer-modal.open { display: flex; }
.planer-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.planer-modal-content { position: relative; background: white; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); z-index: 1; max-height: 90vh; overflow-y: auto; }
.planer-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e5e7eb; }
.planer-modal-header h3 { margin: 0; font-size: 1.1rem; }
.planer-modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: #6b7280; }

/* ═══ CARGO SIDEBAR ═══ */
#cargo-sidebar { font-size: 0.82rem; }
#cargo-sidebar .module-section { border-bottom: 1px solid #e5e7eb; }
#cargo-sidebar .module-section-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; cursor: pointer; font-weight: 600; font-size: 0.8rem; background: #f9fafb; user-select: none; }
#cargo-sidebar .module-section-header:hover { background: #f3f4f6; }
#cargo-sidebar .module-list { padding: 4px 8px; }
#cargo-sidebar .module-section.collapsed .module-list { display: none !important; max-height: 0 !important; padding: 0 !important; overflow: hidden; }
#cargo-sidebar .module-card { display: flex; align-items: center; gap: 6px; padding: 5px 6px; margin-bottom: 3px; border: 1px solid #e5e7eb; border-radius: 6px; cursor: grab; background: white; transition: border-color 0.15s; }
#cargo-sidebar .module-card:hover { border-color: #93c5fd; background: #eff6ff; }
#cargo-sidebar .module-card img { width: 40px; height: 40px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
#cargo-sidebar .module-card-info { flex: 1; min-width: 0; }
#cargo-sidebar .module-card-name { font-size: 0.72rem; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cargo-sidebar .module-card-meta { display: flex; gap: 6px; margin-top: 2px; }
#cargo-sidebar .module-card-dims, #cargo-sidebar .module-card-weight { font-size: 0.65rem; color: #6b7280; }
#module-search { width: 100%; padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.8rem; box-sizing: border-box; }

/* ═══ NOW-LINE ═══ */
.planer-now-line { position: absolute; left: 0; right: 0; height: 2px; background: #ef4444; z-index: 10; }
.planer-now-line::before { content: '▶'; position: absolute; left: -8px; top: -6px; color: #ef4444; font-size: 0.7rem; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1200px) { .planer-map-panel.open { width: 320px; } }
@media (max-width: 900px) {
    .planer-main-layout { flex-direction: column; height: auto; }
    .planer-map-panel.open { width: 100%; }
    .planer-3day-container { min-height: 500px; }
    .planer-presets-panel { position: static; transform: none; width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
    .preset-btn { display: inline-block; width: auto; }
}
