/* ADVENT CALENDAR PRO V3 - Frontend CSS avec Animation Porte */

:root {
    --acp-primary: #c41e3a;
    --acp-secondary: #165b33;
    --acp-gold: #d4af37;
    --acp-door-size: 180px;
    --acp-gap: 15px;
    --acp-modal-width: 900px;
    --acp-border-radius: 8px;
}

/* Container principal */
.advent-calendar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Bannière mode test */
.acp-test-mode-banner {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: var(--acp-border-radius);
    padding: 15px 20px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    color: #856404;
}

/* Grille */
.advent-grid {
    display: grid;
    gap: var(--acp-gap);
    margin: 0 auto;
    perspective: 1000px; /* Perspective 3D pour toute la grille */
}

.advent-grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.advent-grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.advent-grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.advent-grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.advent-grid-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* Porte - Container avec perspective */
.advent-door {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--acp-border-radius);
    overflow: visible; /* Important pour la 3D */
    transform-style: preserve-3d;
    perspective: 1000px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.advent-door:hover {
    transform: scale(1.02);
}

/* Contenu de la porte */
.advent-door-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform-origin: left center; /* Pivot sur le bord gauche */
    transition: transform 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: var(--acp-border-radius);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Animation d'ouverture de la porte */
.advent-door.opening .advent-door-inner {
    transform: rotateY(-110deg); /* Porte qui s'ouvre vers la droite */
    opacity: 0.3;
}

.advent-door-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    backface-visibility: hidden; /* Cache la face arrière */
}

/* Porte verrouillée - OPACITÉ */
.advent-door-locked {
    opacity: 0.4;
    filter: grayscale(70%);
    cursor: not-allowed;
}

.advent-door-locked:hover {
    transform: none;
}

/* Porte active */
.advent-door-active {
    cursor: pointer;
    opacity: 1;
}

/* Porte du jour */
.advent-door-today .advent-door-inner {
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 8px 20px rgba(212, 175, 55, 0.5), 0 0 30px rgba(212, 175, 55, 0.3);
    }
}

/* Placeholder */
.advent-door-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--acp-primary), var(--acp-secondary));
    color: white;
}

.advent-door-number {
    font-size: 72px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Modal */
.advent-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none; /* Caché par défaut */
    align-items: center;
    justify-content: center;
}

.advent-modal.show {
    display: flex;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.advent-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.advent-modal-content {
    position: relative;
    width: 90%;
    max-width: var(--acp-modal-width);
    max-height: 90vh;
    background: white;
    border-radius: var(--acp-border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: slideUp 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 1;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.advent-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.advent-modal-close:hover {
    background: var(--acp-primary);
    transform: rotate(90deg);
}

.advent-modal-body {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
}

.advent-prize-image {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    background: #f8f9fa;
}

.advent-prize-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.advent-prize-info {
    padding: 30px;
}

.advent-prize-title {
    margin: 0 0 20px 0;
    font-size: 28px;
    color: var(--acp-primary);
    font-weight: bold;
}

.advent-prize-description {
    margin: 0 0 20px 0;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
}

.advent-prize-brand {
    margin: 0 0 15px 0;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--acp-secondary), #1a7a4a);
    color: white;
    border-radius: var(--acp-border-radius);
    font-size: 14px;
}

.advent-prize-brand strong {
    font-size: 18px;
}

.advent-prize-winner {
    margin: 0;
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--acp-gold), #f4d03f);
    color: #333;
    border-radius: var(--acp-border-radius);
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

/* Flocons de neige - EN ARRIÈRE-PLAN */
#acp-snow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.acp-snowflake {
    position: absolute;
    top: -50px;
    pointer-events: none;
    will-change: transform, opacity;
}

.acp-snowflake.size-small {
    width: 15px;
    height: 15px;
    opacity: 0.6;
}

.acp-snowflake.size-medium {
    width: 25px;
    height: 25px;
    opacity: 0.8;
}

.acp-snowflake.size-large {
    width: 35px;
    height: 35px;
    opacity: 1;
}

.acp-snowflake.blur-near {
    filter: blur(0px);
    z-index: 3;
}

.acp-snowflake.blur-mid {
    filter: blur(1px);
    z-index: 2;
}

.acp-snowflake.blur-far {
    filter: blur(2px);
    z-index: 1;
}

.acp-snowflake img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes snowfall {
    0% {
        transform: translateY(-50px) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) translateX(var(--drift)) rotate(360deg);
        opacity: 0;
    }
}

/* Responsive */
@media screen and (max-width: 1024px) {
    :root {
        --acp-door-size: 150px;
        --acp-gap: 12px;
    }
    
    .advent-grid-cols-4,
    .advent-grid-cols-5,
    .advent-grid-cols-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 768px) {
    :root {
        --acp-door-size: 120px;
        --acp-gap: 10px;
    }
    
    .advent-calendar {
        padding: 15px;
    }
    
    .advent-grid-cols-3,
    .advent-grid-cols-4,
    .advent-grid-cols-5,
    .advent-grid-cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .advent-modal-content {
        width: 95%;
    }
    
    .advent-prize-info {
        padding: 20px;
    }
}
