/* Feuerwehr-Farbschema */
:root {
    --feuerwehr-rot: #C8102E;
    --feuerwehr-rot-dunkel: #9B0D24;
    --feuerwehr-gelb: #FFD700;
    --feuerwehr-gelb-dunkel: #DAA520;
    --schwarz: #1a1a1a;
    --grau-dunkel: #2d2d2d;
    --grau: #4a4a4a;
    --weiss: #ffffff;
    --warnung-orange: #FF8C00;
    --alarm-rot: #FF0000;
    --erfolg-gruen: #28a745;
    --blau: #0066cc;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--schwarz);
    color: var(--weiss);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--feuerwehr-rot) 0%, var(--feuerwehr-rot-dunkel) 100%);
    padding: 1rem 2rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

header h1 {
    font-size: 2rem;
    font-weight: bold;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.header-controls {
    margin-top: 0.5rem;
}

.current-time {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--feuerwehr-gelb);
}

/* Einsatz-Info Section */
.einsatz-info {
    background: linear-gradient(135deg, var(--grau-dunkel) 0%, var(--schwarz) 100%);
    padding: 1rem 2rem;
    border-bottom: 3px solid var(--feuerwehr-rot);
}

.einsatz-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    align-items: flex-end;
}

.einsatz-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 200px;
    flex: 1;
    max-width: 300px;
}

.einsatz-field label {
    font-size: 0.85rem;
    color: var(--feuerwehr-gelb);
    font-weight: bold;
}

.einsatz-field input,
.einsatz-field select {
    padding: 0.6rem;
    font-size: 1rem;
    border: 2px solid var(--grau);
    border-radius: 6px;
    background-color: var(--grau-dunkel);
    color: var(--weiss);
    transition: border-color 0.3s ease;
}

.einsatz-field input:focus,
.einsatz-field select:focus {
    outline: none;
    border-color: var(--feuerwehr-gelb);
}

/* Haupt-Container */
main.trupp-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem;
    flex: 1;
}

/* Trupp-Karten */
.trupp-card {
    background: linear-gradient(180deg, var(--grau-dunkel) 0%, var(--schwarz) 100%);
    border: 3px solid var(--grau);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 0.3s ease;
    overflow-y: auto;
    max-height: calc(100vh - 250px);
}

.trupp-card h2 {
    text-align: center;
    color: var(--feuerwehr-gelb);
    font-size: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--grau);
}

/* Trupp Info (Funkgruppe, Einsatzort) */
.trupp-info-section {
    display: flex;
    gap: 0.5rem;
}

.trupp-info-section .info-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.trupp-info-section label {
    font-size: 0.75rem;
    color: var(--feuerwehr-gelb);
}

.trupp-info-section input {
    padding: 0.4rem;
    font-size: 0.9rem;
    border: 2px solid var(--grau);
    border-radius: 4px;
    background-color: var(--grau-dunkel);
    color: var(--weiss);
}

.trupp-info-section input:focus {
    outline: none;
    border-color: var(--feuerwehr-gelb);
}

/* Gerätetyp-Auswahl */
.geraet-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.geraet-section label {
    font-size: 0.9rem;
}

.geraet-section select {
    flex: 1;
    padding: 0.5rem;
    font-size: 1rem;
    border: 2px solid var(--grau);
    border-radius: 6px;
    background-color: var(--grau-dunkel);
    color: var(--weiss);
    cursor: pointer;
}

.geraet-section select:focus {
    outline: none;
    border-color: var(--feuerwehr-gelb);
}

.geraet-section select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Timer-Section */
.timer-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

/* Timer-Anzeige */
.timer-display {
    font-size: 3.5rem;
    font-weight: bold;
    text-align: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--schwarz);
    border: 4px solid var(--grau);
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    color: var(--weiss);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    width: 100%;
}

/* Timer-Controls */
.timer-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-time-adjust {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    background: var(--grau);
    color: var(--weiss);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-time-adjust:hover {
    background: var(--blau);
}

.btn-time-adjust:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Status-Anzeige */
.status-display {
    text-align: center;
    font-size: 0.9rem;
    font-weight: bold;
    min-height: 1.3rem;
    padding: 0.25rem;
}

/* Timer-Zustände */
.trupp-card.warnung-1 .timer-display {
    color: var(--feuerwehr-gelb);
    border-color: var(--feuerwehr-gelb);
    text-shadow: 0 0 15px var(--feuerwehr-gelb);
}

.trupp-card.warnung-1 {
    border-color: var(--feuerwehr-gelb);
}

.trupp-card.warnung-2 .timer-display {
    color: var(--warnung-orange);
    border-color: var(--warnung-orange);
    text-shadow: 0 0 15px var(--warnung-orange);
}

.trupp-card.warnung-2 {
    border-color: var(--warnung-orange);
}

.trupp-card.alarm .timer-display {
    color: var(--alarm-rot);
    border-color: var(--alarm-rot);
    animation: blink 0.5s infinite;
}

.trupp-card.alarm {
    border-color: var(--alarm-rot);
    animation: card-blink 0.5s infinite;
}

.trupp-card.paused .timer-display {
    color: var(--blau);
    border-color: var(--blau);
    animation: pulse 1.5s infinite;
}

.trupp-card.paused {
    border-color: var(--blau);
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 20px var(--alarm-rot);
    }
    50% {
        opacity: 0.5;
        text-shadow: 0 0 40px var(--alarm-rot);
    }
}

@keyframes card-blink {
    0%, 100% {
        box-shadow: 0 0 20px var(--alarm-rot);
    }
    50% {
        box-shadow: 0 0 40px var(--alarm-rot), 0 0 60px var(--alarm-rot);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.trupp-card.aktiv {
    border-color: var(--erfolg-gruen);
}

.trupp-card.aktiv .timer-display {
    color: var(--erfolg-gruen);
    border-color: var(--erfolg-gruen);
}

/* Buttons */
.button-section {
    display: flex;
    gap: 0.5rem;
}

button {
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-start {
    flex: 2;
    background: linear-gradient(135deg, var(--erfolg-gruen) 0%, #1e7e34 100%);
    color: var(--weiss);
}

.btn-start:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-start:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-start:disabled {
    background: var(--grau);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-start.running {
    background: linear-gradient(135deg, var(--feuerwehr-rot) 0%, var(--feuerwehr-rot-dunkel) 100%);
}

.btn-pause {
    flex: 1;
    background: linear-gradient(135deg, var(--blau) 0%, #004499 100%);
    color: var(--weiss);
}

.btn-pause:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
}

.btn-pause:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-pause.paused {
    background: linear-gradient(135deg, var(--feuerwehr-gelb) 0%, var(--feuerwehr-gelb-dunkel) 100%);
    color: var(--schwarz);
}

.btn-reset {
    flex: 1;
    background: linear-gradient(135deg, var(--grau) 0%, var(--grau-dunkel) 100%);
    color: var(--weiss);
}

.btn-reset:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--feuerwehr-gelb-dunkel) 0%, #b8860b 100%);
}

.btn-reset:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Firefighter Section */
.firefighter-section {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
}

.firefighter-section h4 {
    font-size: 0.9rem;
    color: var(--feuerwehr-gelb);
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--grau);
    padding-bottom: 0.25rem;
}

.firefighter {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--grau);
}

.firefighter:last-child {
    border-bottom: none;
}

.firefighter-header {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.4rem;
}

.name-input-field {
    flex: 1;
    padding: 0.4rem;
    font-size: 0.95rem;
    border: 2px solid var(--grau);
    border-radius: 4px;
    background-color: var(--grau-dunkel);
    color: var(--weiss);
}

.name-input-field:focus {
    outline: none;
    border-color: var(--feuerwehr-gelb);
}

.name-input-field:disabled {
    opacity: 0.6;
}

.btn-druck {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    background: var(--blau);
    white-space: nowrap;
}

.btn-druck:hover {
    background: #0055aa;
}

.firefighter-details {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.equipment-input {
    flex: 1;
    padding: 0.3rem;
    font-size: 0.8rem;
    border: 1px solid var(--grau);
    border-radius: 4px;
    background-color: var(--grau-dunkel);
    color: var(--weiss);
}

.equipment-input:focus {
    outline: none;
    border-color: var(--feuerwehr-gelb);
}

.equipment-input:disabled {
    opacity: 0.6;
}

/* Druck-Verlauf */
.druck-verlauf {
    font-size: 0.75rem;
    color: #aaa;
    max-height: 60px;
    overflow-y: auto;
}

.druck-verlauf .druck-eintrag {
    padding: 0.15rem 0;
    display: flex;
    justify-content: space-between;
}

.druck-verlauf .druck-wert {
    color: var(--feuerwehr-gelb);
    font-weight: bold;
}

.druck-verlauf .druck-wert.niedrig {
    color: var(--warnung-orange);
}

.druck-verlauf .druck-wert.kritisch {
    color: var(--alarm-rot);
}

/* Ereignisse */
.ereignisse {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 0.5rem;
    max-height: 120px;
    overflow-y: auto;
}

.ereignisse h4 {
    font-size: 0.85rem;
    color: var(--feuerwehr-gelb);
    margin-bottom: 0.4rem;
}

.ereignisse ul {
    list-style: none;
    font-size: 0.75rem;
}

.ereignisse li {
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--grau);
}

.ereignisse li:last-child {
    border-bottom: none;
}

.ereignisse li.warnung {
    color: var(--feuerwehr-gelb);
}

.ereignisse li.alarm {
    color: var(--alarm-rot);
    font-weight: bold;
}

.ereignisse li.druck {
    color: var(--blau);
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--grau-dunkel) 0%, var(--schwarz) 100%);
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    border-top: 3px solid var(--feuerwehr-rot);
}

.btn-export {
    background: linear-gradient(135deg, var(--feuerwehr-gelb) 0%, var(--feuerwehr-gelb-dunkel) 100%);
    color: var(--schwarz);
    min-width: 200px;
}

.btn-export:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.btn-clear {
    background: linear-gradient(135deg, var(--feuerwehr-rot) 0%, var(--feuerwehr-rot-dunkel) 100%);
    color: var(--weiss);
    min-width: 200px;
}

.btn-clear:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(200, 16, 46, 0.4);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, var(--grau-dunkel) 0%, var(--schwarz) 100%);
    border: 3px solid var(--feuerwehr-gelb);
    border-radius: 12px;
    padding: 2rem;
    min-width: 300px;
    max-width: 90%;
}

.modal-content h3 {
    color: var(--feuerwehr-gelb);
    margin-bottom: 1rem;
    text-align: center;
}

.modal-content p {
    margin-bottom: 1rem;
    text-align: center;
    color: #ccc;
}

.modal-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.modal-input-group label {
    font-size: 0.9rem;
}

.modal-input-group input {
    padding: 1rem;
    font-size: 1.5rem;
    text-align: center;
    border: 3px solid var(--grau);
    border-radius: 8px;
    background-color: var(--grau-dunkel);
    color: var(--weiss);
}

.modal-input-group input:focus {
    outline: none;
    border-color: var(--feuerwehr-gelb);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-modal-cancel {
    background: var(--grau);
    color: var(--weiss);
    min-width: 120px;
}

.btn-modal-confirm {
    background: linear-gradient(135deg, var(--erfolg-gruen) 0%, #1e7e34 100%);
    color: var(--weiss);
    min-width: 120px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    main.trupp-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .trupp-card:nth-child(3) {
        grid-column: span 2;
        max-width: 50%;
        margin: 0 auto;
    }
}

@media (max-width: 900px) {
    .einsatz-row {
        flex-direction: column;
        align-items: stretch;
    }

    .einsatz-field {
        max-width: none;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    main.trupp-container {
        grid-template-columns: 1fr;
    }

    .trupp-card {
        max-height: none;
    }

    .trupp-card:nth-child(3) {
        grid-column: span 1;
        max-width: 100%;
    }

    .timer-display {
        font-size: 2.5rem;
    }

    .button-section {
        flex-wrap: wrap;
    }

    .btn-start {
        flex: 1 1 100%;
    }

    .btn-pause, .btn-reset {
        flex: 1;
    }

    footer {
        flex-direction: column;
        align-items: center;
    }

    .btn-export, .btn-clear {
        width: 100%;
        max-width: 300px;
    }
}

/* Scrollbar-Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--grau-dunkel);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--grau);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--feuerwehr-gelb-dunkel);
}

/* Print-Styles für PDF */
@media print {
    body {
        background-color: white;
        color: black;
    }

    .trupp-card {
        break-inside: avoid;
        border: 2px solid black;
        background: white;
    }

    button {
        display: none;
    }

    footer {
        display: none;
    }
}
