/**
 * Calendrier de l'Avent - Styles
 * Design élégant avec touches festives subtiles
 */

/* ===========================
   Variables
   =========================== */
:root {
    --ca-primary: #004aad;         /* Bleu JHM */
    --ca-secondary: #0066cc;       /* Bleu clair JHM */
    --ca-accent: #003d8f;          /* Bleu foncé JHM */
    --ca-snow: #f8f9fa;            /* Blanc neige */
    --ca-locked: #cbd5e0;          /* Gris pour cases verrouillées */
    --ca-shadow: rgba(0, 0, 0, 0.1);
    --ca-shadow-hover: rgba(0, 0, 0, 0.2);
}

/* ===========================
   Container Principal
   =========================== */
.calendrier-avent-main {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    position: relative;
    overflow: hidden;
}

.calendrier-avent-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(0, 74, 173, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 102, 204, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.calendrier-avent-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
    position: relative;
    z-index: 1;
}

/* ===========================
   Header
   =========================== */
.calendrier-avent-header {
    text-align: center;
    margin-bottom: 4rem;
    animation: fadeInDown 0.8s ease-out;
    position: relative;
}

.calendrier-avent-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--ca-primary);
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    line-height: 1.2;
}

.calendrier-avent-intro {
    font-size: 1.5rem;
    color: #4a5568;
    max-width: 700px;
    margin: 0 auto;
    font-weight: 500;
    line-height: 1.6;
}

/* ===========================
   Grille des Cases
   =========================== */
.calendrier-avent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    animation: fadeIn 1s ease-out 0.3s both;
}

@media (max-width: 768px) {
    .calendrier-avent-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
}

/* ===========================
   Case Individuelle
   =========================== */
.calendrier-avent-case {
    position: relative;
    aspect-ratio: 1;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.case-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.case-inner {
    position: relative;
    width: 100%;
    height: 100%;
    background: white;
    box-shadow: 0 4px 6px var(--ca-shadow);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* ===========================
   États des Cases
   =========================== */

/* Case disponible */
.calendrier-avent-case.is-available {
    /* Pas d'animation */
}

.calendrier-avent-case.is-available:hover {
    transform: translateY(-8px) scale(1.03);
}

.calendrier-avent-case.is-available:hover .case-inner {
    box-shadow:
        0 12px 24px var(--ca-shadow-hover),
        0 0 30px rgba(0, 74, 173, 0.3);
}

.calendrier-avent-case.is-available .case-inner {
    background: linear-gradient(135deg, var(--ca-primary) 0%, var(--ca-accent) 100%);
    color: white;
    cursor: pointer;
    border: 2px solid rgba(0, 102, 204, 0.2);
}

.calendrier-avent-case.is-available .case-inner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

/* Case future (verrouillée) - Style foncé */
.calendrier-avent-case.is-future .case-inner {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: #a0aec0;
    cursor: default;
    border: 2px solid #4a5568;
    position: relative;
    overflow: hidden;
}

.calendrier-avent-case.is-future .case-inner::before {
    content: '❄';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    opacity: 0.1;
    pointer-events: none;
    color: #fff;
}

.calendrier-avent-case.is-future .case-inner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 30%);
    pointer-events: none;
}

.calendrier-avent-case.is-future .case-link--disabled {
    cursor: default;
}

.calendrier-avent-case.is-future:hover {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

.calendrier-avent-case.is-future:hover .case-inner {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: #718096;
}

/* Masquer l'icône SVG centrale pour les cases futures */
.calendrier-avent-case.is-future .case-icon--locked {
    display: none;
}

/* ===========================
   Numéro de la Case
   =========================== */
.case-numero {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10;
}

.case-numero-text {
    display: inline-block;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    background: #fff;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.calendrier-avent-case.is-available .case-numero-text {
    background: linear-gradient(45deg, #fff 0%, rgba(255,255,255,0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.calendrier-avent-case.is-future .case-numero-text {
    color: #e2e8f0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background: none;
    font-weight: 700;
}

/* ===========================
   Icône d'État
   =========================== */
.case-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.case-icon {
    width: 64px;
    height: 64px;
    opacity: 0.3;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.calendrier-avent-case:hover .case-icon {
    opacity: 0.5;
    transform: scale(1.1);
}

.calendrier-avent-case.is-available .case-icon--gift {
    opacity: 0.8;
}

/* ===========================
   Image de la Case
   =========================== */
.case-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    z-index: 2;
}

.case-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 74, 173, 0.8) 0%, rgba(0, 61, 143, 0.9) 100%);
    transition: opacity 0.3s ease;
}

.calendrier-avent-case:hover .case-overlay {
    opacity: 0.7;
}

/* ===========================
   Contenu de la Case
   =========================== */
.case-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1rem 1rem;
    z-index: 10;
    background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 100%);
}

.case-date {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
    opacity: 0.9;
    text-align: center;
}

.calendrier-avent-case.is-future .case-date {
    font-size: 0.875rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.case-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* ===========================
   Particules (effet neige)
   =========================== */
.case-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 3;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    opacity: 0;
}

.calendrier-avent-case.is-available .particle {
    animation: snowfall 4s linear infinite;
}

.particle:nth-child(1) {
    left: 20%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    left: 50%;
    animation-delay: 1.5s;
}

.particle:nth-child(3) {
    left: 80%;
    animation-delay: 3s;
}

/* ===========================
   Animations
   =========================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

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

@keyframes snowfall {
    0% {
        top: -10%;
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        top: 110%;
        opacity: 0;
    }
}



/* ===========================
   État Vide
   =========================== */
.calendrier-avent-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #718096;
    font-size: 1.1rem;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 768px) {
    .calendrier-avent-container {
        padding: 2rem 1rem;
    }

    .calendrier-avent-title {
        font-size: 2.5rem;
    }

    .calendrier-avent-intro {
        font-size: 1.25rem;
    }

    .case-numero-text {
        font-size: 2rem;
    }

    .case-icon {
        width: 48px;
        height: 48px;
    }
}

/* ===========================
   Cases Photo - Bouton
   =========================== */
.case-link--photo {
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;
    cursor: pointer;
    outline: inherit;
}

/* ===========================
   Modal Photo
   =========================== */
.modal--photo-avent {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal--photo-avent.is-open {
    display: flex;
}

.modal--photo-avent .modal-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.modal--photo-avent .modal-card.photo-avent {
    position: relative;
    max-width: 800px;
    max-height: 80vh;
    background: transparent;
    border-radius: 12px;
    overflow: visible;
    z-index: 1;
}

.modal--photo-avent .modal-close {
    position: absolute;
    top: -15px;
    right: -15px;
    z-index: 10;
    background: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.modal--photo-avent .modal-close:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.modal--photo-avent .modal-close svg {
    width: 18px;
    height: 18px;
    stroke: #333;
    stroke-width: 2.5;
}

.modal-photo-header {
    position: absolute;
    top: -15px;
    left: -15px;
    z-index: 10;
}

.modal-photo-numero {
    display: inline-block;
    background: linear-gradient(135deg, var(--ca-primary, #004aad) 0%, var(--ca-accent, #003d8f) 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.modal-photo-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-photo-content img {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
    .modal--photo-avent {
        padding: 1.5rem;
    }

    .modal--photo-avent .modal-card.photo-avent {
        max-width: calc(100vw - 3rem);
        max-height: 75vh;
    }

    .modal--photo-avent .modal-close {
        width: 36px;
        height: 36px;
        top: -12px;
        right: -12px;
    }

    .modal--photo-avent .modal-close svg {
        width: 16px;
        height: 16px;
    }

    .modal-photo-header {
        top: -12px;
        left: -12px;
    }

    .modal-photo-numero {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .modal-photo-content img {
        max-height: 75vh;
        border-radius: 8px;
    }
}
