/* Checkout Page Styles */

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.loading-spinner i {
    font-size: 24px;
    animation: spin 1s linear infinite;
    color: var(--primary-red);
    margin-bottom: 10px;
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Bundle Display Enhancements */
.bundle-details {
    margin-top: 8px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 5px;
    font-size: 12px;
}

.bundle-section-label {
    font-weight: 600;
    color: var(--medium-grey);
    display: block;
    margin-bottom: 5px;
}

.bundle-fixed-items,
.bundle-choice-items {
    margin-bottom: 8px;
}

.bundle-item {
    padding: 2px 0;
    color: var(--dark-grey);
}

.bundle-item .product-name {
    font-weight: 500;
}

/* Coupon Section */
.coupon-section {
    margin: 20px 0;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.coupon-form {
    display: flex;
    gap: 10px;
}

.coupon-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    transition: var(--transition);
}

.coupon-form input:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.coupon-form button {
    padding: 10px 20px;
    background: var(--primary-red);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.coupon-form button:hover {
    background: var(--hover-red);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.3);
}

.applied-coupon {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 5px;
    margin-bottom: 10px;
}

.btn-remove-coupon {
    background: none;
    border: none;
    color: var(--primary-red);
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: var(--transition);
}

.btn-remove-coupon:hover {
    color: var(--hover-red);
    transform: scale(1.2);
}

/* Shipping Methods */
.shipping-methods-section {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.shipping-method-option {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.shipping-method-option:hover {
    background: var(--light-grey);
    border-color: var(--primary-red);
}

.shipping-method-option input {
    margin-right: 10px;
}

.shipping-method-option label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin: 0;
}

.shipping-cost {
    font-weight: 600;
    color: var(--primary-red);
}

/* Tax Breakdown */
.tax-line {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 14px;
    color: var(--medium-grey);
}

/* Image Placeholder */
.image-placeholder {
    width: 60px;
    height: 60px;
    background: var(--light-grey);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    color: var(--medium-grey);
}

.checkout-section {
    padding: 80px 0 50px;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--light-grey) 0%, var(--background) 100%);
}

.checkout-header {
    text-align: center;
    margin-bottom: 50px;
}

.checkout-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--dark-grey);
    margin-bottom: 10px;
}

.checkout-header p {
    font-size: 1.1rem;
    color: var(--medium-grey);
}

.checkout-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 50px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Order Summary */
.order-summary {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.order-summary h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-grey);
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-grey);
}

.order-items {
    margin-bottom: 25px;
}

.order-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--light-grey);
}

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

.order-item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--light-grey);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.order-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.order-item-image i {
    font-size: 24px;
    color: var(--medium-grey);
}

.order-item-details {
    flex: 1;
}

.order-item-name {
    font-weight: 600;
    color: var(--dark-grey);
    margin-bottom: 5px;
}

.order-item-store {
    font-size: 0.85rem;
    color: var(--medium-grey);
    margin-bottom: 5px;
}

.order-item-quantity {
    font-size: 0.85rem;
    color: var(--medium-grey);
}

.order-item-price {
    font-weight: 600;
    color: var(--primary-red);
    font-size: 1.1rem;
}

.bundle-order-item {
    border-left: 3px solid var(--primary-red);
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.05) 0%, var(--pure-white) 100%);
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
    transition: var(--transition);
}

.bundle-order-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.1);
}

.bundle-products-preview {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--medium-grey);
}

.order-totals {
    border-top: 2px solid var(--light-grey);
    padding-top: 20px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 1rem;
}

.total-final {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark-grey);
    border-top: 1px solid var(--light-grey);
    padding-top: 15px;
    margin-top: 15px;
}

/* Checkout Form */
.checkout-form {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.form-section {
    margin-bottom: 35px;
}

.form-section h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark-grey);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--light-grey);
}

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

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

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--dark-grey);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-group.error input,
.form-group.error select {
    border-color: #ef4444;
    background: #fef2f2;
}

.error-message {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 5px;
    display: none;
}

.form-group.error .error-message {
    display: block;
}

/* Payment Methods */
.payment-methods {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.payment-method {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.payment-method:hover {
    border-color: var(--primary-red);
    background: rgba(220, 38, 38, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.1);
}

.payment-method input[type="radio"] {
    display: none;
}

.payment-method input[type="radio"]:checked + .checkmark {
    background: var(--primary-red);
    border-color: var(--primary-red);
}

.payment-method input[type="radio"]:checked + .checkmark::after {
    display: block;
}

.payment-method input[type="radio"]:checked ~ * {
    color: var(--primary-red);
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    position: relative;
    transition: all 0.3s ease;
}

.checkmark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    display: none;
}

.card-details {
    transition: all 0.3s ease;
}

.card-details.hidden {
    display: none;
}

/* Form Actions */
.form-actions {
    text-align: center;
    padding-top: 30px;
    border-top: 2px solid var(--light-grey);
}

.btn-place-order {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--hover-red) 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto 15px;
    min-width: 200px;
    justify-content: center;
}

.btn-place-order:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(220, 38, 38, 0.3);
}

.btn-place-order:disabled {
    background: var(--medium-grey);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-place-order.loading {
    opacity: 0.8;
    cursor: not-allowed;
}

.btn-place-order.loading i {
    animation: spin 1s linear infinite;
}

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

.security-note {
    color: var(--medium-grey);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.security-note i {
    color: var(--primary-red);
}

/* Empty Cart State */
.empty-cart-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--medium-grey);
}

.empty-cart-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: var(--light-grey);
}

.empty-cart-state h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--dark-grey);
}

.empty-cart-state p {
    margin-bottom: 30px;
}

.btn-continue-shopping {
    background: var(--primary-red);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-continue-shopping:hover {
    background: var(--hover-red);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(220, 38, 38, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .checkout-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .order-summary {
        order: 2;
        position: static;
    }
    
    .checkout-form {
        order: 1;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .payment-methods {
        flex-direction: column;
    }
    
    .checkout-header h1 {
        font-size: 2rem;
    }
    
    .order-summary,
    .checkout-form {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .checkout-section {
        padding: 70px 0 30px;
    }
    
    .checkout-header h1 {
        font-size: 1.8rem;
    }
    
    .form-section h3 {
        font-size: 1.1rem;
    }
    
    .btn-place-order {
        padding: 15px 30px;
        font-size: 1rem;
    }
}