/* ======================================================== */
/* CORE STYLES & GENERAL LAYOUT                            */
/* ======================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #12161a;
    color: #f1f5f9;
    height: 100vh;
    overflow: hidden;
}
.dashboard-container { display: grid; grid-template-columns: 2fr 1fr; height: 100vh; width: 100vw; }
.bauern-cockpit { background-color: #1a1f26; padding: 24px; overflow-y: auto; border-right: 2px solid #2d3748; display: flex; flex-direction: column; gap: 24px; }
.prufer-panel { background-color: #12161a; padding: 24px; display: flex; flex-direction: column; gap: 24px; overflow-y: auto; position: relative; }
.panel-divider { border: 0; border-top: 1px solid #2d3748; margin: -8px 0; }

/* GELBER SIGNALAKZENT */
.accent-yellow { color: #f6e05e !important; text-shadow: 0 0 6px rgba(246, 224, 94, 0.2); }

/* HEADER-INTERACTION BLOCK (Info + Wetter) */
.header-interactive-block { display: flex; align-items: center; gap: 12px; }

/* ======================================================== */
/* NEU: AUTOMATISCHES START-POPUP SYSTEM (CSS)              */
/* ======================================================== */
.start-popup-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(9, 13, 16, 0.9); backdrop-filter: blur(8px);
    z-index: 1000; display: flex; justify-content: center; align-items: center;
}
.start-popup-content {
    background-color: #1a1f26; border: 2px solid #2d3748; border-radius: 16px;
    padding: 32px; width: 700px; max-width: 90%; box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    display: flex; flex-direction: column; gap: 20px;
}
.popup-intro { font-size: 1.1rem; line-height: 1.5; color: #cbd5e1; }
.popup-guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 10px; }
.guide-box { background-color: #12161a; border: 1px solid #2d3748; padding: 16px; border-radius: 8px; }
.guide-box h4 { margin-bottom: 8px; color: #fff; font-size: 1rem; }
.guide-box p { font-size: 0.85rem; line-height: 1.4; color: #a0aec0; }
.close-popup-btn {
    background-color: #2b6cb0; color: white; border: none; padding: 14px;
    border-radius: 8px; font-weight: bold; font-size: 1rem; cursor: pointer;
    transition: background-color 0.2s; margin-top: 10px;
}
.close-popup-btn:hover { background-color: #3182ce; }

/* ======================================================== */
/* NEU: BEDIENER INFO-MOUSEOVER (HEADER LINKS)             */
/* ======================================================== */
.info-mouseover-trigger {
    background-color: #2d3748; border: 1px solid #4a5568; padding: 10px 14px;
    border-radius: 8px; font-size: 0.9rem; font-weight: bold; cursor: help;
    position: relative; user-select: none; color: #fff;
}
.info-mouseover-box {
    visibility: hidden; opacity: 0; position: absolute;
    top: 125%; left: 0; width: 320px; background-color: #1a1f26;
    border: 2px solid #4a5568; border-radius: 8px; padding: 16px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5); z-index: 500;
    font-size: 0.85rem; line-height: 1.4; color: #cbd5e1;
    transition: opacity 0.2s ease-in-out; pointer-events: none;
}
.info-mouseover-trigger:hover .info-mouseover-box { visibility: visible; opacity: 1; }

/* ======================================================== */
/* NEU: TECH SPECS EXPERTEN-MOUSEOVER (PRÜFER RECHTS)       */
/* ======================================================== */
.panel-header-block { display: flex; justify-content: space-between; align-items: center; }
.tech-specs-trigger {
    background-color: rgba(246, 224, 94, 0.1); border: 1px solid rgba(246, 224, 94, 0.3);
    padding: 6px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: bold;
    cursor: help; position: relative; color: #f6e05e;
}
.tech-specs-box {
    visibility: hidden; opacity: 0; position: absolute;
    top: 125%; right: 0; width: 350px; background-color: #1a1f26;
    border: 2px solid #f6e05e; border-radius: 8px; padding: 16px;
    box-shadow: -5px 8px 25px rgba(0,0,0,0.6); z-index: 500;
    font-size: 0.85rem; line-height: 1.4; color: #cbd5e1;
    transition: opacity 0.2s ease-in-out; pointer-events: none;
}
.tech-specs-trigger:hover .tech-specs-box { visibility: visible; opacity: 1; }

/* INFO CENTER HEADER */
.info-center { display: flex; justify-content: space-between; align-items: center; background-color: #12161a; padding: 16px 24px; border-radius: 12px; border: 1px solid #2d3748; gap: 16px; }
.big-time { font-size: 2rem; font-weight: 700; color: #ffffff; letter-spacing: 0.05em; }
.sub-date { font-size: 0.85rem; color: #a0aec0; }
.status-message { flex-grow: 1; text-align: center; font-size: 1.05rem; font-weight: 600; padding: 10px 16px; border-radius: 8px; }
.status-msg-ok { background-color: rgba(72, 187, 120, 0.1); color: #68d391; border: 1px solid rgba(72, 187, 120, 0.2); }
.status-msg-warning { background-color: rgba(245, 101, 101, 0.1); color: #fc8181; border: 1px solid rgba(245, 101, 101, 0.2); }
.status-msg-info { background-color: rgba(49, 130, 206, 0.15); color: #63b3ed; border: 1px solid rgba(49, 130, 206, 0.3); }
.weather-widget { background-color: #1a1f26; border: 1px solid #2d3748; padding: 10px 18px; border-radius: 8px; cursor: pointer; text-align: right; }
.weather-main { display: flex; align-items: center; gap: 8px; }
.weather-temp { font-size: 1.3rem; font-weight: 600; color: #ffffff; }

/* TABS SYSTEM */
.field-tabs-container { background-color: #12161a; padding: 8px; border-radius: 12px; border: 1px solid #2d3748; }
.tabs-wrapper { display: flex; gap: 8px; }
.field-tab { flex: 1; background-color: #1a1f26; border: 1px solid #2d3748; border-radius: 8px; padding: 16px; display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.field-tab.active { background-color: #2b6cb0; border-color: #4299e1; }
.status-light { width: 12px; height: 12px; border-radius: 50%; }
.status-green { background-color: #48bb78; box-shadow: 0 0 8px #48bb78; }
.status-red { background-color: #f56565; box-shadow: 0 0 8px #f56565; }
.blinking { animation: soft-pulse 2s infinite ease-in-out; }
@keyframes soft-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.tab-text-wrapper { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.tab-title { font-weight: 600; color: #ffffff; }
.edit-icon { opacity: 0.2; padding: 4px; cursor: pointer; }
.field-tab:hover .edit-icon { opacity: 1; }
.edit-container { display: flex; align-items: center; gap: 4px; width: 100%; }
.edit-input { flex-grow: 1; background-color: #090d10; border: 1px solid #4a5568; border-radius: 4px; color: white; padding: 4px; font-weight: 600; outline: none; }
.edit-btn { border: none; border-radius: 4px; width: 24px; height: 24px; cursor: pointer; color: white; }
.save-btn { background-color: #38a169; }
.cancel-btn { background-color: #e53e3e; }

/* MAP AND CONTROL PANELS */
.map-and-control-section { display: grid; grid-template-columns: 1.7fr 1.3fr; gap: 20px; }
.control-stack { display: flex; flex-direction: column; gap: 20px; }
.farm-map-card { background-color: #12161a; border: 1px solid #2d3748; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.map-header { display: flex; justify-content: space-between; font-weight: 600; color: #a0aec0; font-size: 0.9rem; }
.map-grid-visual { background-color: #1e252f; border: 2px solid #2d3748; border-radius: 8px; height: 320px; position: relative; }
.building-layout { background-color: #231c1c; }

.map-node { position: absolute; display: flex; flex-direction: column; align-items: center; transform: translate(-50%, -50%); padding: 10px; border-radius: 10px; background-color: #12161a; border: 2px solid #4a5568; min-width: 80px; cursor: help; }
.node-icon { font-size: 1.4rem; }
.node-label { font-size: 0.85rem; color: #ffffff; font-weight: 700; margin-top: 2px; }
.alert-node { border-color: #e53e3e; background-color: rgba(229, 62, 62, 0.15); box-shadow: 0 0 12px rgba(229, 62, 62, 0.4); }
.water-animating { border-color: #3182ce; background-color: rgba(49, 130, 206, 0.15); animation: pulse-blue 1.5s infinite ease-in-out; }
@keyframes pulse-blue { 0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 12px rgba(49, 130, 206, 0.4); } 50% { transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 0 25px #4299e1; } }
.map-node .tooltip-box { visibility: hidden; position: absolute; bottom: 125%; left: 50%; transform: translateX(-50%); background-color: #2d3748; color: #fff; text-align: center; padding: 8px 12px; border-radius: 6px; font-size: 0.8rem; white-space: nowrap; box-shadow: 0 4px 15px rgba(0,0,0,0.5); border: 1px solid #4a5568; z-index: 10; opacity: 0; transition: opacity 0.2s; }
.map-node:hover .tooltip-box { visibility: visible; opacity: 1; }

/* CONTROLS */
.action-control-card, .automation-control-card { background-color: #12161a; border: 1px solid #2d3748; border-radius: 12px; padding: 16px; transition: opacity 0.3s; }
.control-subtext { font-size: 0.85rem; font-weight: bold; margin-bottom: 8px; }
.water-toggle-container { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 10px 0; }
.toggle-status-label { font-size: 1.1rem; font-weight: 700; color: #718096; text-transform: uppercase; }
.toggle-status-label.state-active { color: #63b3ed; text-shadow: 0 0 10px rgba(99, 179, 237, 0.3); }

/* ======================================================== */
/* OPTIMIERT: MASSIVER SCHALTER IN KRÄFTIGEN FARBEN         */
/* ======================================================== */
.giant-switch { position: relative; display: inline-block; width: 110px; height: 54px; }
.giant-switch input { display: none; }
.switch-slider { 
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; 
    background-color: #5a2020; /* Matt-Rot für AUS-Zustand */
    border-radius: 34px; 
    border: 3px solid #e53e3e; /* Kräftiger roter Rahmen */
    transition: .2s cubic-bezier(0.16, 1, 0.3, 1); 
}
.switch-slider:before { 
    position: absolute; content: ""; height: 40px; width: 40px; left: 4px; bottom: 4px; 
    background-color: #fc8181; /* Hellerer roter Knauf */
    border-radius: 50%; 
    transition: .2s cubic-bezier(0.16, 1, 0.3, 1); 
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}
/* Wenn der Schalter auf AN (checked) steht */
.giant-switch input:checked + .switch-slider { 
    background-color: #1c4ed8; /* Sattes Cyber-Blau / Traktor-Grün Mix */
    border-color: #3b82f6; 
}
.giant-switch input:checked + .switch-slider:before { 
    transform: translateX(56px); 
    background-color: #ffffff; /* Weiß leuchtender Knauf im AN-Zustand */
    box-shadow: 0 0 15px #fff;
}

.quick-stats { display: flex; gap: 10px; margin-top: 12px; }
.stat-box { flex: 1; background-color: #1a1f26; border: 1px solid #2d3748; padding: 8px; border-radius: 8px; text-align: center; }
.stat-lbl { display: block; font-size: 0.75rem; color: #a0aec0; margin-bottom: 2px; }
.stat-val { font-size: 1.1rem; font-weight: 700; color: #ffffff; }

.flow-edit-row { display: flex; align-items: center; justify-content: center; gap: 4px; }
.unit-lbl { font-size: 0.8rem; color: #718096; font-weight: bold; }
.edit-icon-flow { font-size: 0.75rem; opacity: 0.4; cursor: pointer; padding: 2px; }
.flow-edit-row:hover .edit-icon-flow { opacity: 1; }
.edit-input-flow { width: 60px; background-color: #090d10; border: 1px solid #4a5568; border-radius: 4px; color: white; padding: 2px; font-weight: bold; text-align: center; outline: none; }
.edit-btn-mini { background-color: #38a169; border: none; border-radius: 4px; color: white; padding: 2px 6px; cursor: pointer; font-size: 0.8rem; }

.auto-toggle-row { display: flex; align-items: center; gap: 14px; background-color: #1a1f26; padding: 10px; border-radius: 8px; border: 1px solid #2d3748; margin-top: 6px; }
.auto-toggle-text { display: flex; flex-direction: column; }
.auto-title { font-size: 0.85rem; font-weight: 600; color: #fff; }
.auto-desc { font-size: 0.7rem; color: #a0aec0; }
.mini-toggle { position: relative; display: inline-block; width: 42px; height: 22px; flex-shrink: 0; }
.mini-toggle input { display: none; }
.mini-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #4a5568; border-radius: 22px; transition: .2s; }
.mini-slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 4px; bottom: 4px; background-color: white; border-radius: 50%; transition: .2s; }
.mini-toggle input:checked + .mini-slider { background-color: #48bb78; }
.mini-toggle input:checked + .mini-slider:before { transform: translateX(20px); }
.water-counter-box { margin-top: 12px; background-color: #090d10; border: 1px solid #2d3748; padding: 10px; border-radius: 8px; text-align: center; }
.counter-lbl { display: block; font-size: 0.75rem; color: #a0aec0; }
.counter-val { font-size: 1.3rem; font-weight: 800; color: #63b3ed; font-family: monospace; }

/* VIDEO MATRIX STYLES */
.video-matrix-section { background-color: #12161a; border: 1px solid #2d3748; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.video-matrix-section h3 { font-size: 0.95rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin: 0; }
.video-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.video-tile { background-color: #1a1f26; border: 1px solid #2d3748; border-radius: 8px; padding: 6px; cursor: pointer; position: relative; overflow: hidden; transition: border-color 0.2s; }
.video-tile:hover { border-color: #4a5568; }
.video-placeholder-stream { background-color: #090d10; height: 110px; border-radius: 6px; border: 1px solid #2d3748; background-image: linear-gradient(45deg, #111 25%, transparent 25%), linear-gradient(-45deg, #111 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #111 75%), linear-gradient(-45deg, transparent 75%, #111 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0px; }
.video-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; padding: 0 4px; font-size: 0.8rem; font-weight: 600; }

/* CHRONIK STYLES */
.chronik-section { background-color: #12161a; border: 1px solid #2d3748; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.chronik-header-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.chronik-section h3 { font-size: 0.95rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin: 0; }
.chronik-filter-bar { display: flex; gap: 6px; background-color: #12161a; border: 1px solid #2d3748; padding: 4px; border-radius: 8px; }
.filter-btn { background: none; border: none; color: #a0aec0; padding: 8px 14px; font-size: 0.8rem; font-weight: 600; border-radius: 6px; cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.filter-btn:hover { background-color: #1a1f26; color: #fff; }
.filter-btn.active { background-color: #f6e05e; color: #12161a; font-weight: 700; }
.chronik-box { background-color: #090d10; border: 1px solid #2d3748; border-radius: 8px; padding: 12px; height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.chronik-entry { font-size: 0.85rem; line-height: 1.4; padding: 6px 10px; border-radius: 6px; background-color: #1a1f26; border-left: 4px solid #4a5568; }
.c-time { font-weight: bold; color: #a0aec0; }
.c-text { color: #f1f5f9; }
.entry-success { border-left-color: #48bb78; background-color: rgba(72, 187, 120, 0.05); }
.entry-error { border-left-color: #f56565; background-color: rgba(245, 101, 101, 0.05); }
.no-entries-msg { text-align: center; color: #4a5568; font-size: 0.85rem; padding: 20px 0; font-style: italic; }

/* MODALS & TESTBED */
.video-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(9,13,16,0.85); backdrop-filter: blur(5px); z-index: 200; display: flex; justify-content: center; align-items: center; visibility: hidden; opacity: 0; transition: opacity 0.2s; }
.video-modal.open { visibility: visible; opacity: 1; }
.modal-content { background-color: #12161a; border: 2px solid #2d3748; border-radius: 12px; padding: 20px; width: 600px; max-width: 90%; position: relative; }
.close-modal-btn { position: absolute; top: 12px; right: 16px; font-size: 1.4rem; cursor: pointer; color: #a0aec0; }
.modal-content h4 { font-size: 1.1rem; margin-bottom: 12px; }
.modal-stream-placeholder { background-color: #000; height: 340px; border-radius: 8px; border: 1px solid #2d3748; position: relative; display: flex; justify-content: center; align-items: center; }
.live-indicator { position: absolute; top: 12px; left: 12px; background-color: #e53e3e; color: white; padding: 4px 8px; font-size: 0.75rem; font-weight: bold; border-radius: 4px; animation: soft-pulse 1.5s infinite; }

.log-console { background-color: #090d10; border: 2px solid #2d3748; border-radius: 8px; padding: 12px; height: 490px; overflow-y: auto; font-family: monospace; font-size: 0.85rem; display: flex; flex-direction: column; gap: 6px; }
.log-entry { line-height: 1.4; padding: 2px 4px; border-radius: 4px; }
.log-time { color: #4a5568; }
.log-tag { font-weight: bold; }
.log-info { color: #63b3ed; }
.log-success { color: #68d391; }
.log-warnung { color: #f6ad55; }
.log-alert { color: #fc8181; background-color: rgba(252, 129, 129, 0.1); }
.weather-flyout { position: fixed; top: 0; left: -360px; width: 340px; height: 100vh; background-color: #12161a; border-right: 2px solid #2d3748; z-index: 100; padding: 24px; display: flex; flex-direction: column; gap: 24px; transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.weather-flyout.open { left: 0; }
.flyout-header { display: flex; justify-content: space-between; align-items: center; }
.close-btn { background: none; border: none; color: #a0aec0; font-size: 1.3rem; }
.hourly-timeline { display: flex; gap: 12px; background-color: #1a1f26; padding: 14px; border-radius: 8px; overflow-x: auto; }
.time-step { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 60px; font-size: 0.85rem; }
.forecast-grid { display: flex; flex-direction: column; gap: 12px; }
.forecast-card { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-radius: 8px; font-weight: 600; }
.day-sunny { background-color: rgba(221, 107, 32, 0.15); border: 1px solid rgba(221, 107, 32, 0.3); color: #fbd38d; }
.day-rainy { background-color: rgba(49, 130, 206, 0.15); border: 1px solid rgba(49, 130, 206, 0.3); color: #93c5fd; }
.day-cloudy { background-color: rgba(113, 128, 150, 0.15); border: 1px solid rgba(113, 128, 150, 0.3); color: #cbd5e1; }

@media (max-width: 1024px) {
    .dashboard-container { grid-template-columns: 1fr; overflow-y: auto; height: auto; }
    body { overflow-y: auto; height: auto; }
    .bauern-cockpit { border-right: none; border-bottom: 2px solid #2d3748; height: auto; }
    .tabs-wrapper { flex-direction: column; }
    .map-and-control-section { grid-template-columns: 1fr; }
    .video-grid { grid-template-columns: repeat(2, 1fr); }
    .chronik-header-row { flex-direction: column; align-items: flex-start; }
    .chronik-filter-bar { width: 100%; overflow-x: auto; }
}