/* --- CSS Variables and Base Styles --- */
:root {
    --primary: #5d35a5; /* Darkened for better contrast */
    --primary-dark: #4a2b84;
    --primary-light: #8763d1;
    --secondary: #0ca678;
    --secondary-dark: #099268;
    --accent: #e8590c;
    --danger: #c92a2a;
    --warning: #e67700;
    --dark: #212529;
    --light: #f8f9fa;
    --gray: #495057;
    --light-gray: #dee2e6;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
    --focus-ring: 0 0 0 3px rgba(93, 53, 165, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px; /* For fixed header */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    font-size: 16px;
}

/* Accessibility - Focus states */
button:focus, a:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    box-shadow: var(--focus-ring);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* --- Header --- */
.header {
    background-color: var(--white);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.header.scrolled {
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    color: var(--dark);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.4rem;
    z-index: 5;
}

.logo i {
    font-size: 1.6rem;
    margin-right: 0.5rem;
    color: var(--primary);
}

/* Navigation with better accessibility */
.nav-links {
    display: none; /* Hidden by default, shown via JS/media query */
    list-style: none;
}

/* Mobile Navigation */
.mobile-menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark);
    cursor: pointer;
    padding: 5px;
    z-index: 5;
}

@media (max-width: 991px) {
    .mobile-menu-toggle {
        display: block; /* Show toggle on mobile */
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--white);
        flex-direction: column;
        box-shadow: var(--shadow);
        padding: 1rem 0;
        z-index: 99;
        transform: translateY(-110%);
        transition: transform 0.3s ease;
        /* display: flex; will be added by JS when shown */
    }

    .nav-links.show-mobile {
        transform: translateY(0);
        display: flex; /* Make visible */
    }

    .nav-links li {
        margin: 0;
        width: 100%;
        text-align: center;
    }

    .nav-links a {
        display: block;
        padding: 0.8rem 1rem;
    }
}

@media (min-width: 992px) {
    .nav-links {
        display: flex; /* Show links inline on desktop */
    }
}

.nav-links li {
    margin-left: 2rem; /* Only applies on desktop */
}

.nav-links a {
    color: var(--gray);
    font-weight: 500;
    text-decoration: none;
    position: relative;
    padding-bottom: 0.25rem;
    transition: color 0.3s;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: width 0.3s;
}

.nav-links a:hover, .nav-links a:focus {
    color: var(--primary);
}

.nav-links a:hover::after, .nav-links a:focus::after {
    width: 100%;
}

/* Search Box */
.search-container {
    display: flex;
    margin: 0 1rem;
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid var(--light-gray);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(93, 53, 165, 0.2);
}

.search-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    border: none;
    background: none;
    padding: 0 0.8rem;
    color: var(--gray);
    cursor: pointer;
    transition: color 0.2s;
}

.search-btn:hover {
    color: var(--primary);
}

@media (max-width: 768px) {
    .search-container {
        margin: 0.5rem 0;
        order: 3; /* Moves search below logo/nav on mobile wrap */
        max-width: 100%;
        width: 100%;
    }

    .header-content {
        flex-wrap: wrap;
    }
}

/* Cart icon */
.cart-icon {
    position: relative;
    cursor: pointer;
    color: var(--dark);
    font-size: 1.5rem;
    background: none;
    border: none;
    padding: 5px;
    display: flex;
    align-items: center;
    z-index: 5;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--accent);
    color: var(--white);
    font-size: 0.75rem;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s;
}

.cart-badge.animate {
    transform: scale(1.5);
}

/* --- Hero --- */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    padding: 4rem 0;
    text-align: center;
    margin-bottom: 3rem;
    border-radius: 0 0 var(--radius) var(--radius);
}

.hero h2 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.hero p {
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto 1.5rem;
    opacity: 0.9;
}

/* Buttons */
.btn {
    display: inline-block;
    background-color: var(--secondary);
    color: var(--white);
    padding: 0.7rem 1.3rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.btn:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: -100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.btn:hover:after, .btn:focus:after {
    left: 100%;
}

.btn-primary {
    background-color: var(--primary);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* --- Recently Viewed Products --- */
.recently-viewed-container {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    /* display: none; set by JS */
}

.recently-viewed-container h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary);
    position: relative;
    padding-bottom: 0.5rem;
}

.recently-viewed-container h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 2px;
    background-color: var(--primary);
}

.recently-viewed-list {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) var(--light);
}

.recently-viewed-list::-webkit-scrollbar {
    height: 6px;
}

.recently-viewed-list::-webkit-scrollbar-track {
    background: var(--light);
    border-radius: 3px;
}

.recently-viewed-list::-webkit-scrollbar-thumb {
    background-color: var(--primary-light);
    border-radius: 3px;
}

.recently-viewed-item {
    min-width: 180px;
    padding: 0.8rem;
    border: 1px solid var(--light-gray);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.recently-viewed-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}

.rv-product-icon {
    width: 40px;
    height: 40px;
    background-color: var(--light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.rv-product-info {
    flex: 1;
    overflow: hidden; /* Prevent text overflow */
}

.rv-product-info h4 {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rv-product-info p {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

/* --- Section & Product Styles --- */
.product-section {
    margin-bottom: 3rem;
    /* display: block; set by JS based on filter */
    /* visibility: hidden; /* Use opacity/transform for transitions */
    /* opacity: 0; */
    /* transform: translateY(20px); */
    /* transition: opacity 0.4s ease, transform 0.4s ease; */
}

/* .product-section.visible { */
    /* visibility: visible; */
    /* opacity: 1; */
    /* transform: translateY(0); */
/* } */

.section-header {
    background-color: var(--white);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    border-left: 5px solid var(--primary);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-header i {
    color: var(--primary);
    font-size: 1.5rem;
}

.section-header h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

/* Filter buttons */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.filter-btn {
    background-color: var(--light);
    border: 1px solid var(--light-gray);
    color: var(--gray);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.filter-btn:hover, .filter-btn:focus {
    border-color: var(--primary-light);
    color: var(--primary);
}

.filter-btn.active {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    min-height: 100px; /* Ensure grid has height even when empty initially */
}

/* --- Product Card --- */
.product-card {
    background-color: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition), opacity 0.5s ease, transform 0.5s ease;
    box-shadow: var(--shadow);
    display: flex; /* Keep display flex */
    flex-direction: column;
    position: relative;
    border: 1px solid var(--light-gray);
    opacity: 0; /* Start hidden for lazy load */
    transform: translateY(30px); /* Start shifted down */
}

.product-card.loaded { /* Class added by lazy load JS */
    opacity: 1;
    transform: translateY(0);
}


.product-card:hover {
     transform: translateY(-5px) scale(1.01); /* Slight lift on hover */
     box-shadow: var(--shadow-lg);
}


.product-image {
    height: 160px;
    background: linear-gradient(135deg, #e9ecef, #ced4da);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 3rem;
}

.product-content {
    padding: 1.2rem;
    flex: 1; /* Allow content to grow */
    display: flex;
    flex-direction: column; /* Stack content vertically */
}

.product-tag {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    align-self: flex-start; /* Align tag to the start */
}

.tag-pc { background-color: var(--primary); color: var(--white); }
.tag-mobile { background-color: var(--secondary); color: var(--white); }
.tag-engine { background-color: var(--gray); color: var(--white); }
.tag-web { background-color: var(--warning); color: var(--white); } /* Example for web */


.product-title {
    color: var(--dark);
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.4;
    min-height: 2.8em; /* Ensure space for 2 lines */
}

.product-price-display {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
}

.product-description {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    flex-grow: 1; /* Take remaining space */
    min-height: 4.5em; /* approx 3 lines */
}

/* Variation selector */
.product-variation-selector {
    margin-bottom: 1rem;
}

.product-variation-selector label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: var(--dark);
}

.product-variation-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--light-gray);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background-color: var(--white);
    cursor: pointer;
}

.product-variation-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(93, 53, 165, 0.2);
}

.product-feature-list {
    list-style: none;
    margin-bottom: 1.2rem;
    font-size: 0.85rem;
    color: var(--dark);
    padding-left: 0;
}

.product-feature-list li {
    margin-bottom: 0.3rem;
    position: relative;
    padding-left: 1.2rem;
}

.product-feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--secondary);
    font-weight: bold;
}

.add-to-cart-btn {
    width: 100%;
    background-color: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-weight: 500;
    margin-top: auto; /* Push button to bottom */
    font-size: 0.95rem;
}

.add-to-cart-btn i {
    margin-right: 0.5rem;
}

.add-to-cart-btn:hover, .add-to-cart-btn:focus {
    background-color: var(--primary-dark);
}

/* Related Products */
.related-products-container {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--light-gray);
}

.related-products-heading {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
    font-weight: 600;
}

.related-products-description {
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.related-products-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.related-product-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    background-color: var(--light);
    border-radius: var(--radius);
    border: 1px solid var(--light-gray);
    transition: all 0.2s;
}

.related-product-item:hover {
    background-color: rgba(93, 53, 165, 0.05);
    border-color: var(--primary-light);
}

.related-product-icon {
    width: 32px;
    height: 32px;
    background-color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1rem;
    flex-shrink: 0;
}

.related-product-info {
    flex: 1;
    overflow: hidden; /* Prevent text overflow */
}

.related-product-info h5 {
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-product-price {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
}

.related-view-btn, .related-add-btn {
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    background-color: var(--white);
}

.related-view-btn {
    border: 1px solid var(--primary);
    color: var(--primary);
}

.related-add-btn {
    border: none;
    background-color: var(--primary);
    color: var(--white);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-left: 0.5rem; /* Spacing */
}

.related-view-btn:hover {
    background-color: var(--primary-light);
    color: var(--white);
}

.related-add-btn:hover {
    background-color: var(--primary-dark);
    transform: scale(1.1);
}

/* --- Cart System --- */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-overlay.show {
    display: block;
    opacity: 1;
}

.cart {
    position: fixed;
    top: 0;
    right: -100%; /* Start off-screen */
    width: 100%;
    max-width: 400px;
    height: 100%;
    background-color: var(--white);
    z-index: 1000;
    transition: right 0.4s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.15);
}

.cart.show {
    right: 0; /* Slide in */
}

.cart-header {
    background-color: var(--primary);
    color: var(--white);
    padding: 1.2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.close-cart {
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    background: none;
    border: none;
    color: var(--white);
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.close-cart:hover {
    transform: scale(1.1);
}

.cart-body {
    flex: 1; /* Take available vertical space */
    overflow-y: auto; /* Scroll if content overflows */
    padding: 1.5rem;
}

.cart-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cart-item {
    display: flex;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--light-gray);
    gap: 1rem;
}

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

.cart-item-img {
    width: 60px;
    height: 60px;
    background-color: var(--light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.5rem;
    flex-shrink: 0;
}

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

.cart-item-name {
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--dark);
    font-size: 0.95rem;
    line-height: 1.4;
}

.cart-item-variation {
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 0.3rem;
}

.cart-item-price {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    margin-top: auto; /* Push actions to bottom */
    justify-content: space-between;
}

.quantity-controls {
    display: flex;
    align-items: center;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    background-color: var(--light);
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--dark);
    font-weight: bold;
    transition: background-color 0.2s;
}

.quantity-btn:hover, .quantity-btn:focus {
    background-color: var(--light-gray);
}

.quantity {
    margin: 0 0.75rem;
    font-weight: 500;
    min-width: 20px; /* Ensure space */
    text-align: center;
}

.remove-item-btn {
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 0.25rem 0.5rem;
}

.remove-item-btn:hover, .remove-item-btn:focus {
    opacity: 1;
    text-decoration: underline;
}

.cart-footer {
    background-color: var(--light);
    padding: 1.5rem;
    border-top: 1px solid var(--light-gray);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.checkout-btn {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.checkout-btn:hover, .checkout-btn:focus:not(.disabled) {
    background-color: var(--primary-dark);
}

.checkout-btn.disabled {
    background-color: var(--gray);
    cursor: not-allowed;
    opacity: 0.7;
}

.empty-cart {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
}

.empty-cart i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* --- Checkout Section --- */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto; /* Allow scrolling within overlay */
    padding: 2rem 0; /* Add padding for spacing */
}

.fullscreen-overlay.show {
    display: block;
    opacity: 1;
}

.checkout-popup {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto; /* Centered, respects padding */
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-checkout {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-checkout:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--dark);
}

.checkout-progress {
    display: flex;
    margin-bottom: 2rem;
    position: relative;
    justify-content: space-between;
}

.checkout-progress::before {
    content: '';
    position: absolute;
    top: 15px; /* Align with center of indicators */
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--light-gray);
    z-index: 1;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2; /* Above the line */
    flex: 1;
}

.step-indicator {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: background-color 0.3s, color 0.3s;
    border: 2px solid var(--white); /* Creates gap over line */
}

.step-label {
    font-size: 0.85rem;
    color: var(--gray);
    text-align: center;
    font-weight: 500;
    transition: color 0.3s;
}

.progress-step.active .step-indicator {
    background-color: var(--primary);
    color: var(--white);
}

.progress-step.active .step-label {
    color: var(--primary);
    font-weight: 600;
}

.progress-step.completed .step-indicator {
    background-color: var(--secondary);
    color: var(--white);
}

.progress-step.completed .step-label {
    color: var(--secondary);
}

.checkout-section h2, /* General heading style */
.checkout-grid h3 { /* Customer info heading */
    font-size: 1.6rem;
    margin-bottom: 2rem;
    color: var(--dark);
    position: relative;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--light-gray);
}
.checkout-grid h3 { /* Adjust size for subheading */
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
}


.checkout-grid {
    display: grid;
    grid-template-columns: 1fr; /* Default single column */
    gap: 2rem;
}

@media (min-width: 768px) {
    .checkout-grid {
        grid-template-columns: 1fr 1fr; /* Two columns on wider screens */
    }
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--light-gray);
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.95rem;
    background-color: var(--white); /* Ensure background */
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(93, 53, 165, 0.2);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.error-message {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: none; /* Hidden by default */
}

.error-message.show {
    display: block; /* Shown by JS */
}

/* --- Checkout Summary --- */
.checkout-summary {
    background-color: var(--light);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--light-gray);
}

.summary-title {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark);
    font-size: 1.1rem;
}

.summary-list {
    margin-bottom: 1rem;
    max-height: 200px; /* Limit height */
    overflow-y: auto; /* Add scroll if needed */
    padding-right: 0.5rem; /* Space for scrollbar */
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--light-gray);
    font-size: 0.9rem;
}

.summary-item span:first-child {
    padding-right: 1rem; /* Space between name and price */
    flex-shrink: 0;
    max-width: 70%; /* Prevent long names pushing price off */
}
.summary-item .item-name { display: block; }
.summary-item .item-level { display: block; font-size: 0.8em; color: var(--gray); }

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

.summary-total {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--dark);
    font-size: 1.1rem;
}

/* Action buttons */
.action-btn {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1.5rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 45px; /* Ensure height even with spinner */
}

.action-btn:hover, .action-btn:focus:not(:disabled) {
    background-color: var(--primary-dark);
}

.action-btn:disabled {
    background-color: var(--gray);
    cursor: not-allowed;
    opacity: 0.7;
}

.action-btn.loading {
    pointer-events: none; /* Prevent clicks while loading */
}

.action-btn.loading .btn-text { /* Hide text when loading */
    visibility: hidden;
}
.action-btn.loading .fas { /* Hide icon when loading */
    visibility: hidden;
}

.action-btn.loading:before {
    content: '';
    position: absolute; /* Center spinner */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s linear infinite;
    /* margin-right: 8px; No margin needed with absolute positioning */
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* --- Payment Details --- */
.payment-details {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--light-gray);
    /* display: none; Set by JS */
}

.payment-options {
    background-color: var(--light);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 1px solid var(--light-gray);
}

.payment-title {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.payment-title i {
    margin-right: 0.5rem;
    color: var(--primary);
}

.payment-methods {
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.payment-method {
    flex: 1 1 200px; /* Flex grow, shrink, basis */
    /* min-width: 200px; Replaced by flex-basis */
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    background-color: var(--white);
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--light-gray);
    transition: all 0.2s;
    cursor: pointer;
}

.payment-method:hover {
    border-color: var(--primary-light);
}

.payment-method input[type="radio"] {
    margin-right: 0.75rem;
    accent-color: var(--primary); /* Modern way to style radio */
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.payment-method label {
    font-weight: 500;
    cursor: pointer;
    flex-grow: 1;
    margin-bottom: 0; /* Reset default */
}

/* Style parent when radio is checked */
.payment-method:has(input:checked) {
    border-color: var(--primary);
    background-color: rgba(93, 53, 165, 0.05);
    box-shadow: 0 0 0 1px var(--primary);
}

.payment-qr {
    text-align: center;
    margin: 1.5rem 0;
}

.payment-qr img {
    max-width: 180px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 0 auto;
    display: block;
}

.payment-info {
    background-color: var(--white);
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    border: 1px solid var(--light-gray);
}

.payment-info p {
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--light-gray);
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.payment-info p:last-child {
    border-bottom: none;
}

.payment-info p strong {
    color: var(--dark);
    margin-right: 0.5rem;
    flex-shrink: 0; /* Prevent shrinking */
}

.payment-info p span {
    text-align: right;
    word-break: break-all; /* Break long numbers/codes */
}

.payment-note {
    text-align: center;
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: rgba(12, 166, 120, 0.1);
    border-radius: var(--radius);
    /* font-style: italic; */ /* Optional */
    color: var(--secondary-dark);
    font-size: 0.9rem;
}
.payment-note i { margin-right: 0.5em;}

.order-reference {
    font-weight: bold;
    background-color: var(--light-gray);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: var(--dark);
    font-family: monospace;
    font-size: 0.95em;
}

.payment-amount {
    font-weight: 700;
    color: var(--danger);
    font-size: 1em;
}

/* --- Success Message --- */
#success-message {
    /* Replaced fullscreen overlay with positioning */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1100; /* Above checkout overlay */
    /* display: none; set by JS */
    text-align: center;
    padding: 2rem;
    background-color: var(--white);
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%; /* Responsive width */
    border: 1px solid var(--secondary-dark);
    box-shadow: var(--shadow-lg);
}

#success-message i {
    font-size: 3rem;
    color: var(--secondary);
    margin-bottom: 1rem;
}

#success-message h2 {
    color: var(--secondary-dark);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

#success-message p {
    margin-bottom: 0.5rem;
}

.order-summary {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: var(--light);
    border-radius: var(--radius);
    text-align: left; /* Align text left */
}

.order-summary h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.order-items {
    margin-bottom: 1rem;
}

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--light-gray);
    font-size: 0.9rem;
}

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

.order-total {
    font-weight: 700;
    font-size: 1.1rem;
    text-align: right;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray);
}

/* --- Toast Notification --- */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--dark);
    color: var(--white);
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    z-index: 1050; /* Ensure above most elements */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-size: 0.9rem;
    max-width: 300px;
    pointer-events: none; /* Prevent interaction */
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.toast.success {
    background-color: var(--secondary-dark);
}

.toast.error {
    background-color: var(--danger);
}

/* Highlight for product focus */
.highlight {
    box-shadow: 0 0 0 3px var(--primary);
    animation: pulse 1.5s ease-out;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(93, 53, 165, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(93, 53, 165, 0); }
    100% { box-shadow: 0 0 0 0 rgba(93, 53, 165, 0); }
}

/* Lazy loading animation moved to product-card */

/* --- Footer --- */
.footer {
    background-color: var(--dark);
    color: #adb5bd;
    padding: 3rem 0 2rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    position: relative;
    padding-bottom: 0.5rem;
    color: var(--white);
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--primary);
}

.footer-links a {
    display: block;
    color: #adb5bd;
    margin-bottom: 0.5rem;
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9rem;
}

.footer-links a:hover, .footer-links a:focus {
    color: var(--white);
    padding-left: 5px;
}

.footer-links i {
    margin-right: 0.5rem;
    color: var(--primary);
    width: 1em;
    text-align: center;
}

.contact-info p {
    margin-bottom: 0.5rem;
    color: #adb5bd;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.contact-info i {
    margin-right: 0.75rem;
    color: var(--primary);
    width: 1em;
    text-align: center;
    flex-shrink: 0; /* Prevent icon shrinking */
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid #495057;
    color: #6c757d;
    font-size: 0.85rem;
}


/* Mobile Responsiveness Adjustments */
@media (max-width: 768px) {
    .checkout-popup {
        /* margin: 0; */ /* Keep margin for spacing on mobile */
        /* min-height: 100%; */ /* Let content define height */
        /* border-radius: 0; */ /* Keep radius */
        padding: 1.5rem;
        /* max-width: 100%; Already width: 90% */
    }

    .checkout-progress {
        /* Keep horizontal progress bar for better overview if possible */
         /* flex-direction: column; */
         /* gap: 1rem; */
         /* align-items: flex-start; */
    }
    /* .checkout-progress::before { display: none; } */
    /* .progress-step { flex-direction: row; align-items: center; gap: 0.5rem; } */
    /* .step-indicator { margin-bottom: 0; } */

     .step-label { font-size: 0.75rem; } /* Smaller labels on mobile */

}

@media (max-width: 576px) {
    .hero h2 { font-size: 1.8rem; }
    .hero p { font-size: 1rem; }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Slightly smaller cards */
        gap: 1rem;
    }

    .product-card {
        /* No extra margin needed due to grid gap */
    }

    .checkout-grid { gap: 1.5rem; }
    .checkout-popup { padding: 1.5rem 1rem; }
    h2, .checkout-grid h3 { font-size: 1.3rem; }

    .footer-content { grid-template-columns: 1fr; } /* Stack footer sections */
}