/* =========================================================
   Sitzungszimmer-Buchungssystem – Swissrail
   ========================================================= */

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

:root {
    --rot: #c0001a;
    --rot-dunkel: #8a0013;
    --grau-hell: #f5f5f5;
    --grau: #e0e0e0;
    --grau-mittel: #999;
    --text: #1a1a1a;
    --weiss: #ffffff;
    --gruen: #2e7d32;
    --gruen-hell: #e8f5e9;
    --orange: #e65100;
    --orange-hell: #fff3e0;
    --blau: #1565c0;
    --blau-hell: #e3f2fd;
    --radius: 6px;
    --schatten: 0 2px 8px rgba(0,0,0,.12);
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--grau-hell);
    min-height: 100vh;
}

/* ----- Header ----- */
header {
    background: var(--rot);
    color: var(--weiss);
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--schatten);
}

header .logo {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-decoration: none;
    color: var(--weiss);
}

header nav {
    margin-left: auto;
    display: flex;
    gap: 1rem;
    align-items: center;
}

header nav a {
    color: var(--weiss);
    text-decoration: none;
    font-size: .9rem;
    opacity: .9;
}

header nav a:hover { opacity: 1; text-decoration: underline; }

/* ----- Hauptinhalt ----- */
main {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* ----- Karten ----- */
.card {
    background: var(--weiss);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--rot);
    border-bottom: 2px solid var(--grau);
    padding-bottom: .5rem;
}

/* ----- Meldungen ----- */
.messages { list-style: none; margin-bottom: 1rem; }

.messages li {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: .5rem;
    font-size: .95rem;
}

.messages .success { background: var(--gruen-hell); color: var(--gruen); border-left: 4px solid var(--gruen); }
.messages .error   { background: var(--orange-hell); color: var(--orange); border-left: 4px solid var(--orange); }
.messages .info    { background: var(--blau-hell); color: var(--blau); border-left: 4px solid var(--blau); }
.messages .warning { background: var(--orange-hell); color: var(--orange); border-left: 4px solid var(--orange); }

/* ----- Formulare ----- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: .3rem;
    font-size: .95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid var(--grau);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: var(--weiss);
    color: var(--text);
    transition: border-color .15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--rot);
    box-shadow: 0 0 0 3px rgba(192,0,26,.15);
}

.form-errors {
    color: var(--orange);
    font-size: .875rem;
    margin-top: .25rem;
}

.form-errors ul { list-style: none; }

/* ----- Buttons ----- */
.btn {
    display: inline-block;
    padding: .5rem 1.25rem;
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .15s, opacity .15s;
}

.btn-primary   { background: var(--rot); color: var(--weiss); }
.btn-primary:hover { background: var(--rot-dunkel); }

.btn-secondary { background: var(--grau); color: var(--text); }
.btn-secondary:hover { background: #ccc; }

.btn-danger    { background: var(--orange); color: var(--weiss); }
.btn-danger:hover { opacity: .85; }

.btn-sm { padding: .3rem .75rem; font-size: .85rem; }

/* ----- Messen-Liste ----- */
.messen-liste {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.messe-karte {
    background: var(--weiss);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
    padding: 1.25rem;
    border-top: 4px solid var(--rot);
}

.messe-karte h3 { margin-bottom: .5rem; }
.messe-karte .datum { color: var(--grau-mittel); font-size: .9rem; margin-bottom: 1rem; }

/* ----- Tage-Navigation ----- */
.tage-nav {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tage-nav a {
    padding: .4rem .9rem;
    border-radius: var(--radius);
    background: var(--grau);
    color: var(--text);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
    transition: background .15s;
}

.tage-nav a:hover { background: #ccc; }
.tage-nav a.aktiv { background: var(--rot); color: var(--weiss); }

/* ----- Hallen-Navigation ----- */
.hallen-nav {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.hallen-nav a {
    padding: .4rem 1rem;
    border-radius: var(--radius);
    background: var(--grau);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    transition: background .15s;
}

.hallen-nav a:hover { background: #ccc; }
.hallen-nav a.aktiv { background: var(--rot); color: var(--weiss); }

/* ----- Belegungsraster ----- */
.raster-wrapper {
    overflow-x: auto;
}

.raster {
    border-collapse: collapse;
    width: 100%;
    font-size: .85rem;
    min-width: 600px;
}

.raster th, .raster td {
    border: 1px solid var(--grau);
    padding: .3rem .5rem;
    text-align: center;
    white-space: nowrap;
}

.raster thead th {
    background: var(--rot);
    color: var(--weiss);
    font-weight: 700;
}

.raster .zeit-kopf {
    background: var(--grau-hell);
    font-weight: 600;
    color: var(--grau-mittel);
    font-size: .8rem;
    width: 60px;
}

.raster .frei {
    background: var(--gruen-hell);
    cursor: pointer;
}

.raster .frei:hover { background: #c8e6c9; }

.raster .belegt {
    background: #ffcdd2;
    font-size: .78rem;
    color: #b71c1c;
}

.raster .belegt-eigen {
    background: #ffe0b2;
    font-size: .78rem;
    color: #bf360c;
}

.raster .belegt-eigen .info-icon {
    display: inline-block;
    border: 1px solid currentColor;
    border-radius: 3px;
    padding: 0 .25em;
    font-size: .72rem;
    line-height: 1.4;
    cursor: help;
    opacity: .75;
    margin-left: .2em;
    position: relative;
}

.raster .belegt-eigen .info-icon:hover {
    opacity: 1;
}

/* ----- Custom Tooltip ----- */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
}

.tooltip-box {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    font-size: .8rem;
    line-height: 1.4;
    padding: .45rem .65rem;
    border-radius: 5px;
    white-space: pre-line;
    z-index: 999;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.tooltip-box::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: #333;
}

.tooltip-wrapper:hover .tooltip-box,
.tooltip-wrapper.tooltip-aktiv .tooltip-box {
    display: block;
}

/* ----- Eigene Buchungen ----- */
.buchungen-liste {
    list-style: none;
}

.buchungen-liste li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .6rem 0;
    border-bottom: 1px solid var(--grau);
    font-size: .9rem;
}

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

.buchungen-liste .info { flex: 1; }

/* ----- Hinweis-Banner ----- */
.hinweis {
    background: var(--blau-hell);
    border-left: 4px solid var(--blau);
    color: var(--blau);
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .95rem;
}

.hinweis-warnung {
    background: var(--orange-hell);
    border-left: 4px solid var(--orange);
    color: var(--orange);
}

/* ----- Admin-Dashboard ----- */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.admin-karte {
    background: var(--weiss);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
    padding: 1.25rem;
    border-top: 4px solid var(--rot);
    text-decoration: none;
    color: var(--text);
    display: block;
    transition: box-shadow .15s;
}

.admin-karte:hover { box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.admin-karte h3 { margin-bottom: .4rem; color: var(--rot); }
.admin-karte p { font-size: .9rem; color: var(--grau-mittel); }

/* ----- Tabellen ----- */
table.liste {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

table.liste th, table.liste td {
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--grau);
    text-align: left;
}

table.liste th {
    background: var(--grau-hell);
    font-weight: 700;
}

table.liste tr:hover td { background: #fafafa; }

/* ----- Footer ----- */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--grau-mittel);
    font-size: .85rem;
    margin-top: 2rem;
}
