/*  CART MODAL STYLES (for both homepage and product page)  */

/* Base Modal Overlay - Works for both cart and customer info modals */
.modal-overlay,
.cart-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: flex-end;
    align-items: flex-start;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active,
.cart-modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* Base Modal Container */
.modal,
.cart-modal {
    background-color: white;
    width: 400px;
    max-width: 90%;
    height: 100vh;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal,
.cart-modal-overlay.active .cart-modal {
    transform: translateX(0);
}

/* Modal Header */
.modal-header,
.cart-modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(186, 7, 22);
    color: white;
    position: sticky;
    top: 0;
    z-index: 1;
}

.modal-header h1,
.cart-modal-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Close Button */
.close-modal,
.close-cart-modal {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s ease;
}

.close-modal:hover,
.close-cart-modal:hover {
    transform: scale(1.1);
}

/* Modal Body */
.modal-body,
.cart-modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/*  CUSTOMER INFO MODAL SPECIFIC  */
#customerInfoModal .modal,
#customerInfoModal .cart-modal {
    max-width: 500px;
}

#customerInfoModal .modal-body,
#customerInfoModal .cart-modal-body {
    padding: 30px;
}

/* LOADING STATES */
.cart-loading,
.cart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
}

.cart-loading .fa-spinner,
.cart-loading .fa-spinner {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #3a5a78;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/*  EMPTY CART STATE  */
.empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    text-align: center;
    color: #666;
}

.empty-cart .fa-cart-shopping,
.empty-cart i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #ddd;
}

.empty-cart p {
    font-size: 1.2rem;
    margin-bottom: 25px;
}

.empty-cart .btn,
.empty-cart .btn-continue-shopping {
    background-color: #3a5a78;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.empty-cart .btn:hover,
.empty-cart .btn-continue-shopping:hover {
    background-color: #2a4a68;
}

/*  CART ITEMS  */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    background-color: #f9f9f9;
    transition: box-shadow 0.3s ease;
}

.cart-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 15px;
}

.cart-item-details {
    flex: 1;
}

.cart-item-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    font-size: 0.95rem;
    line-height: 1.3;
}

.cart-item-price {
    color: #3a5a78;
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 8px;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background-color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.quantity-btn:hover {
    background-color: #3a5a78;
    color: white;
    border-color: #3a5a78;
}

.quantity-input {
    width: 40px;
    height: 30px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.remove-item {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    margin-left: 10px;
    transition: color 0.2s ease;
}

.remove-item:hover {
    color: #c0392b;
}

/*  CART SUMMARY */
.cart-summary {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #eaeaea;
}

.cart-totals {
    margin-bottom: 20px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 5px 0;
}

.total-row span:first-child {
    color: #666;
}

.total-row span:last-child {
    font-weight: 600;
    color: #333;
}

.total-row.grand-total {
    border-top: 1px solid #ddd;
    padding-top: 15px;
    margin-top: 15px;
    font-size: 1.1rem;
    color: #3a5a78;
}

/*  CART ACTIONS  */
.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-actions .btn,
.btn-checkout,
.btn-continue-shopping {
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-checkout,
.cart-actions .btn-checkout {
    background-color: #25D366;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-checkout:hover,
.cart-actions .btn-checkout:hover {
    background-color: #1da851;
}

.btn-continue-shopping,
.cart-actions .btn-continue-shopping {
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
}

.btn-continue-shopping:hover,
.cart-actions .btn-continue-shopping:hover {
    background-color: #e9ecef;
}

/*  CART BADGE */
.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.cart-icon {
    position: relative;
    cursor: pointer;
    font-size: 1.5rem;
    color: #333;
}

/*  CUSTOMER INFORMATION FORM STYLES  */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: 'Rubik', sans-serif;
    transition: all 0.3s;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #3a5a78;
    box-shadow: 0 0 0 2px rgba(58, 90, 120, 0.2);
}

.form-control::placeholder {
    color: #aaa;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

.form-error {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 5px;
    display: none;
}

.form-error.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ===== FORM BUTTONS ===== */
.btn-primary {
    background: #27ae60;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
    font-family: 'Rubik', sans-serif;
    font-size: 1rem;
}

.btn-primary:hover {
    background: #219653;
}

.btn-secondary {
    background: #7f8c8d;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
    font-family: 'Rubik', sans-serif;
    font-size: 1rem;
}

.btn-secondary:hover {
    background: #707b7c;
}

/* FORM LOADING */
.form-loading {
    text-align: center;
    margin: 20px 0;
}

.form-loading i {
    font-size: 1.5rem;
    color: #3a5a78;
    margin-bottom: 10px;
}

.form-loading p {
    color: #666;
    margin-top: 5px;
}

/*  FORM ACTIONS */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

/*  ERROR STATE  */
.cart-error {
    text-align: center;
    padding: 40px 20px;
    color: #e74c3c;
}

.cart-error i {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.cart-error p {
    margin-bottom: 20px;
}

/* ===== SUCCESS MESSAGE ===== */
.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    border: 1px solid #c3e6cb;
    display: none;
}

.success-message.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    /* Modal Responsive */
    .modal,
    .cart-modal {
        width: 100%;
    }
    
    #customerInfoModal .modal,
    #customerInfoModal .cart-modal {
        max-width: 95%;
        margin: 10px;
    }
    
    #customerInfoModal .modal-body,
    #customerInfoModal .cart-modal-body {
        padding: 20px;
    }
    
    /* Cart Item Responsive */
    .cart-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cart-item-image {
        width: 100%;
        height: 150px;
        margin-right: 0;
    }
    
    .cart-item-quantity {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Form Actions Responsive */
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    /* Modal Header */
    .modal-header,
    .cart-modal-header {
        padding: 15px;
    }
    
    /* Modal Body */
    .modal-body,
    .cart-modal-body {
        padding: 15px;
    }
    
    /* Cart Item */
    .cart-item {
        padding: 10px;
    }
    
    /* Cart Actions */
    .cart-actions .btn,
    .btn-checkout,
    .btn-continue-shopping {
        padding: 10px;
        font-size: 0.9rem;
    }
}