/**
 * Cart Steps - Panier multi-étapes moderne
 * L'Indien de Porquerolles
 */

/* ========================================
   MODAL PANIER PRO (#pro-cart-modal)
   ======================================== */
#pro-cart-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 32, 36, 0.85);
    backdrop-filter: blur(5px);
    z-index: 9999;
    overflow: hidden;
    display: none !important;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    visibility: hidden;
    pointer-events: none;
}

.pro-cart-modal-content {
    width: min(1100px, 95vw);
    max-width: calc(100vw - 20px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
}

#pro-cart-modal.active {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* DÉSACTIVÉ - Cause boucle infinie avec force-scroll-global.js
body:has(#pro-cart-modal.active) {
    overflow: hidden !important;
}
*/

#pro-cart-modal.show {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* DÉSACTIVÉ - Cause boucle infinie avec force-scroll-global.js
body:has(#pro-cart-modal.show) {
    overflow: hidden !important;
}
*/

/* Barre de progression */
.cart-progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.cart-progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #1a7be6, #16a085, #1a7be6);
    background-size: 200% 100%;
    animation: progressShimmer 2s linear infinite;
}

@keyframes progressShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.step-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: #adb5bd;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.step-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6c757d;
    text-align: center;
    transition: all 0.3s ease;
}

.progress-step.active .step-circle {
    background: linear-gradient(135deg, #1a7be6 0%, #0d5fb8 100%);
    border-color: #1a7be6;
    color: #fff;
    transform: scale(1.15);
    box-shadow: 0 4px 20px rgba(26, 123, 230, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1.15); }
    50% { transform: scale(1.2); }
}

.progress-step.active .step-label {
    color: #1a7be6;
    font-weight: 700;
}

.progress-step.completed .step-circle {
    background: linear-gradient(135deg, #16a085 0%, #0e7c68 100%);
    border-color: #16a085;
    color: #fff;
    box-shadow: 0 4px 15px rgba(22, 160, 133, 0.3);
}

.progress-step.completed .step-circle::after {
    content: '✓';
    font-size: 1.3rem;
    animation: checkmark 0.4s ease;
}

@keyframes checkmark {
    0% { transform: scale(0) rotate(-45deg); }
    50% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.progress-step.completed .step-label {
    color: #16a085;
}

.progress-line {
    flex: 1;
    height: 3px;
    background: #dee2e6;
    margin: 0 10px;
    position: relative;
    min-width: 40px;
    max-width: 80px;
    overflow: hidden;
}

.progress-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #1a7be6, #16a085);
    transition: width 0.6s ease;
}

.progress-step.completed + .progress-line::after {
    width: 100%;
}

/* Étapes du panier */
.pro-cart-modal-body {
    display: flex;
    gap: 20px;
    min-height: 500px;
    position: relative;
    overflow-y: auto;
    padding-right: 6px;
}

.cart-step {
    flex: 1;
    display: none !important;
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.cart-step.active {
    display: block !important;
    opacity: 1;
    transform: translateX(0);
    animation: slideInRight 0.5s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.cart-step h3 {
    color: #1a7be6;
    font-size: 1.8rem;
    margin-bottom: 25px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-step h3::before {
    content: '';
    width: 4px;
    height: 30px;
    background: linear-gradient(180deg, #1a7be6, #16a085);
    border-radius: 2px;
}

/* Formulaires */
.cart-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #495057;
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
    color: #333;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1a7be6;
    box-shadow: 0 0 0 4px rgba(26, 123, 230, 0.1);
    transform: translateY(-2px);
}

.form-group input:valid {
    border-color: #16a085;
}

.cart-info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left: 4px solid #e67e22;
    border-radius: 8px;
    margin-top: 15px;
}

.cart-info-box i {
    color: #e67e22;
    font-size: 1.3rem;
    margin-top: 2px;
}

.cart-info-box p {
    margin: 0;
    color: #856404;
    font-size: 0.95rem;
    line-height: 1.5;
}

.cart-info-box a {
    color: #d63031;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.cart-info-box a:hover {
    text-decoration: underline;
    color: #c0392b;
}

/* Actions des étapes */
.cart-step-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f1f3f5;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 16px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.btn-primary::before,
.btn-secondary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before,
.btn-secondary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #1a7be6 0%, #0d5fb8 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(26, 123, 230, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(26, 123, 230, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 2px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #ced4da;
    transform: translateY(-2px);
}

.btn-pay {
    background: linear-gradient(135deg, #16a085 0%, #0e7c68 100%);
    box-shadow: 0 4px 15px rgba(22, 160, 133, 0.3);
}

.btn-pay:hover {
    box-shadow: 0 6px 25px rgba(22, 160, 133, 0.5);
}

.btn-pay i {
    font-size: 1.1rem;
}

/* Récapitulatif */
.recap-section {
    background: #fff;
    border: 2px solid #f1f3f5;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.recap-section:hover {
    border-color: #1a7be6;
    box-shadow: 0 4px 20px rgba(26, 123, 230, 0.1);
}

.recap-section h4 {
    color: #1a7be6;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recap-section h4 i {
    font-size: 1.3rem;
}

.recap-content {
    color: #495057;
    line-height: 1.8;
}

.recap-content p {
    margin: 8px 0;
    display: flex;
    justify-content: space-between;
}

.recap-content strong {
    color: #212529;
    font-weight: 600;
}

.recap-total {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #1a7be6;
}

.total-line {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 1.05rem;
}

.total-line.discount {
    color: #e74c3c;
    font-weight: 600;
}

.total-line.final {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a7be6;
    border-top: 2px solid #dee2e6;
    padding-top: 15px;
    margin-top: 10px;
}

/* Sidebar résumé */
.cart-sidebar-summary {
    position: sticky;
    top: 20px;
    width: 300px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.cart-sidebar-summary:hover {
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

.cart-sidebar-summary h4 {
    color: #1a7be6;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 1rem;
    color: #495057;
}

.summary-line.discount-line {
    color: #e74c3c;
    font-weight: 600;
}

.summary-line.total-line {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a7be6;
    border-top: 2px solid #dee2e6;
    padding-top: 15px;
    margin-top: 10px;
}

/* Produits dans le panier (étape 1) */
#pro-cart-modal-items {
    max-height: clamp(260px, 50vh, 520px);
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 18px;
    scroll-behavior: smooth;
}

#pro-cart-modal-items::-webkit-scrollbar {
    width: 8px;
}

#pro-cart-modal-items::-webkit-scrollbar-thumb {
    background: #c5d7f2;
    border-radius: 10px;
}

#pro-cart-modal-items::-webkit-scrollbar-thumb:hover {
    background: #9bbcf0;
}

#pro-cart-modal-items .cart-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #fff;
    border: 2px solid #f1f3f5;
    border-radius: 12px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

#pro-cart-modal-items .cart-item:hover {
    border-color: #1a7be6;
    box-shadow: 0 4px 15px rgba(26, 123, 230, 0.1);
    transform: translateY(-2px);
}

#pro-cart-modal-items .cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: #adb5bd;
}

.cart-empty i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.cart-empty p {
    font-size: 1.2rem;
    margin: 0;
}

/* Boutons de quantité */
.quantity-decrease,
.quantity-increase {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    color: #495057;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-decrease:hover,
.quantity-increase:hover {
    background: linear-gradient(135deg, #1a7be6 0%, #0d5fb8 100%);
    border-color: #1a7be6;
    color: #fff;
    transform: scale(1.1);
}

.quantity-decrease:active,
.quantity-increase:active {
    transform: scale(0.95);
}

/* Responsive */
@media (max-width: 768px) {
    #pro-cart-modal {
        width: 100%;
        height: 100%;
    }
    
    .pro-cart-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .cart-progress-bar {
        padding: 20px 10px;
    }
    
    .step-circle {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .step-label {
        font-size: 0.7rem;
    }
    
    .progress-line {
        min-width: 20px;
        max-width: 40px;
    }
    
    .pro-cart-modal-body {
        flex-direction: column;
        overflow-y: visible;
    }
    
    #pro-cart-modal-items {
        max-height: calc(100vh - 360px);
    }

    .cart-sidebar-summary {
        position: static;
        width: 100%;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .cart-step-actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}

@media (max-width: 480px) {
    #pro-cart-modal-items {
        max-height: calc(100vh - 320px);
    }
}

/* Animations d'entrée */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-step.active .cart-form,
.cart-step.active .recap-section {
    animation: fadeInUp 0.6s ease backwards;
}

.cart-step.active .cart-form .form-group:nth-child(1) { animation-delay: 0.1s; }
.cart-step.active .cart-form .form-group:nth-child(2) { animation-delay: 0.2s; }
.cart-step.active .cart-form .form-group:nth-child(3) { animation-delay: 0.3s; }
.cart-step.active .cart-form .form-group:nth-child(4) { animation-delay: 0.4s; }

.cart-step.active .recap-section:nth-child(1) { animation-delay: 0.1s; }
.cart-step.active .recap-section:nth-child(2) { animation-delay: 0.2s; }
.cart-step.active .recap-section:nth-child(3) { animation-delay: 0.3s; }
