/**
 * Step 5 Premium CSS
 * Animations et effets pour le récapitulatif mobile
 * Compatible avec Tailwind CSS
 */

/* ========================================
   ANIMATIONS
   ======================================== */

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

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.animate-slide-up {
    animation: slideUp 0.4s ease-out both;
}

/* ========================================
   SUMMARY CARDS - AMÉLIORATIONS
   ======================================== */

.premium-card {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-card:hover {
    transform: translateY(-2px);
}

.premium-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 0.75rem 0.75rem 0 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.premium-card:hover::before {
    opacity: 1;
}

/* ========================================
   STICKY FOOTER - AMÉLIORATIONS
   ======================================== */

.sticky-footer {
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1), 0 -2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Fallback pour navigateurs sans support backdrop-filter */
@supports not (backdrop-filter: blur(8px)) {
    .sticky-footer {
        background-color: rgba(255, 255, 255, 0.95);
    }
}

/* ========================================
   BOUTON CTA - EFFETS PREMIUM
   ======================================== */

.btn-cta {
    position: relative;
    overflow: hidden;
    transform-origin: center;
}

.btn-cta::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-cta:hover::before {
    width: 300px;
    height: 300px;
}

.btn-cta:active {
    transform: scale(0.95);
}

/* État désactivé */
.btn-cta:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-cta:disabled:hover {
    transform: none;
}

/* ========================================
   EDIT LINKS - AMÉLIORATIONS
   ======================================== */

.edit-link {
    transition: all 0.2s ease;
}

.edit-link:hover {
    transform: translateX(-2px);
}

.edit-link:active {
    transform: translateX(-4px);
}

/* ========================================
   ICON ANIMATIONS
   ======================================== */

.icon-service,
[class*="w-10 h-10 rounded-full"] {
    transition: all 0.3s ease;
}

.premium-card:hover .icon-service,
.premium-card:hover [class*="w-10 h-10 rounded-full"] {
    transform: scale(1.1) rotate(5deg);
}

/* ========================================
   RESPONSIVE IMPROVEMENTS
   ======================================== */

/* Mobile optimizations */
@media (max-width: 640px) {
    .sticky-footer {
        padding: 0.75rem;
    }
    
    .footer-content {
        gap: 0.75rem;
    }
    
    .total-amount {
        font-size: 1.5rem;
    }
    
    .btn-cta {
        padding: 0.875rem 1.5rem;
        font-size: 0.9375rem;
    }
}

/* Tablet optimizations */
@media (min-width: 641px) and (max-width: 1023px) {
    .sticky-footer {
        padding: 1rem 1.5rem;
    }
}

/* Desktop optimizations */
@media (min-width: 1024px) {
    .premium-card {
        transition: all 0.3s ease, box-shadow 0.3s ease;
    }
    
    .premium-card:hover {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    }
}

/* ========================================
   SAFE AREA INSETS (iPhone notch support)
   ======================================== */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .sticky-footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .sticky-footer,
    .edit-link,
    #otpValidationSection {
        display: none !important;
    }
    
    .premium-card {
        box-shadow: none !important;
        border: 1px solid #e5e7eb;
        page-break-inside: avoid;
    }
    
    .animate-slide-up,
    .animate-fade-in {
        animation: none !important;
    }
}

/* ========================================
   DARK MODE SUPPORT (optionnel)
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* Activé uniquement si le système est en dark mode */
    /* Pour l'instant, on garde le light mode pour la cohérence */
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* Focus visible pour navigation clavier */
.edit-link:focus-visible,
.btn-cta:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Réduction du mouvement pour utilisateurs sensibles */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .premium-card:hover {
        transform: none;
    }
    
    .btn-cta:active {
        transform: none;
    }
}

/* ========================================
   LOADING STATE
   ======================================== */

.btn-cta.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-cta.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   SCROLL BEHAVIOR
   ======================================== */

/* Smooth scroll pour la navigation */
html {
    scroll-behavior: smooth;
}

/* Compensation pour le sticky footer */
.step-panel[data-step="5"] {
    scroll-padding-bottom: 160px;
}

/* ========================================
   CODE PROMO - ENCADRÉ AVEC BOUTON VALIDER
   ======================================== */

.promo-code-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #e2e8f0;
}

.promo-code-card:hover {
    border-color: var(--brand-light, #4a7ae6);
}

.promo-code-encadre {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.promo-code-encadre:focus-within {
    border-color: var(--brand, #2859CC);
    background: #fff;
    border-style: solid;
}

.promo-code-input {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    letter-spacing: 0.08em;
}

.promo-code-input::placeholder {
    color: #94a3b8;
}

.promo-validate-btn {
    flex-shrink: 0;
    min-width: 120px;
}

.promo-validate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.promo-success-badge {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.promo-remove-btn {
    border-radius: 8px;
}

/* Ligne réduction bien visible dans le résumé paiement */
#discountRow {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    margin: 0.25rem 0;
}

#promoMessage[style*="display: block"] {
    animation: promoShake 0.4s ease;
}

@keyframes promoShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
