/* ================================
   GLOBAL & BACKGROUND
   ================================ */

body,
.tv-bg {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #ffffff;
    min-height: 100vh;
    background: radial-gradient(circle at top, #1e88e5 0, #020b3d 45%, #000010 100%);
    position: relative;
    overflow-x: hidden;
}

/* Leichte Vignette für Kino-Look auf Smart TV */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.55) 100%);
    z-index: -1;
}

/* ================================
   GLITZER-LICHTER
   ================================ */

#lights-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.light-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff 0, #ffe082 40%, transparent 70%);
    opacity: 0.2;
    animation: lightTwinkle 3s infinite ease-in-out;
}

@keyframes lightTwinkle {
    0% { transform: scale(0.7); opacity: 0.1; }
    40% { transform: scale(1); opacity: 0.9; }
    70% { transform: scale(0.8); opacity: 0.4; }
    100% { transform: scale(0.7); opacity: 0.1; }
}

/* ================================
   SCHNEEFALL
   ================================ */

.snowflake {
    position: fixed;
    top: -10px;
    color: #ffffff;
    font-size: 1.2rem;
    pointer-events: none;
    animation-name: snowfall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    z-index: 2;
}

@keyframes snowfall {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) translateX(20px) rotate(360deg); opacity: 0.2; }
}

/* ================================
   HEADER
   ================================ */

.header {
    text-align: center;
    padding: 2.5rem 1rem 1.5rem;
    position: relative;
    z-index: 3;
}

.header h1 {
    font-size: 3.2rem;
    margin: 0 0 0.5rem;
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.4), 0 0 35px rgba(33, 150, 243, 0.9);
}

.header p {
    font-size: 1.6rem;
    opacity: 0.9;
}

/* ================================
   ADVENTSKALENDER GRID
   ================================ */

.calendar-grid {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1.3rem;
    padding: 2.5rem;
    max-width: 1750px;
    margin: 0 auto 3rem;
}

/* Tür-Grundstruktur */
.door {
    perspective: 1200px;
}

.door-inner {
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.25), rgba(21, 101, 192, 0.9));
    border-radius: 1.3rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    padding: 1.2rem 0.8rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 16px rgba(255, 255, 255, 0.3),
        0 0 35px rgba(33, 150, 243, 0.7);
    animation: doorGlow 4s ease-in-out infinite alternate;
}

/* Pulsierender Glow */
@keyframes doorGlow {
    0% {
        box-shadow:
            0 0 14px rgba(255, 255, 255, 0.2),
            0 0 30px rgba(33, 150, 243, 0.5);
        transform: translateY(0);
    }
    50% {
        box-shadow:
            0 0 24px rgba(255, 255, 255, 0.4),
            0 0 55px rgba(33, 150, 243, 0.9);
        transform: translateY(-2px);
    }
    100% {
        box-shadow:
            0 0 16px rgba(255, 255, 255, 0.25),
            0 0 40px rgba(33, 150, 243, 0.7);
        transform: translateY(0);
    }
}

/* Hover / Fokus – starker 3D-Effekt */
.door-inner:hover {
    transform: translateY(-6px) scale(1.03) rotateX(6deg);
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.35), rgba(21, 101, 192, 1));
    border-color: rgba(255, 255, 255, 0.8);
}

/* Türnummer */
.door-number {
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: 0.4rem;
    text-shadow: 0 0 12px rgba(0, 0, 0, 0.45);
}

/* Gewinner-Badge */
.door-winner-badge {
    font-size: 1.2rem;
    margin-top: 0.5rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: inline-block;
}

.door-winner-empty {
    opacity: 0.7;
}

/* Kleine Funken / Sparkles auf der Tür */
.door-sparkles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.7) 0, transparent 55%),
        radial-gradient(circle, rgba(255, 255, 255, 0.6) 0, transparent 55%),
        radial-gradient(circle, rgba(255, 255, 255, 0.5) 0, transparent 55%);
    background-position: 20% 20%, 70% 40%, 40% 80%;
    background-size: 10px 10px, 8px 8px, 6px 6px;
    opacity: 0.0;
    animation: sparkleMove 3.5s infinite ease-in-out alternate;
}

@keyframes sparkleMove {
    0% { opacity: 0.0; transform: translateY(0); }
    30% { opacity: 0.7; transform: translateY(-3px); }
    70% { opacity: 0.4; transform: translateY(2px); }
    100% { opacity: 0.0; transform: translateY(0); }
}

/* ================================
   MODAL
   ================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 20, 0.84);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: radial-gradient(circle at top, #1a237e, #020617);
    max-width: 900px;
    width: 90%;
    padding: 2rem 2.5rem 2rem;
    border-radius: 1.6rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    position: relative;
    box-shadow:
        0 0 25px rgba(255, 255, 255, 0.25),
        0 0 55px rgba(33, 150, 243, 0.9);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.4rem;
    font-size: 2.2rem;
    cursor: pointer;
}

.modal h2 {
    font-size: 2.5rem;
    margin-top: 0;
    margin-bottom: 1.2rem;
    text-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
}

.modal-image-wrapper {
    margin-bottom: 1.5rem;
}

.modal-image-wrapper img {
    max-width: 260px;
    height: auto;
    border-radius: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 30px rgba(33, 150, 243, 0.7);
}

.modal p {
    font-size: 1.3rem;
    line-height: 1.6;
}

.modal-winner {
    margin-top: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
}

/* ================================
   ADMIN-BEREICH
   ================================ */

.admin-login-box,
.admin-container {
    max-width: 1200px;
    margin: 2rem auto;
    background: rgba(3, 13, 61, 0.85);
    padding: 2rem;
    border-radius: 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 3;
}

.admin-login-box h1,
.admin-container h1 {
    margin-top: 0;
}

.admin-login-box input[type="password"],
.admin-container input[type="text"],
.admin-container textarea,
.admin-container input[type="file"] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    margin: 0.2rem 0 1rem;
    border-radius: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.2);
    color: #ffffff;
}

.admin-login-box button,
.admin-container button {
    padding: 0.8rem 1.5rem;
    border-radius: 0.8rem;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    background: #1e88e5;
    color: #ffffff;
    transition: background 0.2s ease, transform 0.1s ease;
}

.admin-login-box button:hover,
.admin-container button:hover {
    background: #42a5f5;
    transform: translateY(-1px);
}

.admin-flex {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
}

.admin-doors-list {
    flex: 1;
}

.admin-doors-list ul {
    list-style: none;
    padding-left: 0;
}

.admin-doors-list li {
    margin-bottom: 0.4rem;
}

.admin-doors-list a {
    color: #bbdefb;
    text-decoration: none;
}

.admin-doors-list a:hover {
    text-decoration: underline;
}

.admin-edit {
    flex: 2;
}

.admin-preview-img {
    max-width: 150px;
    border-radius: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 1rem;
}

.error {
    color: #ffcccb;
}

/* ================================
   DEZENTER LAUFTEXT (Ticker)
   ================================ */

.ticker-container {
    width: 100%;
    overflow: hidden;
    position: fixed;
    bottom: 0;
    left: 0;
    padding: 0.6rem 0;
    background: rgba(0, 0, 20, 0.55);
    backdrop-filter: blur(4px);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 999;
}

.ticker {
    display: inline-block;
    white-space: nowrap;
    font-size: 1.4rem;
    padding-left: 100%; /* Start rechts */
    animation: tickerMove 40s linear infinite;
    color: #ffffff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

@keyframes tickerMove {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* ================================
   RESPONSIVE
   ================================ */

@media (max-width: 1200px) {
    .calendar-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .calendar-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .admin-flex {
        flex-direction: column;
    }
}
