:root {
    --primary: #d32f2f;
    /* Fire Engine Red */
    --primary-light: #ff6659;
    --primary-dark: #9a0007;
    --bg-dark: #0f111a;
    --bg-card: #1a1d2e;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --accent: #2196f3;
    --success: #4caf50;
    --warning: #ffb300;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.logo-icon {
    font-size: 2rem;
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary));
}

.brand-text {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 1.2rem;
}

.nav-links {
    flex: 1;
    list-style: none;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-links li {
    padding: 12px 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
    border-left: 4px solid transparent;
}

.nav-links li i {
    width: 20px;
}

.nav-links li:hover {
    background: var(--glass);
    color: var(--text-main);
}

.nav-links li.active {
    background: rgba(211, 47, 47, 0.1);
    color: var(--primary-light);
    border-left: 4px solid var(--primary);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.waldbrand-indicator {
    background: var(--glass);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
}

.waldbrand-indicator .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 5px;
}

.stufe-display {
    font-weight: bold;
    color: var(--warning);
    font-size: 1.1rem;
}

/* Main Content area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: 70px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(26, 29, 46, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
}

.search-bar {
    position: relative;
    width: 400px;
}

.search-bar i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input {
    width: 100%;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 10px 15px 10px 45px;
    border-radius: 8px;
    color: white;
    outline: none;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.availability-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

/* Bereit-Status (Standard/Active) */
.availability-toggle.active {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success) !important;
    border-color: rgba(76, 175, 80, 0.3);
}

.availability-toggle.active .status-dot {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

/* Abwesend-Status */
.availability-toggle.abwesend {
    background: rgba(211, 47, 47, 0.1) !important;
    color: var(--primary-light) !important;
    border-color: rgba(211, 47, 47, 0.3) !important;
}

.availability-toggle.abwesend .status-dot {
    background: var(--primary) !important;
    box-shadow: 0 0 10px var(--primary) !important;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: 0.3s;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

#content-area {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
    background: radial-gradient(circle at top right, rgba(211, 47, 47, 0.05), transparent);
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-light);
}

.card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    align-items: center;
}

.card-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(211, 47, 47, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Alarm Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.alarm-card {
    background: #000;
    border: 5px solid var(--primary);
    width: 600px;
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
}

.btn {
    padding: 12px 25px;
    border-radius: 10px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-accept {
    background: var(--success);
    color: white;
}

.btn-decline {
    background: var(--primary);
    color: white;
}

.hidden {
    display: none !important;
}

/* Vehicle Status & Grid */
.vehicle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.vehicle-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    transition: 0.3s;
}

.current-status {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.status-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.status-buttons button {
    padding: 10px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    background: var(--glass);
    color: white;
}

/* Status colors */
.status-1 {
    color: #2196f3;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.3);
}

.status-2 {
    color: #4caf50;
    border: 1px solid #4caf50;
}

.status-3 {
    color: #ffb300;
    background: rgba(255, 179, 0, 0.1);
}

.status-4 {
    color: #f44336;
    background: rgba(244, 67, 54, 0.1);
}

.status-6 {
    color: #757575;
    border: 1px solid #555;
}

.s-1:hover {
    background: #2196f3;
}

.s-2:hover {
    background: #4caf50;
}

.s-3:hover {
    background: #ffb300;
}

.s-4:hover {
    background: #f44336;
}

.s-6:hover {
    background: #757575;
}

/* Chat Module */
.chat-container {
    height: calc(100vh - 180px);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    padding: 12px 18px;
    border-radius: 12px;
    max-width: 70%;
    border: 1px solid var(--glass-border);
}

.message.received {
    background: var(--glass);
    align-self: flex-start;
}

.message.sent {
    background: var(--primary-dark);
    align-self: flex-end;
    border-color: var(--primary);
}

.message .sender {
    font-size: 0.75rem;
    color: var(--accent);
    display: block;
    margin-bottom: 5px;
}

.chat-input-area {
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    border-top: 1px solid var(--glass-border);
}

.chat-input-area input {
    flex: 1;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: 8px;
    color: white;
}

.chat-input-area button {
    background: var(--primary);
    border: none;
    width: 45px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
}

/* Admin Panel & UI */
.loading-spinner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    gap: 1rem;
}

.admin-tabs {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
    border-radius: 8px;
    white-space: nowrap;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px rgba(211, 47, 47, 0.4);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary-light);
}

.pulse-border {
    border: 1px solid var(--primary) !important;
    animation: border-pulse 2s infinite;
}

@keyframes border-pulse {
    0% {
        border-color: var(--primary);
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.4);
    }

    70% {
        border-color: var(--primary-light);
        box-shadow: 0 0 20px 0 rgba(211, 47, 47, 0);
    }

    100% {
        border-color: var(--primary);
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0);
    }
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

.status-tag {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: bold;
}

.status-tag.red {
    background: var(--primary);
    color: white;
}

/* NAVIGATION / MAP */
.map-page-container {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.map-search-wrap {
    display: flex;
    gap: 10px;
    background: var(--bg-card);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.map-search-wrap input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 10px 15px;
    border-radius: 8px;
    color: white;
    outline: none;
}

.map-search-wrap input:focus {
    border-color: var(--primary-light);
}

#map {
    flex: 1;
    width: 100%;
    min-height: 400px;
    /* Sicherstellen, dass die Map eine Höhe hat */
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    z-index: 1;
    background: #111;
    /* Dunkler Hintergrund als Platzhalter */
}

/* Ensure Leaflet controls don't mess up our UI */
.leaflet-container {
    font-family: inherit;
}