/* IMH Adventskalender Frontend Styles */

.imh-advent-calendar {
    position: relative;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 25%, #0f172a 50%, #1e1a3a 75%, #0f172a 100%);
    background-size: 400% 400%;
    animation: imhGradientShift 15s ease infinite;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    overflow: hidden;
}

@keyframes imhGradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Stars */
.imh-stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.imh-star {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #fff;
    border-radius: 50%;
    animation: imhTwinkle 2s infinite ease-in-out;
}

@keyframes imhTwinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Snowflakes */
.imh-snowflakes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.imh-snowflake {
    position: absolute;
    top: -10px;
    color: #fff;
    font-size: 1rem;
    opacity: 0.8;
    animation: imhFall linear infinite;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

@keyframes imhFall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0.3;
    }
}

/* Calendar Container */
.imh-calendar-container {
    position: relative;
    z-index: 10;
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px;
    background: linear-gradient(145deg, 
        rgba(153, 27, 27, 0.9) 0%, 
        rgba(127, 29, 29, 0.95) 50%, 
        rgba(100, 20, 20, 0.9) 100%);
    border: 3px solid #fbbf24;
    border-radius: 20px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(251, 191, 36, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Decorations */
.imh-decoration-top {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.imh-ornament {
    position: absolute;
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    animation: imhSwing 3s ease-in-out infinite;
}

@keyframes imhSwing {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

/* Header */
.imh-header-section {
    text-align: center;
    margin-bottom: 30px;
}

.imh-calendar-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fef3c7 0%, #fbbf24 25%, #f59e0b 50%, #fbbf24 75%, #fef3c7 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: imhShimmer 3s linear infinite;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

@keyframes imhShimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.imh-subtitle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(254, 243, 199, 0.8);
    font-size: 0.9rem;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 3px;
}

/* Message Box */
.imh-message-box {
    text-align: center;
    margin-bottom: 25px;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
}

.imh-message-box.imh-info {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.9), rgba(245, 158, 11, 0.9));
    color: #78350f;
}

.imh-message-box.imh-error {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.9), rgba(185, 28, 28, 0.9));
    color: #fef2f2;
}

.imh-message-box.imh-neutral {
    background: rgba(255, 255, 255, 0.1);
    color: #fef3c7;
}

.imh-hidden {
    display: none !important;
}

/* Door Grid */
.imh-door-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .imh-door-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .imh-calendar-container {
        padding: 25px 20px;
    }
    
    .imh-calendar-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .imh-door-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
}

/* Door Styling */
.imh-door {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.imh-door::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.2) 0%, 
        transparent 50%, 
        rgba(0, 0, 0, 0.1) 100%);
    pointer-events: none;
}

.imh-door-open {
    background: linear-gradient(145deg, #15803d 0%, #166534 50%, #14532d 100%);
    box-shadow: 
        0 4px 15px rgba(22, 101, 52, 0.4),
        0 0 20px rgba(34, 197, 94, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.imh-door-open:hover,
.imh-door-open:focus {
    transform: scale(1.08) translateY(-4px);
    box-shadow: 
        0 12px 30px rgba(22, 101, 52, 0.5),
        0 0 40px rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
    outline: none;
}

.imh-door-open:focus-visible {
    outline: 3px solid #fbbf24;
    outline-offset: 3px;
}

.imh-door-closed {
    background: linear-gradient(145deg, #7f1d1d 0%, #6b1c1c 50%, #5c1515 100%);
    filter: saturate(0.6);
    opacity: 0.7;
    cursor: not-allowed;
}

.imh-door-closed::after {
    content: attr(data-closed-text);
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.55rem;
    font-weight: 600;
    color: rgba(252, 165, 165, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.imh-door-christmas {
    background: linear-gradient(145deg, #b45309 0%, #92400e 50%, #78350f 100%) !important;
    border-color: #fbbf24 !important;
    animation: imhChristmasPulse 2s ease-in-out infinite;
}

@keyframes imhChristmasPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(251, 191, 36, 0.3); }
    50% { box-shadow: 0 0 30px rgba(251, 191, 36, 0.5); }
}

/* Already opened doors */
.imh-door-opened {
    background: linear-gradient(145deg, #065f46 0%, #064e3b 50%, #022c22 100%) !important;
    border-color: rgba(52, 211, 153, 0.5) !important;
    box-shadow: 
        0 4px 15px rgba(6, 95, 70, 0.4),
        inset 0 0 20px rgba(52, 211, 153, 0.1) !important;
}

.imh-door-opened .imh-door-number {
    opacity: 0.8;
}

.imh-door-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: imhCheckPop 0.3s ease-out;
}

@keyframes imhCheckPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.imh-door-opened.imh-door-christmas {
    background: linear-gradient(145deg, #92400e 0%, #78350f 50%, #451a03 100%) !important;
}

.imh-door-opened.imh-door-christmas .imh-door-check {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Confetti Animation */
.imh-confetti {
    position: fixed;
    top: -20px;
    pointer-events: none;
    z-index: 9998;
    animation: imhConfettiFall linear forwards;
    opacity: 0;
}

@keyframes imhConfettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    25% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

.imh-door-number {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

.imh-door-label {
    font-size: 0.55rem;
    font-weight: 500;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

@media (max-width: 768px) {
    .imh-door-number {
        font-size: 1.4rem;
    }
    
    .imh-door-label {
        font-size: 0.5rem;
    }
}

/* Footer */
.imh-calendar-footer {
    text-align: center;
    color: rgba(254, 243, 199, 0.6);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.imh-copyright {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(251, 191, 36, 0.2);
    text-align: center;
    color: rgba(254, 243, 199, 0.5);
    font-size: 0.75rem;
}

.imh-copyright a {
    color: rgba(251, 191, 36, 0.7);
    text-decoration: none;
    transition: color 0.2s;
}

.imh-copyright a:hover {
    color: #fbbf24;
    text-decoration: underline;
}

/* Modal */
.imh-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.imh-modal-content {
    background: #fff;
    border-radius: 20px;
    max-width: 900px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: imhModalSlideIn 0.3s ease-out;
}

@keyframes imhModalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.imh-modal-header {
    background: linear-gradient(135deg, #991b1b 0%, #7f1d1d 100%);
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.imh-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.imh-modal-icon {
    font-size: 1.8rem;
}

.imh-modal-title {
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

.imh-close-button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.imh-close-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.imh-modal-body {
    padding: 25px;
}

.imh-video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.imh-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.imh-fun-message {
    text-align: center;
    color: #64748b;
    margin: 20px 0 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .imh-modal-header {
        padding: 15px 20px;
    }
    
    .imh-modal-title {
        font-size: 1.1rem;
    }
    
    .imh-modal-body {
        padding: 15px;
    }
}

/* =============================================
   COUNTDOWN TIMER
   ============================================= */
#imh-countdown {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 100%);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 15px 25px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,0.2);
}

.imh-countdown-label {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
}

.imh-countdown-time {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--imh-accent, #fbbf24);
    background: rgba(0,0,0,0.3);
    padding: 8px 15px;
    border-radius: 8px;
    letter-spacing: 2px;
}

/* =============================================
   DARK MODE
   ============================================= */
.imh-dark-mode {
    --imh-text: #f1f5f9;
    --imh-bg-light: #1e293b;
    --imh-border: rgba(255,255,255,0.1);
}

.imh-dark-mode .imh-message-box {
    background: rgba(30, 41, 59, 0.9);
    color: #f1f5f9;
}

.imh-dark-mode .imh-door-closed {
    background: linear-gradient(145deg, #334155 0%, #1e293b 100%);
}

.imh-dark-mode .imh-door-closed::before {
    color: rgba(255,255,255,0.4);
}

.imh-dark-mode .imh-modal-content {
    background: #1e293b;
    color: #f1f5f9;
}

.imh-dark-mode .imh-modal-header {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border-color: rgba(255,255,255,0.1);
}

/* =============================================
   DOOR ANIMATIONS
   ============================================= */

/* Flip Animation */
.imh-anim-flip {
    animation: imhDoorFlip 0.6s ease-out forwards;
}

@keyframes imhDoorFlip {
    0% { transform: perspective(400px) rotateY(0deg); }
    50% { transform: perspective(400px) rotateY(-90deg); }
    100% { transform: perspective(400px) rotateY(-180deg); }
}

/* Slide Animation */
.imh-anim-slide {
    animation: imhDoorSlide 0.5s ease-out forwards;
}

@keyframes imhDoorSlide {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(-100%); opacity: 0; }
}

/* Zoom Animation */
.imh-anim-zoom {
    animation: imhDoorZoom 0.5s ease-out forwards;
}

@keyframes imhDoorZoom {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(0); opacity: 0; }
}

/* Bounce Animation */
.imh-anim-bounce {
    animation: imhDoorBounce 0.6s ease-out forwards;
}

@keyframes imhDoorBounce {
    0% { transform: scale(1); }
    20% { transform: scale(1.1); }
    40% { transform: scale(0.9); }
    60% { transform: scale(1.05); }
    80% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Door open click effect */
.imh-door-animate {
    pointer-events: none;
}

/* Animation presets on calendar */
.imh-animation-flip .imh-door-open:hover {
    transform: perspective(200px) rotateY(-5deg);
}

.imh-animation-slide .imh-door-open:hover {
    transform: translateX(-5px);
}

.imh-animation-zoom .imh-door-open:hover {
    transform: scale(1.08);
}

.imh-animation-bounce .imh-door-open:hover {
    animation: imhDoorBounceHover 0.4s ease;
}

@keyframes imhDoorBounceHover {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
