/* ===== Cart Badge in Navbar ===== */
span.cart-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #e53e3e;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

.nav-link:has(> span.cart-badge) {
    position: relative;
}

/* Badge pulse animation */
@keyframes cartBadgePulse {
    0% { transform: scale(1); }
    30% { transform: scale(1.4); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

span.cart-badge.cart-badge-pulse {
    animation: cartBadgePulse 0.4s ease-out;
}

/* ===== Floating Cart Button (mobile) ===== */
.floating-cart {
    display: none;
}

@media (max-width: 991.98px) {
    .floating-cart {
        position: fixed;
        bottom: 24px;
        right: 20px;
        z-index: 1040;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: linear-gradient(135deg, #1461b5 0%, #0a3d6e 100%);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.4rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        text-decoration: none;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .floating-cart:hover,
    .floating-cart:active {
        transform: scale(1.1);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
        color: white;
        text-decoration: none;
    }

    .floating-cart-badge {
        position: absolute;
        top: -2px;
        right: -2px;
        background: #e53e3e;
        color: white;
        font-size: 0.7rem;
        font-weight: 700;
        min-width: 20px;
        height: 20px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
        line-height: 1;
        border: 2px solid white;
    }
}

/* ===== Fly-to-cart animation ===== */
.cart-flyer {
    position: fixed;
    z-index: 9999;
    font-size: 1.4rem;
    color: #1461b5;
    pointer-events: none;
    transition: transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.7s ease;
}

/* ===== Add to Cart Button ===== */
.btn-add-to-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #1461b5 0%, #0a3d6e 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.btn-add-to-cart:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(20, 97, 181, 0.4);
}

.btn-add-to-cart:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-add-to-cart.added {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.qty-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.qty-selector label {
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.qty-selector input {
    width: 70px;
    text-align: center;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

/* ===== Cart Page ===== */
.cart-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.cart-page h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2rem;
}

.cart-empty {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.cart-empty i {
    font-size: 4rem;
    color: #e2e8f0;
    margin-bottom: 1rem;
}

.cart-empty p {
    font-size: 1.2rem;
    color: #64748b;
    margin-bottom: 1.5rem;
}

.cart-empty a {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: #1461b5;
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
}

/* Cart Items */
.cart-items {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cart-item-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cart-item-image .no-image {
    font-size: 2rem;
    color: #e2e8f0;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
}

.cart-item-name {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.cart-item-ref {
    font-size: 0.85rem;
    color: #64748b;
}

.cart-item-price {
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.cart-item-qty {
    display: flex;
    align-items: center;
}

.cart-item-qty input {
    width: 60px;
    text-align: center;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.4rem;
    font-weight: 600;
}

.cart-item-subtotal {
    font-weight: 700;
    color: #1461b5;
    white-space: nowrap;
    min-width: 80px;
    text-align: right;
}

.cart-item-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.cart-item-remove:hover {
    background: #fef2f2;
}

.cart-item-unavailable {
    opacity: 0.5;
}

.cart-item-unavailable .cart-item-name::after {
    content: ' (indisponible)';
    color: #ef4444;
    font-size: 0.85rem;
    font-weight: normal;
}

/* Cart Summary */
.cart-summary {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.3rem;
    font-weight: 700;
}

.cart-total-label {
    color: #1e293b;
}

.cart-total-value {
    color: #1461b5;
    font-size: 1.5rem;
}

/* Cart Actions */
.cart-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.btn-checkout {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
    color: white;
    text-decoration: none;
}

.btn-empty-cart {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: white;
    color: #ef4444;
    border: 2px solid #ef4444;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-empty-cart:hover {
    background: #ef4444;
    color: white;
}

.btn-continue-shopping {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
}

.btn-continue-shopping:hover {
    color: #1461b5;
}

/* ===== Order Pages ===== */
.order-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.order-page h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2rem;
}

.order-summary-box {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.order-confirmation-banner {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    text-align: center;
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
}

.order-confirmation-banner i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.order-confirmation-banner h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.order-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1461b5;
    background: #eff6ff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: inline-block;
}

/* Order Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-transmise { background: #dbeafe; color: #1d4ed8; }
.status-en_traitement { background: #fef3c7; color: #92400e; }
.status-prete { background: #d1fae5; color: #065f46; }
.status-terminee { background: #f1f5f9; color: #475569; }
.status-annulee { background: #fee2e2; color: #991b1b; }

/* Order History List */
.order-list {
    list-style: none;
    padding: 0;
}

.order-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    margin-bottom: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.order-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    color: inherit;
    text-decoration: none;
}

/* Client Pages */
.client-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.client-page h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2rem;
    text-align: center;
}

.client-form {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
}

.client-form .form-group {
    margin-bottom: 1.25rem;
}

.client-form label {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
    display: block;
}

.client-form input,
.client-form textarea,
.client-form select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.client-form input:focus,
.client-form textarea:focus {
    border-color: #1461b5;
    outline: none;
}

.client-form .error-message {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.client-form .btn-submit {
    display: block;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #1461b5 0%, #0a3d6e 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.client-form .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(20, 97, 181, 0.4);
}

.client-form .form-link {
    text-align: center;
    margin-top: 1rem;
    color: #64748b;
}

.client-form .form-link a {
    color: #1461b5;
    font-weight: 600;
}

/* Client Dashboard */
.client-dashboard {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.client-dashboard h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard-card h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

/* ===== Order Checkout Form ===== */
.order-summary-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.order-summary-section h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.order-table {
    width: 100%;
    border-collapse: collapse;
}

.order-table thead th {
    background: #f8fafc;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0;
}

.order-table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}

.order-table tfoot td {
    padding: 0.75rem;
    border-top: 2px solid #e2e8f0;
}

.order-address-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.order-address-section h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.order-comment-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.order-comment-section h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.order-warning {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    color: #92400e;
}

.order-warning i {
    font-size: 1.5rem;
    margin-top: 0.1rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: #fff;
    box-sizing: border-box;
}

.form-input:focus {
    border-color: #1461b5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(20, 97, 181, 0.1);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

.order-address-section .form-group,
.order-comment-section .form-group {
    margin-bottom: 1rem;
}

.order-address-section label,
.order-comment-section label {
    display: block;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group-half {
    margin-bottom: 1rem;
}

.form-group-half label {
    display: block;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.error-text {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: block;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 0;
    font-size: 1rem;
    color: #1e293b;
}

.radio-label input[type="radio"],
.radio-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: #1461b5;
}

.order-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #f1f5f9;
    color: #475569;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: #e2e8f0;
    color: #1e293b;
    text-decoration: none;
}

.btn-confirm-order {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-confirm-order:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.45);
}

/* Responsive cart */
@media (max-width: 768px) {
    .cart-item {
        grid-template-columns: 60px 1fr;
        gap: 0.75rem;
    }

    .cart-item-price,
    .cart-item-qty,
    .cart-item-subtotal {
        grid-column: 2;
    }

    .cart-actions {
        flex-direction: column;
    }

    .btn-checkout {
        width: 100%;
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .order-actions {
        flex-direction: column;
    }

    .order-actions .btn-back,
    .order-actions .btn-confirm-order {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .order-table thead {
        display: none;
    }

    .order-table tbody td {
        display: block;
        text-align: right;
        padding: 0.4rem 0.75rem;
        border: none;
    }

    .order-table tbody td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: #475569;
    }

    .order-table tbody tr {
        border-bottom: 1px solid #e2e8f0;
        padding: 0.5rem 0;
    }
}
