/**
 * Meal Counter - Flip Card Styles
 * Plusieurs styles disponibles - Sans background
 */

/* ========================================
   BASE STYLES
   ======================================== */

.meal-counter-wrapper {
    --counter-primary: #1a1a2e;
    --counter-text: #ffffff;
    --counter-accent: #e94560;
    --counter-shadow: rgba(0, 0, 0, 0.3);
    --flip-duration: 0.5s;
    
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
    z-index: 10;
}

.meal-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    perspective: 1000px;
}

/* Séparateur de milliers */
.digit-separator {
    width: 8px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.digit-separator::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--counter-primary);
    border-radius: 50%;
    opacity: 0.6;
}

/* Carte flip individuelle */
.flip-card {
    position: relative;
    width: 52px;
    height: 76px;
    perspective: 1000px;
}

/* Chiffre */
.digit {
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
    font-size: 48px;
    font-weight: 700;
    color: var(--counter-text);
    line-height: 1;
}

/* Top et Bottom cards */
.card-top,
.card-bottom {
    position: absolute;
    left: 0;
    right: 0;
    height: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--counter-primary);
}

.card-top {
    top: 0;
    border-radius: 8px 8px 0 0;
    align-items: flex-end;
}

.card-top .digit {
    transform: translateY(50%);
}

.card-bottom {
    bottom: 0;
    border-radius: 0 0 8px 8px;
    align-items: flex-start;
    box-shadow: 0 4px 15px var(--counter-shadow);
}

.card-bottom .digit {
    transform: translateY(-50%);
}

/* Ligne centrale */
.flip-card::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    top: 50%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 5;
}

/* Animation de flip */
@keyframes flipTop {
    0% { transform: rotateX(0deg); }
    100% { transform: rotateX(-90deg); }
}

@keyframes flipBottom {
    0% { transform: rotateX(90deg); }
    100% { transform: rotateX(0deg); }
}

.flip-card.flip-animate .card-top {
    animation: flipTop 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    transform-origin: bottom center;
}

.flip-card.flip-animate .card-bottom {
    animation: flipBottom 0.25s cubic-bezier(0.4, 0, 0.2, 1) 0.25s forwards;
    transform-origin: top center;
}


/* ========================================
   STYLE 1: CLASSIC (Noir élégant)
   ======================================== */

.meal-counter-wrapper[data-style="classic"] {
    --counter-primary: #1a1a2e;
    --counter-text: #ffffff;
}

.meal-counter-wrapper[data-style="classic"] .card-top {
    background: linear-gradient(180deg, #2d2d44 0%, #1a1a2e 100%);
}

.meal-counter-wrapper[data-style="classic"] .card-bottom {
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
}


/* ========================================
   STYLE 2: GOLD (Or luxueux)
   ======================================== */

.meal-counter-wrapper[data-style="gold"] {
    --counter-primary: #2c2c2c;
    --counter-text: #ffd700;
}

.meal-counter-wrapper[data-style="gold"] .digit {
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.meal-counter-wrapper[data-style="gold"] .card-top {
    background: linear-gradient(180deg, #3d3d3d 0%, #2c2c2c 100%);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-bottom: none;
}

.meal-counter-wrapper[data-style="gold"] .card-bottom {
    background: linear-gradient(180deg, #2c2c2c 0%, #1a1a1a 100%);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-top: none;
}

.meal-counter-wrapper[data-style="gold"] .digit-separator::before {
    background: #ffd700;
}


/* ========================================
   STYLE 3: NEON (Vert fluo)
   ======================================== */

.meal-counter-wrapper[data-style="neon"] {
    --counter-primary: #0a0a0a;
    --counter-text: #00ff88;
}

.meal-counter-wrapper[data-style="neon"] .digit {
    text-shadow: 
        0 0 10px #00ff88,
        0 0 20px #00ff88,
        0 0 40px rgba(0, 255, 136, 0.5);
}

.meal-counter-wrapper[data-style="neon"] .card-top,
.meal-counter-wrapper[data-style="neon"] .card-bottom {
    background: #0a0a0a;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.meal-counter-wrapper[data-style="neon"] .card-top {
    border-bottom: none;
}

.meal-counter-wrapper[data-style="neon"] .card-bottom {
    border-top: none;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.2);
}

.meal-counter-wrapper[data-style="neon"] .digit-separator::before {
    background: #00ff88;
    box-shadow: 0 0 10px #00ff88;
}


/* ========================================
   STYLE 4: RETRO (Orange vintage)
   ======================================== */

.meal-counter-wrapper[data-style="retro"] {
    --counter-primary: #1a1a1a;
    --counter-text: #ff6b35;
}

.meal-counter-wrapper[data-style="retro"] .flip-card {
    border-radius: 4px;
}

.meal-counter-wrapper[data-style="retro"] .card-top {
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
    border-radius: 4px 4px 0 0;
}

.meal-counter-wrapper[data-style="retro"] .card-bottom {
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
    border-radius: 0 0 4px 4px;
}

.meal-counter-wrapper[data-style="retro"] .digit {
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}

.meal-counter-wrapper[data-style="retro"] .digit-separator::before {
    background: #ff6b35;
}


/* ========================================
   STYLE 5: MINIMAL (Blanc épuré)
   ======================================== */

.meal-counter-wrapper[data-style="minimal"] {
    --counter-primary: #ffffff;
    --counter-text: #1a1a1a;
    --counter-shadow: rgba(0, 0, 0, 0.1);
}

.meal-counter-wrapper[data-style="minimal"] .card-top {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-bottom: none;
}

.meal-counter-wrapper[data-style="minimal"] .card-bottom {
    background: #f8f8f8;
    border: 2px solid #e0e0e0;
    border-top: none;
}

.meal-counter-wrapper[data-style="minimal"]::after {
    background: #e0e0e0;
}

.meal-counter-wrapper[data-style="minimal"] .digit-separator::before {
    background: #1a1a1a;
}


/* ========================================
   STYLE 6: OCEAN (Bleu profond)
   ======================================== */

.meal-counter-wrapper[data-style="ocean"] {
    --counter-primary: #0c2461;
    --counter-text: #4fc3f7;
}

.meal-counter-wrapper[data-style="ocean"] .card-top {
    background: linear-gradient(180deg, #1e3799 0%, #0c2461 100%);
}

.meal-counter-wrapper[data-style="ocean"] .card-bottom {
    background: linear-gradient(180deg, #0c2461 0%, #061230 100%);
    box-shadow: 0 4px 20px rgba(79, 195, 247, 0.2);
}

.meal-counter-wrapper[data-style="ocean"] .digit {
    text-shadow: 0 0 15px rgba(79, 195, 247, 0.6);
}

.meal-counter-wrapper[data-style="ocean"] .digit-separator::before {
    background: #4fc3f7;
}


/* ========================================
   STYLE 7: CRIMSON (Rouge intense)
   ======================================== */

.meal-counter-wrapper[data-style="crimson"] {
    --counter-primary: #1a0a0a;
    --counter-text: #ff4757;
}

.meal-counter-wrapper[data-style="crimson"] .card-top {
    background: linear-gradient(180deg, #2d1515 0%, #1a0a0a 100%);
    border: 1px solid rgba(255, 71, 87, 0.2);
    border-bottom: none;
}

.meal-counter-wrapper[data-style="crimson"] .card-bottom {
    background: linear-gradient(180deg, #1a0a0a 0%, #0d0505 100%);
    border: 1px solid rgba(255, 71, 87, 0.2);
    border-top: none;
}

.meal-counter-wrapper[data-style="crimson"] .digit {
    text-shadow: 0 0 20px rgba(255, 71, 87, 0.5);
}

.meal-counter-wrapper[data-style="crimson"] .digit-separator::before {
    background: #ff4757;
}


/* ========================================
   STYLE 8: MATRIX (Vert hacker)
   ======================================== */

.meal-counter-wrapper[data-style="matrix"] {
    --counter-primary: #000000;
    --counter-text: #00ff00;
}

.meal-counter-wrapper[data-style="matrix"] .card-top,
.meal-counter-wrapper[data-style="matrix"] .card-bottom {
    background: #000000;
    border: 1px solid #003300;
}

.meal-counter-wrapper[data-style="matrix"] .card-top {
    border-bottom: none;
}

.meal-counter-wrapper[data-style="matrix"] .card-bottom {
    border-top: none;
}

.meal-counter-wrapper[data-style="matrix"] .digit {
    font-family: 'Courier New', monospace;
    text-shadow: 
        0 0 5px #00ff00,
        0 0 10px #00ff00;
    animation: matrixFlicker 3s infinite;
}

@keyframes matrixFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.95; }
    52% { opacity: 1; }
}

.meal-counter-wrapper[data-style="matrix"] .digit-separator::before {
    background: #00ff00;
    box-shadow: 0 0 5px #00ff00;
}


/* ========================================
   TAILLES
   ======================================== */

/* Small */
.meal-counter-wrapper[data-size="small"] .flip-card {
    width: 36px;
    height: 52px;
}

.meal-counter-wrapper[data-size="small"] .digit {
    font-size: 32px;
}

.meal-counter-wrapper[data-size="small"] .meal-counter {
    gap: 4px;
}

.meal-counter-wrapper[data-size="small"] .digit-separator {
    width: 5px;
}

.meal-counter-wrapper[data-size="small"] .digit-separator::before {
    width: 4px;
    height: 4px;
}

/* Large */
.meal-counter-wrapper[data-size="large"] .flip-card {
    width: 70px;
    height: 100px;
}

.meal-counter-wrapper[data-size="large"] .digit {
    font-size: 64px;
}

.meal-counter-wrapper[data-size="large"] .meal-counter {
    gap: 8px;
}

.meal-counter-wrapper[data-size="large"] .digit-separator {
    width: 12px;
}

.meal-counter-wrapper[data-size="large"] .digit-separator::before {
    width: 8px;
    height: 8px;
}

/* XLarge */
.meal-counter-wrapper[data-size="xlarge"] .flip-card {
    width: 90px;
    height: 130px;
}

.meal-counter-wrapper[data-size="xlarge"] .digit {
    font-size: 84px;
}

.meal-counter-wrapper[data-size="xlarge"] .meal-counter {
    gap: 10px;
}

.meal-counter-wrapper[data-size="xlarge"] .digit-separator {
    width: 15px;
}

.meal-counter-wrapper[data-size="xlarge"] .digit-separator::before {
    width: 10px;
    height: 10px;
}

/* XXLarge */
.meal-counter-wrapper[data-size="xxlarge"] .flip-card {
    width: 140px;
    height: 200px;
}

.meal-counter-wrapper[data-size="xxlarge"] .digit {
    font-size: 130px;
}

.meal-counter-wrapper[data-size="xxlarge"] .meal-counter {
    gap: 14px;
}

.meal-counter-wrapper[data-size="xxlarge"] .digit-separator {
    width: 24px;
}

.meal-counter-wrapper[data-size="xxlarge"] .digit-separator::before {
    width: 16px;
    height: 16px;
}

.meal-counter-wrapper[data-size="xxlarge"] .card-top,
.meal-counter-wrapper[data-size="xxlarge"] .card-bottom {
    border-radius: 14px;
}

.meal-counter-wrapper[data-size="xxlarge"] .card-top {
    border-radius: 14px 14px 0 0;
}

.meal-counter-wrapper[data-size="xxlarge"] .card-bottom {
    border-radius: 0 0 14px 14px;
}


/* ========================================
   RESPONSIVE - Utilise des unités relatives
   ======================================== */

.meal-counter-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
    padding: 0 10px;
}

.meal-counter-wrapper {
    flex-shrink: 1;
    max-width: 100%;
}

.meal-counter {
    flex-wrap: nowrap;
}

/* ===== RESPONSIVE MOBILE ===== */

/* Tablette */
@media (max-width: 900px) {
    .meal-counter-wrapper[data-size="xxlarge"] .flip-card {
        width: 11vw;
        height: 15.5vw;
    }
    .meal-counter-wrapper[data-size="xxlarge"] .digit {
        font-size: 10vw;
    }
    .meal-counter-wrapper[data-size="xxlarge"] .meal-counter {
        gap: 1vw;
    }
    .meal-counter-wrapper[data-size="xxlarge"] .digit-separator {
        width: 1.5vw;
    }
    
    .meal-counter-wrapper[data-size="xlarge"] .flip-card {
        width: 10vw;
        height: 14vw;
    }
    .meal-counter-wrapper[data-size="xlarge"] .digit {
        font-size: 9vw;
    }
    .meal-counter-wrapper[data-size="xlarge"] .meal-counter {
        gap: 0.8vw;
    }
    
    .meal-counter-wrapper[data-size="large"] .flip-card {
        width: 9vw;
        height: 12.5vw;
    }
    .meal-counter-wrapper[data-size="large"] .digit {
        font-size: 8vw;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .meal-counter-wrapper[data-size="xxlarge"] .flip-card,
    .meal-counter-wrapper[data-size="xlarge"] .flip-card,
    .meal-counter-wrapper[data-size="large"] .flip-card {
        width: 11vw;
        height: 15vw;
    }
    .meal-counter-wrapper[data-size="xxlarge"] .digit,
    .meal-counter-wrapper[data-size="xlarge"] .digit,
    .meal-counter-wrapper[data-size="large"] .digit {
        font-size: 9.5vw;
    }
    .meal-counter-wrapper[data-size="xxlarge"] .meal-counter,
    .meal-counter-wrapper[data-size="xlarge"] .meal-counter,
    .meal-counter-wrapper[data-size="large"] .meal-counter {
        gap: 1vw;
    }
    .meal-counter-wrapper[data-size="xxlarge"] .digit-separator,
    .meal-counter-wrapper[data-size="xlarge"] .digit-separator,
    .meal-counter-wrapper[data-size="large"] .digit-separator {
        width: 1.2vw;
    }
    .meal-counter-wrapper[data-size="xxlarge"] .digit-separator::before,
    .meal-counter-wrapper[data-size="xlarge"] .digit-separator::before,
    .meal-counter-wrapper[data-size="large"] .digit-separator::before {
        width: 1vw;
        height: 1vw;
    }
    
    .meal-counter-wrapper[data-size="medium"] .flip-card {
        width: 10vw;
        height: 14vw;
    }
    .meal-counter-wrapper[data-size="medium"] .digit {
        font-size: 8.5vw;
    }
    .meal-counter-wrapper[data-size="medium"] .meal-counter {
        gap: 0.8vw;
    }
    .meal-counter-wrapper[data-size="medium"] .digit-separator {
        width: 1vw;
    }
    
    .meal-counter-wrapper[data-size="small"] .flip-card {
        width: 9vw;
        height: 12vw;
    }
    .meal-counter-wrapper[data-size="small"] .digit {
        font-size: 7.5vw;
    }
    
    .meal-counter-wrapper .card-top,
    .meal-counter-wrapper .card-bottom {
        border-radius: 1vw;
    }
    .meal-counter-wrapper .card-top {
        border-radius: 1vw 1vw 0 0;
    }
    .meal-counter-wrapper .card-bottom {
        border-radius: 0 0 1vw 1vw;
    }
    
    .meal-counter-label {
        font-size: 3.5vw !important;
    }
}

/* Très petit mobile */
@media (max-width: 400px) {
    .meal-counter-wrapper .flip-card {
        width: 12vw !important;
        height: 16vw !important;
    }
    .meal-counter-wrapper .digit {
        font-size: 10vw !important;
    }
    .meal-counter-wrapper .meal-counter {
        gap: 0.8vw !important;
    }
    .meal-counter-wrapper .digit-separator {
        width: 1vw !important;
    }
    .meal-counter-wrapper .digit-separator::before {
        width: 1vw !important;
        height: 1vw !important;
    }
    
    .meal-counter-label {
        font-size: 4vw !important;
    }
}


/* ========================================
   LABEL (TEXTE SOUS LE COMPTEUR)
   ======================================== */

.meal-counter-label {
    margin-top: 15px;
    font-family: inherit; /* Utilise la police du thème WordPress */
    font-weight: 500;
    color: inherit;
    text-align: center;
    line-height: 1.4;
}


/* ========================================
   ANIMATION D'ENTRÉE
   ======================================== */

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

.flip-card {
    animation: slideInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.flip-card:nth-child(1) { animation-delay: 0.05s; }
.flip-card:nth-child(2) { animation-delay: 0.1s; }
.flip-card:nth-child(3) { animation-delay: 0.15s; }
.flip-card:nth-child(4) { animation-delay: 0.2s; }
.flip-card:nth-child(5) { animation-delay: 0.25s; }
.flip-card:nth-child(6) { animation-delay: 0.3s; }
.flip-card:nth-child(7) { animation-delay: 0.35s; }
.flip-card:nth-child(8) { animation-delay: 0.4s; }
.flip-card:nth-child(9) { animation-delay: 0.45s; }
.flip-card:nth-child(10) { animation-delay: 0.5s; }
