* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    color: white;
}

/* Weihnachtliches Motiv: statisches Hintergrundbild (verschneite Winterlandschaft mit Mond,
   Sternen und Tannen, www/pictures/background.svg) statt des vorherigen animierten
   CSS-Sternenhimmels/Schneetreibens. */
body {
    min-height: 100vh;
    padding: 20px 12px 90px;
    background: #04201a url('../pictures/background.svg') no-repeat center bottom;
    background-size: cover;
    background-attachment: fixed;
}

#currentDate {
    text-align: center;
    margin-bottom: 10px;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    font-weight: bold;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
}

/* Startseite: die 24 Fenster sind ueber ein ganzseitiges Hintergrundbild verteilt -
   .calendar ist nur noch der Bezugsrahmen fuer die absolut positionierten Kacheln,
   js/start.js weist ihnen bei jedem Aufruf zufaellig eine von 24 vordefinierten
   Positionen zu (siehe DOOR_SLOTS dort). */
.calendar {
    position: relative;
    width: 100%;
    max-width: 1400px;
    min-height: 74vh;
    margin: 0 auto;
}

.door {
    position: absolute;
    top: var(--door-top, 50%);
    left: var(--door-left, 50%);
    transform: translate(-50%, -50%);
    width: clamp(72px, 10.5vw, 112px);
    height: clamp(72px, 10.5vw, 112px);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 3px solid rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    font-size: clamp(1.5rem, 3.4vw, 2.4rem);
    font-weight: 800;
    text-decoration: none;
    overflow: hidden;
    /* Innenflaeche des Fensters - bei geoeffneten Tueren soll hier spaeter ein kleines
       Bild eingeblendet werden (z.B. als Hintergrundbild dieser Kachel); Rahmengroesse
       und overflow:hidden sind bereits darauf ausgelegt. */
}

.door[data-state="locked"] {
    cursor: not-allowed;
    border-color: rgba(200, 210, 200, 0.4);
    background: rgba(0, 0, 0, 0.35);
    color: rgba(214, 224, 214, 0.55);
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.8);
}

.door[data-state="unlocked"] {
    cursor: pointer;
    border-color: #ffcc00;
    background: rgba(255, 204, 0, 0.15);
    color: #ffe28a;
    text-shadow: 0 0 12px rgba(255, 204, 0, 0.9), 0 2px 5px rgba(0, 0, 0, 0.7);
}

.door[data-state="opened"] {
    cursor: pointer;
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.2);
    color: #baffc4;
    text-shadow: 0 0 12px rgba(76, 175, 80, 0.9), 0 2px 5px rgba(0, 0, 0, 0.7);
}

/* Auf schmalen Bildschirmen ist freies Verteilen unuebersichtlich/ueberlappend -
   dort faellt die Startseite auf ein einfaches, kompaktes Raster zurueck. Wichtig:
   transform/top/left explizit zuruecksetzen, sonst wirkt das per JS gesetzte
   translate(-50%,-50%) weiter und verschiebt die Kacheln aus dem Rasterplatz. */
@media (max-width: 640px) {
    .calendar {
        position: static;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        min-height: 0;
        padding: 6px;
    }

    .door {
        position: static !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: auto;
        height: auto;
        aspect-ratio: 1 / 1;
    }
}

/* Tueren-Seite */
.corner-number {
    position: fixed;
    top: 10px;
    right: 10px;
    font-size: clamp(1.5rem, 5vw, 3rem);
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1000;
}

/* Sobald die obere Statusleiste sichtbar ist (Zurueck-Link und/oder Admin-Zahnrad),
   darunter einruecken, damit sich Ecknummer und Leiste nicht ueberlappen. */
body.auth-sb-space-top .corner-number {
    top: calc(var(--auth-sb-top-h, 40px) + 10px);
}

.content-box {
    width: 95%;
    max-width: 1000px;
    min-height: 40vh;
    margin: 0 auto;
    background-color: rgba(1, 75, 1, 0.7);
    border: 3px solid white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    font-size: clamp(1rem, 2vw, 1.5rem);
    padding: 20px;
    border-radius: 10px;
}

/* Admin-Konfigurationsseite - bewusst kompakt: kleine Abstaende, Ueberschrift und
   Aktionen in einer Zeile, Formulare untereinander statt gestapelter Bloecke. */
.admin-panel {
    width: 100%;
    text-align: left;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 10px;
}

.admin-panel h2 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-panel .meta {
    color: #cfe8cf;
    font-size: 0.85rem;
    font-weight: normal;
}

.admin-panel form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
}

.admin-panel form:last-child {
    margin-bottom: 0;
}

.admin-panel label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-weight: 600;
    font-size: 0.85rem;
}

.admin-panel input[type="date"] {
    padding: 5px 7px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 0.95rem;
}

.admin-panel .button,
.admin-panel button {
    display: inline-block;
    background: #ffcc00;
    color: #002b0f;
    font-weight: bold;
    padding: 6px 14px;
    font-size: 0.9rem;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
}

.admin-panel .button-danger {
    background: #c62828;
    color: white;
}

.table-scroll {
    overflow-x: auto;
}

.status-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.85rem;
}

.status-table th,
.status-table td {
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 4px 8px;
    text-align: center;
    white-space: nowrap;
}

.status-table td.true {
    background-color: #4caf50;
    color: white;
}

.status-table td.false {
    background-color: rgba(255, 255, 255, 0.08);
    color: #aaa;
}
