/* =====================================================
   ADVENT CALENDAR PRO - Frontend CSS
   ===================================================== */

: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, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Grille des portes */
.advent-grid {
    display: grid;
    gap: var(--acp-gap);
    margin: 0 auto;
}

.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 individuelle */
.advent-door {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--acp-border-radius);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.advent-door-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

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

.advent-door-locked .advent-door-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.advent-door-lock {
    font-size: 48px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Porte active (cliquable) */
.advent-door-active {
    cursor: pointer;
}

.advent-door-active:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 16px rgba(196, 30, 58, 0.3);
}

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

@keyframes pulse {
    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);
    }
}

/* Placeholder pour porte sans image */
.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: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s 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.4s ease;
    z-index: 1;
}

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

.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;
}

/* Image du lot */
.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;
}

/* Infos du lot */
.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-description p {
    margin: 0 0 12px 0;
}

.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;
    font-weight: 600;
}

.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;
    box-shadow: 0 4px 8px rgba(212, 175, 55, 0.3);
}

.advent-prize-winner strong {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    opacity: 0.8;
}

/* Effet flocons de neige */
.advent-calendar[data-snow="true"] {
    position: relative;
}

.advent-snowflake {
    position: fixed;
    top: -50px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.8;
    animation: snowfall linear infinite;
}

@keyframes snowfall {
    0% {
        transform: translateY(-50px) rotate(0deg);
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
    }
}

/* 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;
    }
    
    .advent-prize-title {
        font-size: 22px;
    }
    
    .advent-door-number {
        font-size: 48px;
    }
}

@media screen and (max-width: 480px) {
    :root {
        --acp-door-size: 100px;
        --acp-gap: 8px;
    }
    
    .advent-door-lock {
        font-size: 32px;
    }
    
    .advent-prize-title {
        font-size: 20px;
    }
    
    .advent-prize-description {
        font-size: 14px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .advent-modal-content {
        background: #1a1a1a;
    }
    
    .advent-prize-info {
        color: #e0e0e0;
    }
    
    .advent-prize-title {
        color: #ff6b6b;
    }
    
    .advent-prize-description {
        color: #e0e0e0;
    }
}

/* Animations d'ouverture de porte */
.advent-door-opening {
    animation: doorOpen 0.6s ease-out;
}

@keyframes doorOpen {
    0% {
        transform: scale(1) rotateY(0deg);
    }
    50% {
        transform: scale(1.1) rotateY(90deg);
    }
    100% {
        transform: scale(1) rotateY(0deg);
    }
}

/* Loading spinner */
.advent-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.advent-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--acp-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibilité */
.advent-door:focus {
    outline: 3px solid var(--acp-gold);
    outline-offset: 2px;
}

.advent-modal-close:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .advent-modal,
    .advent-snowflake {
        display: none !important;
    }
}
