:root {
    --primary: #b4001d;
    --primary-hover: #8f0017;
    --bg: #f4f5f7;
    --text: #1b1b1b;
    --card-bg: #ffffff;
    --shadow-soft: 0 2px 7px rgba(0, 0, 0, 0.15);
    --radius: 10px;
    --radius-large: 12px;
}

/* RESET --------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* HEADER --------------------------------------------------- */

.main-header {
    background: var(--primary);
    color: #fff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-soft);
    gap: 10px;
}

.logo-title {
    font-size: 1.35rem;
    font-weight: bold;
    display: block;
}

.logo-subtitle {
    font-size: 0.9rem;
    opacity: 0.85;
}

/* NAVIGATION ------------------------------------------------ */

.main-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.main-nav a {
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: var(--radius);
    white-space: nowrap;
}

.main-nav a:hover {
    background: var(--primary-hover);
}

/* User Badge in Navbar */
.nav-user {
    font-size: 0.85rem;
    font-weight: bold;
}

/* Dropdown ----------------------------------------------- */

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-toggle {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius);
    white-space: nowrap;
}

.nav-dropdown-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.nav-dropdown-menu {
    position: absolute;
    right: 0;
    top: 110%;
    background: #ffffff;
    min-width: 220px;
    box-shadow: var(--shadow-soft);
    border-radius: 12px;
    padding: 10px 0;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown-menu:hover {
    opacity: 1;
    pointer-events: auto;
}

.nav-dropdown-menu a {
    display: block;
    padding: 10px 18px;
    color: #1b1b1b;
    text-decoration: none;
    font-size: 0.9rem;
}

.nav-dropdown-menu a:hover {
    background: #f3f3f3;
}

/* PAGE CONTENT --------------------------------------------- */

.page-content {
    padding: 25px;
    max-width: 1100px;
    margin: 0 auto;
}

/* CARDS ---------------------------------------------------- */

.card {
    background: var(--card-bg);
    border-radius: var(--radius-large);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}

.card-header {
    font-size: 1.4rem;
    margin-bottom: 15px;
    font-weight: bold;
}

/* FORM ELEMENTS -------------------------------------------- */

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
}

input[type="text"],
input[type="password"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: var(--radius);
    background: #fff;
    font-size: 0.95rem;
}

textarea {
    resize: vertical;
}

/* BUTTONS -------------------------------------------------- */

button,
.btn {
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #555;
    color: #fff;
}
.btn-secondary:hover {
    background: #333;
}

.btn-danger {
    background: #c0392b;
    color: #fff;
}
.btn-danger:hover {
    background: #922b21;
}

/* TABLES --------------------------------------------------- */

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius-large);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    font-size: 0.9rem;
}

th, td {
    padding: 8px 10px;
}

th {
    background: #e9e9e9;
    text-align: left;
}

tr:nth-child(even) td {
    background: #fafafa;
}

tr:hover td {
    background: #f3f3f3;
}

/* BADGES --------------------------------------------------- */

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius);
    font-size: 0.75rem;
    margin-right: 4px;
    margin-bottom: 3px;
    color: #fff;
}

.badge-qual {
    background: #0077cc;
}

.badge-rk-ea {
    background: #777;
}

.badge-rk-ha {
    background: #0066ff;
}

/* AMBULANCE CARDS ------------------------------------------ */

.ambulance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.ambulance-card {
    background: #fff;
    border-radius: var(--radius-large);
    padding: 16px;
    box-shadow: var(--shadow-soft);
}

.ambulance-card-header {
    font-weight: bold;
    margin-bottom: 5px;
}

.ambulance-card-meta {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 10px;
}

.slot {
    background: #f0f0f0;
    padding: 6px 8px;
    border-radius: var(--radius);
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.slot-user form {
    display: inline-block;
}

/* TELEFONBUCH TABS ----------------------------------------- */

.tab-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 6px 12px;
    border-radius: var(--radius);
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 0.9rem;
}

.tab-button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.tab-content {
    display: none;
}

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

/* LOGIN ----------------------------------------------------- */

.login-wrapper {
    max-width: 400px;
    margin: 60px auto;
}

/* FOOTER ---------------------------------------------------- */

.main-footer {
    margin-top: 40px;
    padding: 15px;
    text-align: center;
    color: #777;
    font-size: 0.85rem;
}

/* -----------------------------------------------------------
   RESPONSIVE DESIGN (HANDY / TABLETS)
   ----------------------------------------------------------- */

@media (max-width: 768px) {

    body {
        font-size: 0.9rem;
    }

    /* Header stacken */
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 12px;
    }

    .main-nav {
        justify-content: flex-start;
        gap: 6px;
    }

    .main-nav a,
    .nav-dropdown-toggle {
        font-size: 0.85rem;
        padding: 5px 8px;
    }

    .nav-user {
        width: 100%;
        margin-top: 4px;
        font-size: 0.8rem;
    }

    /* Content */
    .page-content {
        padding: 15px;
    }

    .card {
        padding: 15px;
    }

    .login-wrapper {
        max-width: 100%;
        margin: 30px auto;
        padding: 0 10px;
    }

    /* Ambulance grid: 1 Spalte */
    .ambulance-grid {
        grid-template-columns: 1fr;
    }

    /* Slot: Spalten umbrechen */
    .slot {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Tabellen scrollbar */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        font-size: 0.8rem;
    }

    thead, tbody, tr, th, td {
        white-space: nowrap;
    }

    .main-footer {
        font-size: 0.8rem;
        padding: 10px;
    }
}
