/* Checkout Page Styles */

/* General Layout */
html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
    background-color: #f5f5f5;
}

/* ============================================
   Main Page Card Container
   ============================================ */

.page-card {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.page-card-header {
    background: var(--site-secondary, #597d35);
    color: #fff;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-card-header h2,
.page-card-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
}

.page-card-header i {
    font-size: 1.5rem;
}

.page-card-body {
    padding: 1.5rem;
}

/* Form input styling for card context */
.page-card .form-control {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}

.page-card .form-control:focus {
    background-color: #fff;
    border-color: var(--site-primary, #0d6efd);
}

.page-card .input-group-text {
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    white-space: nowrap;
    line-height: 60px;
}

/* Checkout-Specific Styles */

.checkout-container {
    max-width: 900px;
    margin: 0 auto;
}

.order-summary-card {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
}

.order-summary-header {
    background-color: #f8f9fa;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

.order-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #dee2e6;
}

.order-item:last-child {
    border-bottom: none;
}

.order-totals {
    background-color: #f8f9fa;
    padding: 1rem 1.25rem;
    border-top: 2px solid #dee2e6;
}

.order-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.order-total-row.total {
    font-size: 1.25rem;
    font-weight: 700;
    padding-top: 0.5rem;
    border-top: 1px solid #dee2e6;
    margin-top: 0.5rem;
}

.customer-section-card {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.payment-section-card {
    border: 1px solid var(--site-primary, #0d6efd);
    border-radius: 0.375rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background-color: #f0f7ff;
}

.email-input-group {
    max-width: 500px;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15rem;
}

/* Badge Styles */
.badge-pending {
    background-color: #6c757d;
}

.badge-awaiting-payment {
    background-color: #ffc107;
    color: #000;
}

.badge-processing {
    background-color: #0dcaf0;
    color: #000;
}

.badge-completed {
    background-color: #198754;
}

.badge-cancelled {
    background-color: #dc3545;
}

/* Order History Styles */
.order-card {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s;
}

.order-card:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.order-card-header {
    background-color: #fff;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #dee2e6;
}

.order-card-body {
    padding: 1rem 1.25rem;
}

/* Responsive Adjustments */
@media (max-width: 576px) {
    .order-total-row {
        font-size: 0.9rem;
    }

    .order-total-row.total {
        font-size: 1.1rem;
    }

    .checkout-container {
        padding: 0 0.5rem;
    }
}

/* ============================================
   Checkout Page - Two Column Layout
   ============================================ */

.checkout-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.checkout-header {
    margin-bottom: 1.5rem;
}

.checkout-header h2 {
    margin: 0;
    color: #333;
}

.checkout-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 992px) {
    .checkout-content {
        grid-template-columns: 1fr 400px;
    }
}

/* Left Column - Customer & Payment Sections */
.checkout-left {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.checkout-section {
    background: #fff;
    border: none;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Form input styling within checkout sections */
.checkout-section .form-control {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}

.checkout-section .form-control:focus {
    background-color: #fff;
    border-color: var(--site-primary, #0d6efd);
}

.checkout-section .input-group-text {
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.section-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.section-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--site-primary, #0d6efd);
    color: #fff;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Customer Options */
.customer-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-section,
.guest-section {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
}

.login-section h5,
.guest-section h5 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #6c757d;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #dee2e6;
}

/* Customer Confirmed */
.customer-confirmed {
    padding: 0;
}

.customer-info-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #e8f5e9;
    border-radius: 0.5rem;
    border: 1px solid #c8e6c9;
}

.customer-avatar {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #4caf50;
    color: #fff;
    border-radius: 50%;
    font-size: 1.5rem;
}

.customer-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.customer-details .email {
    color: #333;
}

.customer-details .status {
    font-size: 0.875rem;
}

/* Payment/Confirmation Info */
.payment-info,
.confirmation-info {
    padding-top: 0.5rem;
}

.checkout-action-btn {
    margin-top: 1rem;
}

/* Right Column - Cart Summary */
.checkout-right {
    position: sticky;
    top: 1rem;
    align-self: start;
}

.cart-summary {
    background: #fff;
    border: none;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cart-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--site-secondary, #597d35);
    color: #fff;
    border-bottom: none;
}

.cart-header h4 {
    margin: 0;
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.cart-header .section-number {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.cart-header .order-number {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Cart Items */
.cart-items {
    max-height: 400px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eee;
    position: relative;
}

.cart-item:last-child {
    border-bottom: none;
}

/* Product Image in Cart */
.item-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.item-image.clickable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.item-image.clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.item-image i {
    font-size: 1.5rem;
    color: #6c757d;
}

.product-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-hint {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Item Details */
.item-details {
    flex: 1;
    min-width: 0;
}

.item-name {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.item-quantity {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Item Price */
.item-price {
    text-align: right;
    flex-shrink: 0;
}

.line-total {
    display: block;
    font-weight: 600;
    color: #333;
}

.unit-price {
    display: block;
    font-size: 0.75rem;
    color: #6c757d;
}

/* Remove Button */
.btn-remove-item {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem;
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.cart-item:hover .btn-remove-item {
    opacity: 1;
}

.btn-remove-item:hover {
    color: #a71d2a;
}

/* Cart Totals */
.cart-totals {
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.total-row.grand-total {
    font-size: 1.1rem;
    font-weight: 700;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 2px solid #dee2e6;
    color: var(--site-primary, #0d6efd);
}

/* Cart Coupon Section */
.cart-coupon-section {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #dee2e6;
}

.cart-coupon-section .coupon-input-section .input-group {
    font-size: 0.875rem;
}

.cart-coupon-section .coupon-success-card {
    padding: 0.5rem;
    background: #e8f5e9;
    border-radius: 0.375rem;
    border: 1px solid #c8e6c9;
    font-size: 0.875rem;
}

/* Delivery Email Override */
.delivery-email-override {
    padding-top: 0.5rem;
}

.delivery-email-override .form-label {
    font-size: 0.925rem;
    font-weight: 500;
}

/* ============================================
   Product Image Carousel Modal
   ============================================ */

#productImageModal .modal-content {
    border-radius: 0.75rem;
    overflow: hidden;
}

#productImageModal .modal-header {
    background: #f8f9fa;
    padding: 1rem 1.25rem;
}

#productImageModal .modal-title {
    font-size: 1rem;
    font-weight: 600;
}

/* Carousel Container */
.carousel-image-container {
    min-height: 400px;
    max-height: 70vh;
    background: #f8f9fa;
}

.carousel-product-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

/* Carousel Controls */
#productImageModal .carousel-control-prev,
#productImageModal .carousel-control-next {
    width: 50px;
    background: rgba(0, 0, 0, 0.3);
    opacity: 1;
    transition: background 0.2s;
}

#productImageModal .carousel-control-prev:hover,
#productImageModal .carousel-control-next:hover {
    background: rgba(0, 0, 0, 0.5);
}

#productImageModal .carousel-control-prev-icon,
#productImageModal .carousel-control-next-icon {
    width: 24px;
    height: 24px;
}

/* Carousel Counter */
#checkoutCarouselCounter {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #e9ecef;
    border-radius: 1rem;
    font-size: 0.875rem;
}

/* ============================================
   Status Banners
   ============================================ */

.checkout-status-banner {
    padding: 2rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

.checkout-status-banner.processing {
    background: #fff3cd;
    border: 1px solid #ffc107;
}

.checkout-status-banner.completed {
    background: #d1e7dd;
    border: 1px solid #198754;
}

.checkout-status-banner.cancelled {
    background: #f8d7da;
    border: 1px solid #dc3545;
}

.status-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.checkout-status-banner.completed .status-icon {
    color: #198754;
}

.checkout-status-banner.cancelled .status-icon {
    color: #dc3545;
}

/* ============================================
   Responsive Adjustments for Checkout
   ============================================ */

@media (max-width: 991px) {
    .checkout-right {
        position: static;
    }

    .cart-items {
        max-height: none;
    }
}

@media (max-width: 576px) {
    .checkout-page {
        padding: 0 0.5rem;
    }

    .checkout-section {
        padding: 1rem;
    }

    .cart-item {
        padding: 0.75rem 1rem;
    }

    .item-image {
        width: 50px;
        height: 50px;
    }

    .item-name {
        font-size: 0.875rem;
    }

    .carousel-image-container {
        min-height: 250px;
    }
}

/* ============================================
   Terms & Conditions Notice
   ============================================ */

.terms-notice a {
    color: var(--site-primary, #0d6efd);
    text-decoration: underline;
    font-weight: 500;
}

.terms-notice a:hover {
    color: var(--site-secondary, #597d35);
}

/* ============================================
   Refund Policy Section
   ============================================ */

.refund-policy-section {
    margin-top: 2rem;
}

.refund-policy-card {
    background: #f0f7ff;
    border: 1px solid #b6d4fe;
    border-left: 4px solid var(--site-primary, #0d6efd);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
}

.refund-policy-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--site-primary, #0d6efd);
    font-size: 1rem;
}

.refund-policy-header i {
    font-size: 1.25rem;
}

.refund-policy-text {
    margin: 0;
    font-size: 0.9rem;
    color: #495057;
    line-height: 1.5;
}

/* ============================================
   Checkout Trust & Security Banner
   ============================================ */

.checkout-trust-banner {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    text-align: center;
}

.trust-icons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
}

.trust-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: #495057;
}

.trust-item i {
    font-size: 1.5rem;
    color: var(--site-secondary, #597d35);
}

.trust-item .ideal-logo {
    height: 36px;
    width: auto;
}

.trust-item span {
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.trust-text {
    font-size: 0.85rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding-top: 0.5rem;
    border-top: 1px solid #dee2e6;
}

.trust-text i {
    color: #198754;
    font-size: 1rem;
}

@media (max-width: 576px) {
    .trust-icons {
        gap: 0.75rem;
    }

    .trust-item i {
        font-size: 1.25rem;
    }

    .trust-item .ideal-logo {
        height: 30px;
    }

    .trust-item span {
        font-size: 0.7rem;
    }
}

/* ============================================
   Alert Permanent - Non-dismissible alerts
   ============================================ */
.alert-permanent {
    border-left: 4px solid currentColor;
}
