/* Weihnachtliches Design für den Adventskalender */
:root {
    --christmas-red: #c1272d;
    --christmas-green: #0f5132;
    --christmas-gold: #d4af37;
    --snow-white: #f8f9fa;
    --door-color: #8b0000;
}

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

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--christmas-green);
    background-image: url('../assets/images/background.jpg');
    background-size: cover;
    background-attachment: fixed;
    color: var(--snow-white);
    position: relative;
    min-height: 100vh;
}

/* Schneefall-Effekt */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.5) 1px, transparent 1px),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.5) 1px, transparent 1px),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
    background-size: 100px 100px;
    z-index: -1;
    animation: snowfall 10s linear infinite;
}

@keyframes snowfall {
    0% { background-position: 0 0; }
    100% { background-position: 0 100px; }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    border: 2px solid var(--christmas-gold);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

h1 {
    font-size: 3rem;
    color: var(--christmas-red);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    font-family: 'Rouge Script', cursive;
}

.test-mode-banner {
    background-color: rgba(255, 255, 0, 0.3);
    color: black;
    padding: 5px;
    border-radius: 5px;
    margin-top: 10px;
}

/* Kalender-Layout */
.calendar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .calendar {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .calendar {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Türchen-Design */
.door {
    aspect-ratio: 1;
    background-color: var(--door-color);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 3px solid var(--christmas-gold);
    perspective: 800px; /* Für 3D-Öffnungsanimation */
}

.door.openable {
    cursor: pointer;
}

.door.openable:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* Tilt-Effekt nur für spezifische Kästchen mit Klasse .tilt */
.door.openable.tilt:hover {
    transform: translateY(-5px) rotate(2deg);
}

/* Während der Öffnungsanimation Tilt-Effekt deaktivieren, um Interferenzen zu vermeiden */
.door.opening.tilt,
.door.opening.tilt:hover {
    transform: none;
}

/* Links in den Türchen ohne Unterstreichung */
.door a {
    text-decoration: none;
    display: block;
    height: 100%;
    width: 100%;
}

.door-content {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    background-image: url('../assets/images/door-bg.jpg');
    background-size: cover;
    background-position: center;
    position: relative;
    transform-origin: left center; /* Tür schwingt zur Seite auf */
    transform-style: preserve-3d; /* Für Box-Deckel-Effekt */
    backface-visibility: hidden; /* verhindert Flackern beim 3D-Rotieren */
    will-change: transform; /* Performance-Hinweis für Animation */
}

.door-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #000000;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    font-family: 'Rouge Script', cursive;
}

/* Öffnungsanimation: Tür schwingt wie ein Paketdeckel auf */
@keyframes doorSwingOpen {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(-85deg); }
}

.calendar .door.open-anim {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6);
}

.calendar .door.open-anim .door-content {
    animation: doorSwingOpen 0.7s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

/* Alternative: Box öffnet sich (Deckel klappt nach oben) */
.calendar .door.open-box {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6);
}

.calendar .door.open-box .door-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 55%;
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 2px solid var(--christmas-gold);
    transform-origin: top center;
    transform: rotateX(0deg);
    will-change: transform, opacity;
    animation: lidOpen 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes lidOpen {
    0% { transform: rotateX(0deg); opacity: 1; }
    100% { transform: rotateX(-100deg); opacity: 0; }
}

.calendar .door.open-box .door-content {
    animation: boxOpenContent 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes boxOpenContent {
    0% { transform: translateZ(0) scale(1); }
    100% { transform: translateZ(12px) scale(1.02); }
}

.lock-icon {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 1.5rem;
}

.door.locked {
    opacity: 0.8;
    filter: grayscale(50%);
}

/* Gift Box Visuals inside calendar tiles */
.gift-box {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 65%;
    height: 65%;
    display: block;
    pointer-events: none; /* clicks handled by the link */
}

.gift-box .box-base {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 65%;
    background: linear-gradient(180deg, #cf2b2b 0%, #b32020 100%);
    border-radius: 8px;
    border: 2px solid rgba(0,0,0,0.15);
    box-shadow: 0 8px 14px rgba(0,0,0,0.18), inset 0 2px 4px rgba(255,255,255,0.18);
    transition: transform 220ms ease-out;
}

.gift-box .box-lid {
    position: absolute;
    left: 0;
    bottom: calc(65% - 1px);
    width: 100%;
    height: 40%;
    background: linear-gradient(180deg, #e74c3c 0%, #d4332a 100%);
    border-radius: 8px 8px 5px 5px;
    border: 2px solid rgba(0,0,0,0.15);
    transform-origin: center bottom;
    transform: rotateX(0deg);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    will-change: transform;
    transition: transform 220ms ease-out;
}

.gift-box .ribbon-vertical {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    width: 12%;
    height: 100%;
    background: linear-gradient(180deg, #ffd54f 0%, #fbc02d 100%);
    border-radius: 6px;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.6);
}

.gift-box .ribbon-horizontal {
    position: absolute;
    left: 0;
    width: 100%;
    height: 12%;
    top: calc(65% - 6%);
    background: linear-gradient(180deg, #ffd54f 0%, #fbc02d 100%);
    border-radius: 6px;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.6);
}

/* Keep day numbers clearly visible above the box */
.door-content .door-number {
    position: relative;
    z-index: 3;
    text-shadow: 0 2px 4px rgba(0,0,0,0.35);
}

/* Subtle idle hover: lid teases open, base lifts slightly */
.door.openable:hover .gift-box .box-lid {
    transform: rotateX(-16deg);
}
.door.openable:hover .gift-box .box-base {
    transform: translateY(-2px);
}

/* Native CSS Gift Box Opening Animation */
.door.opening .gift-box .box-lid {
    animation: giftBoxLidOpen 1.2s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.door.opening .gift-box .box-base {
    animation: giftBoxBaseRise 1.2s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes giftBoxLidOpen {
    0% { 
        transform: rotateX(0deg);
        box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    }
    30% {
        transform: rotateX(-25deg);
        box-shadow: 0 6px 12px rgba(0,0,0,0.25);
    }
    100% { 
        transform: rotateX(-120deg);
        box-shadow: 0 15px 25px rgba(0,0,0,0.3);
        opacity: 0.8;
    }
}

@keyframes giftBoxBaseRise {
    0% { 
        transform: translateY(0px) scale(1);
    }
    30% {
        transform: translateY(-2px) scale(1.02);
    }
    100% { 
        transform: translateY(-8px) scale(1.05);
        box-shadow: 0 12px 20px rgba(0,0,0,0.25), inset 0 2px 4px rgba(255,255,255,0.2);
    }
}

/* Inhalt eines geöffneten Türchens */
.door-content {
    background-color: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.door-content h2 {
    color: var(--christmas-gold);
    margin-bottom: 20px;
    font-size: 2rem;
    text-align: center;
    width: 100%;
    font-family: 'Rouge Script', cursive;
}

.door-content img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 3px rgba(212, 175, 55, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 2px solid var(--christmas-gold);
    transition: all 0.4s ease;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.1));
    backdrop-filter: blur(5px);
}

.door-content img:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 0 0 4px rgba(212, 175, 55, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: #fff2a8;
}

.door-content video {
    width: 100%;
    max-height: 500px;
    border-radius: 5px;
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.pdf-container {
    margin-bottom: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.door-content p {
    text-align: center;
    margin-bottom: 20px;
    max-width: 800px;
    line-height: 1.6;
    font-family: 'Rouge Script', cursive;
    font-size: 1.4rem;
}

.download-btn {
    display: inline-block;
    background-color: var(--christmas-red);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    margin-top: 10px;
    transition: background-color 0.3s ease;
}

.download-btn:hover {
    background-color: #a01c23;
}

.door-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.back-btn, .home-btn {
    display: inline-block;
    background-color: var(--christmas-green);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.3s ease;
    font-family: 'Rouge Script', cursive;
    font-size: 1.3rem;
}

.back-btn:hover, .home-btn:hover {
    background-color: #0a3b24;
}

footer {
    text-align: center;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    margin-top: 30px;
    border-top: 2px solid var(--christmas-gold);
}

/* Weihnachtliche Dekorationen */
.container::before {
    content: '🎄';
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 3rem;
}

.container::after {
    content: '🎅';
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 3rem;
}
/* Audio Toggle Styles entfernt */

/* Footer Copy Animation */
.footer-copy {
    font-weight: bold;
    background: linear-gradient(90deg, #d4af37, #fff2a8, #d4af37);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shine 3s linear infinite;
    font-family: 'Rouge Script', cursive;
    font-size: 1.6rem;
}

@keyframes shine {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}