:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --primary-color: #d32f2f; /* Fire Engine Red */
    --secondary-color: #424242;
    --accent-color: #ff9800;
    --success-color: #2e7d32;
    --info-color: #0288d1;
    --warning-color: #fbc02d;
    --danger-color: #c62828;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0,0,0,0.3);
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.leitstelle-container, .status-container {
    flex: 1;
}

h1, h2, h3 {
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0;
}

h1 { font-size: 1.5rem; margin-bottom: 0; }
h2 { font-size: 1.3rem; margin-bottom: 10px; }
h3 { font-size: 1.1rem; margin-bottom: 8px; }

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* Common Components */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid #333;
}

button {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--secondary-color);
    color: white;
}

button:hover {
    filter: brightness(1.2);
}

button:active {
    transform: translateY(2px);
}

input[type="text"], input[type="password"], select {
    padding: 12px;
    border: 1px solid #444;
    background: #2a2a2a;
    color: white;
    border-radius: var(--border-radius);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #aaa;
    font-size: 0.85rem;
}

/* Status Badges */
.status-badge {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    font-size: 1.1rem;
    display: inline-block;
    min-width: 30px;
    text-align: center;
}

.status-badge.status-1 { background: var(--info-color); box-shadow: 0 0 10px var(--info-color); }
.status-badge.status-2 { background: var(--success-color); box-shadow: 0 0 10px var(--success-color); }
.status-badge.status-3 { background: var(--warning-color); color: black; box-shadow: 0 0 10px var(--warning-color); }
.status-badge.status-4, .status-badge.status-6 { background: var(--danger-color); box-shadow: 0 0 10px var(--danger-color); }
.status-badge.special { 
    background: var(--accent-color); 
    color: black; 
    box-shadow: 0 0 10px var(--accent-color);
    font-size: 0.85rem;
    padding: 6px 12px;
}

/* --- STATUS PAGE (Vehicle View) --- */
.status-container {
    max-width: 1200px;
    min-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.status-container > * {
    width: 100%;
    box-sizing: border-box;
}

.leitstelle-info {
    font-size: 0.9rem;
    color: #888;
    margin-top: -5px;
    margin-bottom: 15px;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 15px auto;
    width: 100%;
    max-width: 300px;
}

.key {
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    background: #333;
    border: 2px solid #444;
    border-radius: 12px;
    cursor: pointer;
    color: #bbb;
    transition: all 0.2s;
}

.key .label {
    display: none;
}

.key:hover {
    background: #444;
    border-color: #666;
}

.key.active {
    background: var(--success-color);
    color: white;
    border-color: #4caf50;
    box-shadow: 0 0 20px rgba(46, 125, 50, 0.5);
}

.key.special-active {
    background: var(--accent-color);
    color: black;
    border-color: #ffb74d;
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.5);
}

#messages {
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: var(--border-radius);
    height: 200px;
    overflow-y: auto;
    padding: 0;
    margin-top: 20px;
    text-align: left;
}

.message-row {
    padding: 8px 12px;
    border-bottom: 1px solid #222;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.message-sender {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    min-width: 25px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.message-sender.ls {
    background-color: var(--info-color);
}

.message-sender.sf {
    background-color: var(--danger-color);
}

.message-time {
    color: #666;
    font-size: 0.8rem;
    white-space: nowrap;
    min-width: 65px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.message-text {
    flex-grow: 1;
    word-break: break-all;
}

.kurzstatus-list {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    border: 1px solid #333;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.kurzstatus-item {
    padding: 12px 15px;
    background: #252525;
    border-bottom: 1px solid #333;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.kurzstatus-item:hover {
    background: #333;
}

.kurzstatus-item.active {
    background: rgba(2, 136, 209, 0.2);
    color: var(--info-color);
    font-weight: bold;
}

/* Notice Area */
#notice-area {
    display: none;
    background: var(--danger-color);
    color: white;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    animation: pulse 2s infinite;
    width: 100%;
    box-sizing: border-box;
}

#confirmed-notice-area {
    background: var(--success-color);
    color: white;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    border: 2px solid #fff;
    box-shadow: 0 0 15px rgba(46, 125, 50, 0.8);
    width: 100%;
    box-sizing: border-box;
}

#confirmed-notice-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.confirmed-notice-main {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pulse-dot {
    width: 12px;
    height: 12px;
    background-color: #fff;
    border-radius: 50%;
    animation: dot-pulse 1.5s infinite;
}

@keyframes dot-pulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.5; }
}

#confirmed-notice-timer {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    background: rgba(0,0,0,0.2);
    padding: 4px 8px;
    border-radius: 4px;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(198, 40, 40, 0); }
    100% { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0); }
}

#notice-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#confirm-btn {
    background: var(--success-color);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid #333;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 12px;
    color: #888;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

.tab-btn.flash {
    animation: tab-flash 1s infinite alternate;
}

@keyframes tab-flash {
    from { background-color: transparent; }
    to { background-color: var(--danger-color); color: white; }
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* --- LEITSTELLE VIEW --- */
.leitstelle-container {
    max-width: 1200px;
    min-width: 1000px;
    margin: 0 auto;
}

.code-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    background: #000;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    display: inline-block;
    margin: 10px 0;
    border: 1px solid #333;
}

.condensed-top {
    padding: 15px !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.header-info {
    flex: 1;
    min-width: 250px;
}

.header-info h1 {
    margin: 0;
}

.admin-info {
    margin: 5px 0 0 0;
    font-size: 0.8rem;
    color: #888;
}

.codes-grid {
    display: flex;
    gap: 15px;
}

.code-box {
    text-align: center;
}

.code-box label {
    font-size: 0.7rem;
    margin-bottom: 2px;
}

.code-copyable {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    font-weight: bold;
    color: transparent;
    background: #000;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #333;
    user-select: none;
    transition: all 0.2s;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.code-copyable:hover {
    border-color: #555;
}

.code-copyable.visible {
    color: var(--primary-color);
    text-shadow: none;
}

.code-copyable.sf-code.visible {
    color: var(--success-color);
}

.code-copyable.copied::after {
    content: "Kopiert!";
    position: absolute;
    background: var(--success-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 3px;
    transform: translateY(-25px);
    animation: fadeout 1s forwards;
}

@keyframes fadeout {
    0% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

.connection {
    background: var(--card-bg);
    margin-bottom: 8px;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    border-left: 5px solid #444;
}

.car-main-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
    gap: 10px;
}

.car-info-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.car-details {
    display: none;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #333;
    width: 100%;
}

.car-details.active {
    display: block;
}

.notes-area {
    margin-top: 10px;
}

.notes-area label {
    font-size: 0.75rem;
    margin-bottom: 5px;
}

.notes-area textarea {
    width: 100%;
    min-height: 60px;
    background: #121212;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px;
    font-size: 0.85rem;
    resize: vertical;
}

.status-control-area {
    margin-top: 15px;
}

.status-control-area label {
    font-size: 0.75rem;
    margin-bottom: 5px;
}

.status-buttons {
    display: flex;
    gap: 8px;
}

.status-btn {
    flex: 1;
    padding: 8px 5px !important;
    font-size: 0.9rem !important;
    font-weight: 800 !important;
}

.status-btn.status-1 { background: var(--info-color) !important; }
.status-btn.status-2 { background: var(--success-color) !important; }
.status-btn.status-3 { background: var(--warning-color) !important; color: black !important; }
.status-btn.status-4 { background: var(--danger-color) !important; }
.status-btn.status-7 { background: var(--danger-color) !important; border: 2px solid white; }
.status-btn.status-8 { background: var(--success-color) !important; border: 2px solid white; }

.connection[data-status="1"] { border-left-color: var(--info-color); }
.connection[data-status="2"] { border-left-color: var(--success-color); }
.connection[data-status="3"] { border-left-color: var(--warning-color); }
.connection[data-status="4"] { border-left-color: var(--danger-color); }

.timer {
    font-family: monospace;
    color: #888;
    font-size: 0.8rem;
}

.timer-green { color: #4caf50 !important; }
.timer-yellow { color: #fbc02d !important; }
.timer-orange { color: #ff9800 !important; }
.timer-red { color: #f44336 !important; }


.car-name {
    font-weight: bold;
}

.private-message-form {
    display: flex;
    gap: 5px;
    align-items: center;
}

.private-message-form input {
    padding: 5px 10px !important;
    font-size: 0.85rem;
    width: 120px !important;
}

.private-message-form button {
    padding: 5px 10px !important;
    font-size: 0.85rem;
}

.kurzstatus-badge {
    font-size: 0.85rem;
    background: rgba(2, 136, 209, 0.1);
    padding: 5px 10px;
    border-radius: 4px;
    display: flex;
    gap: 10px;
    align-items: center;
    white-space: nowrap;
}

.notice-badge {
    font-size: 0.85rem;
    padding: 5px 10px;
    border-radius: 4px;
    display: flex;
    gap: 10px;
    align-items: center;
    white-space: nowrap;
}

.notice-badge.notice-pending { background: rgba(255, 152, 0, 0.1); border: 1px solid var(--warning-color); }
.notice-badge.notice-confirmed { background: rgba(46, 125, 50, 0.1); border: 1px solid var(--success-color); }

.request-btn {
    padding: 5px 10px !important;
    font-size: 0.85rem !important;
    background: var(--primary-color) !important;
}

.ack-kurzstatus-btn {
    padding: 2px 8px !important;
    font-size: 0.75rem !important;
    background: var(--info-color) !important;
}

.section {
    border: 1px solid #333;
    background: #1a1a1a;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 20px;
}

.section h2, .section h3 {
    font-size: 1.1rem;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
    margin-bottom: 15px;
}

.section-blitz { border-top: 4px solid var(--warning-color); }
.section-sprechwunsch { border-top: 4px solid var(--accent-color); }
.section-staffelfuehrer { border-top: 4px solid var(--danger-color); }

.staffelfuehrer-notice {
    background: var(--danger-color);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.staffelfuehrer-notice .timer {
    color: #fff;
    background: rgba(0,0,0,0.2);
    padding: 2px 5px;
    border-radius: 3px;
}

/* --- STAFFELFÜHRER VIEW --- */

.ack-btn {
    background: var(--success-color);
}

/* Footer Styles */
#sf-toggle-btn {
    background: var(--info-color);
    padding: 5px 12px;
    font-size: 0.85rem;
    border: 1px solid #fff;
    white-space: nowrap;
}

#sf-toggle-btn.active {
    background: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
}

footer {
    margin-top: 40px;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid #333;
    color: #888;
    font-size: 0.9rem;
}

footer p {
    margin: 5px 0;
}

footer a {
    color: #aaa;
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}
