/**
 * SHIYAO - Styles du système de commande
 */

/* Modal Checkout - Style Drawer comme le panier */
.checkout-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.checkout-modal.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s 0s;
}

.checkout-modal-content {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 550px;
    max-width: 90vw;
    background: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.checkout-modal.active .checkout-modal-content {
    transform: translateX(0);
}

.checkout-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.checkout-modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.checkout-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    color: #6b7280;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkout-modal-close:hover {
    background: #e5e7eb;
    color: #374151;
}

.checkout-modal-close:active {
    background: #d1d5db;
    transform: scale(0.95);
}

/* Progress Bar */
.checkout-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.progress-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all 0.3s;
    border: 2px solid #e5e7eb;
}

.progress-step.active .progress-number {
    background: #B8461F;
    color: white;
    box-shadow: 0 4px 12px rgba(184, 70, 31, 0.3);
}

.progress-step.completed .progress-number {
    background: #B8461F;
    color: white;
}

.progress-step span {
    font-size: 12px;
    color: #666;
}

.progress-step.active span {
    color: #B8461F;
    font-weight: 600;
}

.progress-line {
    width: 80px;
    height: 2px;
    background: #e5e7eb;
    margin: 0 10px;
    margin-bottom: 20px;
}

.progress-line.completed {
    background: linear-gradient(90deg, #B8461F 0%, #9a3819 100%);
}

/* Modal Body */
.checkout-modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 30px;
}

.checkout-section {
    margin-bottom: 30px;
}

.checkout-section h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #333;
}

.section-header-with-icon h3 {
    display: flex;
    align-items: center;
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

.section-header-with-icon p {
    margin: 0 0 12px 0;
    padding-left: 28px;
    font-size: 12px;
    color: #888;
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"] {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #B8461F;
    box-shadow: 0 0 0 3px rgba(184, 70, 31, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Bouton localiser sur la carte */
.btn-locate-map {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #B8461F 0%, #9a3819 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.btn-locate-map:hover {
    background: linear-gradient(135deg, #9a3819 0%, #7d2e14 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(184, 70, 31, 0.3);
}

.btn-locate-map:active {
    transform: translateY(0);
}

/* Shipping Info */
.shipping-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.shipping-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
}

.shipping-details p {
    margin: 5px 0;
    font-size: 14px;
}

/* Map Container */
.map-container {
    height: 280px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border: 1px solid #e5e7eb;
    margin-top: 20px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.map-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: none;
}

.map-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.map-placeholder i {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.map-placeholder p {
    color: #666;
    font-size: 14px;
}

/* Payment Container */
.payment-container {
    padding: 20px;
}

#paypal-button-container {
    width: 100%;
}

/* Payment Fully Covered Message */
.payment-fully-covered {
    padding: 24px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(34, 197, 94, 0.06) 100%);
    border: 2px solid rgba(34, 197, 94, 0.3);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.15);
}

.payment-success-message {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.payment-success-message > i {
    font-size: 48px;
    color: #16a34a;
    flex-shrink: 0;
}

.payment-success-message h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
    color: #16a34a;
}

.payment-success-message p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* Payment Placeholder */
.payment-placeholder {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.payment-placeholder i {
    font-size: 64px;
    color: #B8461F;
    margin-bottom: 20px;
}

.payment-placeholder h4 {
    margin: 0 0 10px 0;
    color: #333;
}

.payment-placeholder p {
    margin: 5px 0;
    color: #666;
}

/* Shipping Summary - Compact Version */
.shipping-summary-compact {
    padding: 14px 18px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-left: 3px solid #B8461F;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #B8461F;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.shipping-summary-compact p {
    margin: 6px 0;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.shipping-summary-compact p i {
    color: #B8461F;
    width: 16px;
    text-align: center;
}

/* Order Summary Box */
.order-summary-box {
    padding: 22px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.order-summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 15px;
    color: #333;
}

.order-summary-line span:first-child {
    font-weight: 500;
}

.order-summary-amount {
    font-weight: 600;
    color: #666;
}

.order-summary-line.gift-card-deduction {
    color: #16a34a;
}

.order-summary-line.gift-card-deduction span:first-child {
    display: flex;
    align-items: center;
    gap: 6px;
}

.order-summary-line.gift-card-deduction i {
    flex-shrink: 0;
}

.gift-card-amount {
    color: #16a34a !important;
    font-weight: 700;
}

.order-summary-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #e5e7eb 20%, #e5e7eb 80%, transparent 100%);
    margin: 14px 0;
}

.order-summary-line.total {
    padding: 14px 0 0 0;
    font-size: 18px;
    font-weight: 700;
}

.order-summary-total {
    color: #B8461F !important;
    font-size: 24px;
    font-weight: 800;
}

@keyframes priceUpdate {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Old shipping summary - keep for compatibility */
.shipping-summary {
    padding: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.shipping-summary p {
    margin: 5px 0;
    font-size: 14px;
}

/* Confirmation */
.confirmation-success {
    text-align: center;
    padding: 20px;
}

.confirmation-success i {
    font-size: 80px;
    color: #B8461F;
    margin-bottom: 20px;
}

.confirmation-success h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.order-details {
    margin: 30px 0;
    text-align: left;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border: 1px solid #e5e7eb;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.order-detail-item {
    padding: 10px 0;
    border-bottom: 1px solid #e5e7eb;
}

.order-detail-item:last-child {
    border-bottom: none;
}

.order-detail-item span {
    color: #666;
    font-size: 14px;
}

.order-detail-item strong {
    color: #B8461F;
    font-size: 16px;
    font-weight: 600;
}

.confirmation-note {
    margin-top: 20px;
    color: #666;
    font-size: 14px;
}

/* Modal Footer */
.checkout-modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 20px 30px;
    border-top: 1px solid #e5e7eb;
    background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
    flex-shrink: 0;
}

.checkout-modal-footer button {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #B8461F 0%, #8B2F0F 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(184, 70, 31, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #9a3819 0%, #7d2e14 100%);
    box-shadow: 0 6px 16px rgba(184, 70, 31, 0.4);
    transform: translateY(-2px);
}

.btn-primary:active {
    background: linear-gradient(135deg, #7d2e14 0%, #6a2511 100%);
    transform: scale(0.98) translateY(0);
    box-shadow: 0 2px 8px rgba(184, 70, 31, 0.3);
}

.btn-secondary {
    background: rgba(184, 70, 31, 0.1);
    color: #B8461F;
    border: 1px solid rgba(184, 70, 31, 0.2);
}

.btn-secondary:hover {
    background: rgba(184, 70, 31, 0.15);
    border-color: rgba(184, 70, 31, 0.3);
}

.btn-secondary:active {
    background: rgba(184, 70, 31, 0.2);
    transform: scale(0.98);
}

/* Loader */
.checkout-loader,
.paypal-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.loader-content {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive - Mobile en bottom sheet */
@media (max-width: 768px) {
    .checkout-modal-content {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        max-width: 100%;
        height: 92vh;
        max-height: 92vh;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0.4s;
        visibility: hidden;
    }
    

    .checkout-modal.active .checkout-modal-content {
        transform: translateY(0);
        visibility: visible;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0s;
    }

    .checkout-modal-header,
    .checkout-modal-body,
    .checkout-modal-footer {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .checkout-progress {
        padding: 20px 10px;
    }

    .progress-line {
        width: 40px;
    }

    .progress-step span {
        font-size: 10px;
    }

    .checkout-modal-footer {
        flex-direction: column;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}


/* Fond blanc en bas pour la barre iOS - derrière la modale */
@media (max-width: 768px) {
    .checkout-modal-content::before {
        content: '';
        position: absolute;
        bottom: -120px;
        left: 0;
        right: 0;
        height: 120px;
        background: #ffffff;
        z-index: 1;
        pointer-events: none;
    }
}

/* Extension du fond blanc sous la modale pour Safari iOS */
@media (max-width: 768px) {
    .checkout-modal-content::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 200px;
        background: #ffffff;
        z-index: -1;
        pointer-events: none;
        transform: translateY(100%);
    }
}

/* Gift Card Section - Premium Design */
.gift-card-section {
    position: relative;
    padding: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
}

.gift-card-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    position: relative;
}

.gift-card-input {
    flex: 1;
    padding: 14px 20px 14px 48px;
    background: white;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #333;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.gift-card-input::placeholder {
    color: #999;
    font-weight: 500;
    letter-spacing: 1px;
}

.gift-card-input-group::before {
    content: '\f06b';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #B8461F;
    font-size: 18px;
    z-index: 1;
    pointer-events: none;
}

.gift-card-input:focus {
    outline: none;
    border-color: #B8461F;
    box-shadow: 0 0 0 4px rgba(184, 70, 31, 0.12), 0 4px 16px rgba(184, 70, 31, 0.15);
    transform: translateY(-1px);
}

.gift-card-input:disabled {
    background: #f9fafb;
    cursor: not-allowed;
    opacity: 0.7;
    border-color: #e5e7eb;
}

.btn-apply-gift-card {
    padding: 14px 32px;
    background: linear-gradient(135deg, #B8461F 0%, #8B2F0F 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(184, 70, 31, 0.25);
    position: relative;
    overflow: hidden;
}

.btn-apply-gift-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-apply-gift-card:hover:not(:disabled)::before {
    left: 100%;
}

.btn-apply-gift-card:hover:not(:disabled) {
    background: linear-gradient(135deg, #9a3819 0%, #7d2e14 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(184, 70, 31, 0.35);
}

.btn-apply-gift-card:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(184, 70, 31, 0.3);
}

.btn-apply-gift-card:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.gift-card-message {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gift-card-message i {
    font-size: 16px;
}

.gift-card-message.success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(34, 197, 94, 0.08) 100%);
    color: #16a34a;
    border: 1.5px solid rgba(34, 197, 94, 0.3);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.1);
}

.gift-card-message.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(239, 68, 68, 0.08) 100%);
    color: #dc2626;
    border: 1.5px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.1);
}

.gift-card-message.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0.08) 100%);
    color: #2563eb;
    border: 1.5px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.gift-card-applied {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.08) 100%);
    border: 2px solid rgba(34, 197, 94, 0.3);
    border-radius: 12px;
    margin-top: 12px;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.15);
    animation: slideDown 0.3s ease;
}

.gift-card-applied-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #16a34a;
    font-size: 14px;
    font-weight: 600;
}

.gift-card-applied-info i {
    font-size: 20px;
    animation: checkPulse 0.5s ease;
}

@keyframes checkPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.btn-remove-gift-card {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.12);
    border: 1.5px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    color: #dc2626;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
}

.btn-remove-gift-card:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    transform: rotate(90deg);
}

.btn-remove-gift-card:active {
    transform: rotate(90deg) scale(0.9);
}

/* Collapsible Sections */
.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0;
}

.collapsible-header:hover {
    background: linear-gradient(135deg, #fafbfc 0%, #f3f4f6 100%);
    border-color: #d1d5db;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.collapsible-icon {
    color: #6b7280;
    font-size: 14px;
    transition: transform 0.3s ease;
}

.collapsible-content {
    padding: 16px 0 0 0;
    animation: slideDown 0.3s ease;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .gift-card-section {
        padding: 20px;
    }
    
    .gift-card-input-group {
        flex-direction: column;
    }
    
    .gift-card-input {
        padding: 14px 20px 14px 48px;
    }
    
    .btn-apply-gift-card {
        width: 100%;
        padding: 14px 24px;
    }
}
