/* Allgemeine Stile und Variablen */
:root {
    --primary-color: #4CAF50; /* Dunkelgrün */
    --secondary-color: #2196F3; /* Blau */
    --accent-color: #FFC107; /* Gelb */
    --background-color: #f0f2f5; /* Helles Grau */
    --card-background: #ffffff; /* Weiß */
    --text-color: #333333; /* Dunkles Grau */
    --light-text-color: #666666; /* Mittleres Grau */
    --border-color: #e0e0e0; /* Helles Grau für Ränder */
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: var(--shadow);
}

.header h1 {
    margin: 0;
    font-size: 1.8rem;
}

.header nav {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.server-info {
    font-size: 0.9rem;
    background-color: rgba(0, 0, 0, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: var(--border-radius);
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Copyright */
.copyright {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8em;
    text-align: center;
    width: 100%;
    margin-top: 10px;
}

.copyright p {
    margin: 0;
}

/* Main Container */
.main-container {
    flex-grow: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Farm Selection Bar */
.farm-selection-bar {
    background-color: var(--card-background);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.farm-selection-bar label {
    font-weight: bold;
    color: var(--primary-color);
}

.farm-selection-bar select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: white;
    font-size: 1rem;
    min-width: 200px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.farm-selection-bar select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

/* Dashboard Grid */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.dashboard.hidden {
    display: none;
}

.dashboard-card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.dashboard-card h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    font-size: 1.4rem;
}

.dashboard-card h3 {
    color: var(--secondary-color);
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.dashboard-card p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

.dashboard-card .value {
    font-weight: bold;
    color: var(--secondary-color);
}

.scrollable-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    background-color: #fdfdfd;
}

.scrollable-list div {
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-color);
}

.scrollable-list div:last-child {
    border-bottom: none;
}

/* Formular für Aufträge */
.mission-creator-card form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mission-creator-card input[type="text"],
.mission-creator-card input[type="number"],
.mission-creator-card textarea,
.mission-creator-card select {
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.mission-creator-card textarea {
    resize: vertical;
    min-height: 80px;
}

.mission-creator-card button[type="submit"] {
    background-color: var(--primary-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.mission-creator-card button[type="submit"]:hover {
    background-color: #43A047; /* Etwas dunkleres Grün */
    transform: translateY(-2px);
}

/* Log Tabelle */
.log-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.log-table th,
.log-table td {
    border: 1px solid var(--border-color);
    padding: 0.8rem;
    text-align: left;
}

.log-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 1;
}

.log-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.log-table tbody tr:hover {
    background-color: #f0f0f0;
}

/* Farms Overview Grid */
.farms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

.farm-card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.farm-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.farm-card h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    font-size: 1.3rem;
}

.farm-card p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

.farm-card .value {
    font-weight: bold;
    color: var(--secondary-color);
}

/* Map Specific Styles */
#map {
    width: 100%;
    height: 600px; /* Feste Höhe für die Karte */
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    border-radius: var(--border-radius);
    background-color: #f0f2f5;
    margin-bottom: 1.5rem;
}

.field-marker {
    background-color: rgba(0, 123, 255, 0.7); /* Standard: Blau für unbesetzt */
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid white;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 30px; /* Größe der Marker */
    height: 30px;
}
.field-marker.owned-0 { background-color: rgba(108, 117, 125, 0.7); } /* Grau für unbesetzt */
.field-marker.owned-1 { background-color: rgba(40, 167, 69, 0.7); } /* Grün für Hof 1 */
.field-marker.owned-2 { background-color: rgba(255, 193, 7, 0.7); } /* Gelb für Hof 2 */
.field-marker.owned-3 { background-color: rgba(220, 53, 69, 0.7); } /* Rot für Hof 3 */

.field-marker:hover {
    background-color: rgba(0, 123, 255, 1); /* Intensivere Farbe beim Hover */
}

/* Blinken-Animation */
@keyframes blink {
    0% { opacity: 1; } 
    50% { opacity: 0.5; } 
    100% { opacity: 1; }
}

.field-marker.has-mission {
    animation: blink 1s linear infinite;
    border: 2px solid var(--accent-color); /* Zusätzlicher visueller Hinweis */
}

.settings-panel-wrapper {
    margin-bottom: 1.5rem;
    width: 100%;
}

.settings-panel-toggle {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    text-align: center;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.settings-panel-toggle:hover {
    background-color: #1976D2; /* Etwas dunkleres Blau */
    transform: translateY(-2px);
}

.settings-panel {
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    overflow: hidden;
    max-height: 0; /* Standardmäßig versteckt */
    opacity: 0;
    margin-top: 1rem;
}
.settings-panel.visible {
    max-height: 150px; /* Genug Platz für den Inhalt */
    opacity: 1;
}
.settings-panel label {
    font-weight: bold;
    color: var(--text-color);
}
.settings-panel input[type="number"] {
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 120px;
    font-size: 0.95rem;
}
.settings-panel button {
    background-color: var(--primary-color);
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.95rem;
}
.settings-panel button:hover {
    background-color: #43A047;
}
.settings-panel span {
    font-size: 0.9rem;
    color: var(--light-text-color);
}

/* Neues Layout für Karte und Auftragsübersicht */
.map-and-missions-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start; /* Oben ausrichten */
    flex-wrap: wrap; /* Umbruch auf kleineren Bildschirmen */
}

.map-and-missions-container #map {
    flex: 2; /* Karte nimmt mehr Platz ein */
    min-width: 400px; /* Mindestbreite für die Karte */
    height: 600px; /* Feste Höhe */
}

.mission-overview-container {
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    flex: 1; /* Missionsübersicht nimmt den restlichen Platz ein */
    min-width: 300px; /* Mindestbreite für die Liste */
    max-height: 600px; /* Gleiche Höhe wie die Karte */
    overflow-y: auto; /* Scrollbar, wenn nötig */
}
.mission-overview-container h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}
.mission-overview-field {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #fdfdfd;
}
.mission-overview-field h3 {
    margin-top: 0;
    color: var(--secondary-color);
    font-size: 1.1rem;
}
.mission-overview-item {
    background-color: #f9f9f9;
    border-left: 3px solid var(--accent-color);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    border-radius: 4px;
}
.mission-overview-item:hover {
    background-color: #e9ecef;
    transform: translateX(5px);
}
.mission-overview-item h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
    font-size: 1rem;
}
.mission-overview-item p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    color: var(--light-text-color);
}

/* Responsive Anpassungen */
@media (max-width: 1024px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .header nav {
        margin: 0;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    .server-info {
        width: 100%;
        justify-content: center;
    }
    .main-container {
        padding: 1rem;
    }
    .farm-selection-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    .farm-selection-bar select {
        width: 100%;
    }
    .dashboard {
        grid-template-columns: 1fr; /* Eine Spalte auf kleineren Bildschirmen */
    }
    .map-and-missions-container {
        flex-direction: column;
        align-items: center;
    }
    .map-and-missions-container #map,
    .mission-overview-container {
        width: 100%;
        min-width: unset;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }
    .header nav {
        gap: 0.8rem;
    }
    .nav-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    .dashboard-card h2, .mission-overview-container h2 {
        font-size: 1.2rem;
    }
    .dashboard-card h3, .farm-card h3 {
        font-size: 1rem;
    }
    .mission-creator-card input,
    .mission-creator-card textarea,
    .mission-creator-card select,
    .mission-creator-card button {
        font-size: 0.9rem;
        padding: 0.6rem;
    }
    .log-table th, .log-table td {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
}

/* Vehicle List Styling */
.vehicle-list .list-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px dashed var(--border-color);
}

.vehicle-list .list-item:last-child {
    border-bottom: none;
}

.vehicle-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.vehicle-name {
    font-weight: bold;
    color: var(--text-color);
    font-size: 1rem;
}

.vehicle-category {
    font-size: 0.85rem;
    color: var(--light-text-color);
}

.vehicle-brand {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-left: 1rem;
}

.vehicle-status {
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    margin-left: 1rem;
    font-weight: bold;
    color: white;
}

.vehicle-status.status-active {
    background-color: #4CAF50; /* Green */
}

.vehicle-status.status-idle {
    background-color: #FFC107; /* Amber */
    color: var(--text-color);
}

.vehicle-status.status-inuse {
    background-color: #2196F3; /* Blue */
}

.vehicle-status.status-parked {
    background-color: #607D8B; /* Blue Grey */
}

/* Field List Styling (already good, but ensure consistency) */
.field-list .list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px dashed var(--border-color);
}

.field-list .list-item:last-child {
    border-bottom: none;
}

.field-list .list-item span:first-child {
    font-weight: bold;
    color: var(--text-color);
}

.field-list .list-item span.category {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

/* Field Area Box Styling */
.field-area-box {
    background-color: #f5f5f5; /* Light grey background */
    color: var(--text-color);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
    margin-left: 1rem; /* Space from the field name */
}

/* Action Button Styling */
.action-button {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 0.5rem; /* Add some space above the button */
}

.action-button:hover {
    background-color: #1976D2; /* Darker blue on hover */
    transform: translateY(-2px);
}

.mission-card .actions {
    display: flex;
    justify-content: flex-end; /* Align buttons to the right */
    gap: 0.5rem; /* Space between buttons if multiple */
    margin-top: 1rem; /* Space above the action buttons */
}

.log-table button.action-button {
    margin-top: 0; /* Remove top margin for buttons in table */
}