/* ============================================
   ShopNow — Master Stylesheet
   Design System matching reference UI
   ============================================ */

/* ---- CSS Custom Properties ---- */
:root {
    --sn-primary: #E23744;
    --sn-primary-dark: #C62828;
    --sn-primary-light: #FFEBEE;
    --sn-success: #4CAF50;
    --sn-success-light: #E8F5E9;
    --sn-warning: #FF9800;
    --sn-warning-light: #FFF3E0;
    --sn-info: #2196F3;
    --sn-info-light: #E3F2FD;
    --sn-text: #212121;
    --sn-text-muted: #757575;
    --sn-bg: #F5F5F5;
    --sn-card-bg: #FFFFFF;
    --sn-border: #E0E0E0;
    --sn-radius: 8px;
    --sn-radius-pill: 20px;
    --sn-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --sn-shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
    --sn-font: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --sn-star: #FFB300;
}

/* ---- Global Reset & Base ---- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--sn-font);
    background: var(--sn-bg);
    color: var(--sn-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--sn-primary-light);
    color: var(--sn-primary);
}

a {
    color: var(--sn-primary);
    text-decoration: none;
}

a:hover {
    color: var(--sn-primary-dark);
}

.text-shopnow {
    color: var(--sn-primary) !important;
}

.main-content {
    min-height: calc(100vh - 200px);
    padding-bottom: 2rem;
}

/* ---- Navbar ---- */
.shopnow-navbar {
    background: var(--sn-card-bg);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 0.5rem 0;
    z-index: 1030;
}

.shopnow-brand {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--sn-primary) !important;
    text-decoration: none;
}

.shopnow-brand span {
    color: var(--sn-text);
}

.shopnow-brand i {
    color: var(--sn-primary);
}

.nav-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--sn-text);
    font-size: 1.2rem;
    transition: background 0.2s;
    position: relative;
}

.nav-icon-btn:hover {
    background: var(--sn-primary-light);
    color: var(--sn-primary);
}

.cart-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--sn-primary);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badgePop 0.3s ease;
}

@keyframes badgePop {
    0% { transform: scale(0); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.navbar-actions {
    display: flex;
    align-items: center;
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* ---- Buttons ---- */
.btn-shopnow {
    background: var(--sn-primary);
    color: white;
    border: none;
    border-radius: var(--sn-radius);
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    transition: all 0.2s;
}

.btn-shopnow:hover {
    background: var(--sn-primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(226,55,68,0.3);
}

.btn-outline-shopnow {
    color: var(--sn-primary);
    border: 1.5px solid var(--sn-primary);
    border-radius: var(--sn-radius);
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    background: transparent;
    transition: all 0.2s;
}

.btn-outline-shopnow:hover {
    background: var(--sn-primary);
    color: white;
}

/* ---- Location Bar ---- */
.location-bar {
    background: var(--sn-card-bg);
    border-bottom: 1px solid var(--sn-border);
}

/* ---- Search ---- */
.search-form {
    position: relative;
}

.search-input-group {
    border-radius: var(--sn-radius);
    overflow: hidden;
    box-shadow: var(--sn-shadow);
    border: 1px solid var(--sn-border);
}

.search-input-group .input-group-text {
    border: none;
}

.search-input {
    border: none !important;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
}

.search-input:focus {
    box-shadow: none;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 var(--sn-radius) var(--sn-radius);
    box-shadow: var(--sn-shadow-hover);
    z-index: 100;
    display: none;
}

.search-suggestions.show {
    display: block;
}

.search-suggestion-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}

.search-suggestion-item:hover {
    background: var(--sn-primary-light);
}

/* ---- Toggle (Shop by Shops / Items) ---- */
.toggle-container {
    display: flex;
    background: var(--sn-card-bg);
    border-radius: var(--sn-radius-pill);
    overflow: hidden;
    box-shadow: var(--sn-shadow);
    border: 1.5px solid var(--sn-border);
}

.toggle-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--sn-text);
    text-decoration: none;
    transition: all 0.2s;
    border-radius: var(--sn-radius-pill);
}

.toggle-btn.active {
    background: var(--sn-primary);
    color: white;
}

.toggle-btn:hover:not(.active) {
    color: var(--sn-primary);
    background: var(--sn-primary-light);
}

/* ---- Filter Pills ---- */
.filter-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-pill {
    display: inline-block;
    padding: 0.4rem 1rem;
    border: 1.5px solid var(--sn-border);
    border-radius: var(--sn-radius-pill);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--sn-text);
    text-decoration: none;
    background: var(--sn-card-bg);
    transition: all 0.2s;
    cursor: pointer;
}

.filter-pill:hover {
    border-color: var(--sn-primary);
    color: var(--sn-primary);
}

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

/* ---- Section Title ---- */
.section-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--sn-text);
    margin-bottom: 0.75rem;
    padding-bottom: 0.25rem;
}

/* ---- Shop Cards ---- */
.shop-card {
    background: var(--sn-card-bg);
    border-radius: var(--sn-radius);
    overflow: hidden;
    box-shadow: var(--sn-shadow);
    transition: all 0.25s;
}

.shop-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--sn-shadow-hover);
}

.shop-card-images {
    display: flex;
    height: 100px;
    overflow: hidden;
}

.shop-card-img {
    flex: 1;
    overflow: hidden;
}

.shop-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.shop-card:hover .shop-card-img img {
    transform: scale(1.05);
}

.shop-card-info {
    padding: 0.6rem 0.75rem;
}

.shop-card-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
    color: var(--sn-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shop-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.shop-distance {
    color: var(--sn-text-muted);
}

.shop-distance i {
    color: var(--sn-primary);
}

.shop-rating {
    color: var(--sn-star);
    font-size: 0.7rem;
    letter-spacing: 1px;
}

/* ---- Product Cards ---- */
.product-card {
    background: var(--sn-card-bg);
    border-radius: var(--sn-radius);
    overflow: hidden;
    box-shadow: var(--sn-shadow);
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--sn-shadow-hover);
}

.product-card-img {
    height: 180px;
    overflow: hidden;
    background: #fafafa;
}

.product-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-card-img img {
    transform: scale(1.05);
}

.product-card-info {
    padding: 0.6rem 0.75rem 0.3rem;
    flex-grow: 1;
}

.product-card-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--sn-text);
    margin-bottom: 0.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-price {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--sn-text);
    margin-bottom: 0;
}

/* Add to Cart button in product card */
.btn-add-to-cart {
    display: block;
    width: calc(100% - 1.5rem);
    margin: 0.4rem 0.75rem 0.75rem;
    padding: 0.4rem;
    background: var(--sn-success);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-add-to-cart:hover {
    background: #388E3C;
    transform: translateY(-1px);
}

.btn-add-to-cart.added {
    background: var(--sn-primary);
}

/* Placeholder images */
.placeholder-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #ccc;
    font-size: 2rem;
}

.placeholder-lg {
    height: 400px;
}

/* ---- Product Detail ---- */
.product-gallery {
    position: sticky;
    top: 80px;
}

.product-main-image {
    border-radius: var(--sn-radius);
    overflow: hidden;
    background: #fafafa;
    box-shadow: var(--sn-shadow);
}

.product-main-image img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.product-thumbnails {
    display: flex;
    gap: 0.5rem;
}

.product-thumb {
    width: 70px;
    height: 70px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.product-thumb.active,
.product-thumb:hover {
    border-color: var(--sn-primary);
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-detail-price {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--sn-primary);
    margin-bottom: 0.5rem;
}

/* Variant Pills */
.variant-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.variant-pill {
    padding: 0.4rem 1rem;
    border: 1.5px solid var(--sn-border);
    border-radius: var(--sn-radius-pill);
    background: white;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.variant-pill:hover {
    border-color: var(--sn-primary);
    color: var(--sn-primary);
}

.variant-pill.active {
    background: var(--sn-primary);
    color: white;
    border-color: var(--sn-primary);
}

.color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Quantity Selector */
.qty-selector {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid var(--sn-border);
    border-radius: var(--sn-radius);
    overflow: hidden;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.qty-btn:hover {
    background: var(--sn-primary-light);
    color: var(--sn-primary);
}

.qty-input {
    width: 50px;
    height: 36px;
    border: none;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.qty-display {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
}

.qty-selector-sm .qty-btn {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
}

.delivery-info {
    background: #F5FFF5;
    border-radius: var(--sn-radius);
    padding: 1rem;
    border: 1px solid #C8E6C9;
}

/* ---- Cart ---- */
.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--sn-card-bg);
    border-radius: var(--sn-radius);
    box-shadow: var(--sn-shadow);
    margin-bottom: 0.75rem;
    align-items: flex-start;
}

.cart-item-img {
    width: 90px;
    height: 90px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

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

.cart-item-info {
    flex-grow: 1;
}

.cart-item-price {
    text-align: right;
    flex-shrink: 0;
}

.cart-summary {
    background: var(--sn-card-bg);
    border-radius: var(--sn-radius);
    padding: 1.25rem;
    box-shadow: var(--sn-shadow);
    position: sticky;
    top: 80px;
}

/* ---- Auth Card ---- */
.auth-card {
    background: var(--sn-card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--sn-shadow);
}

.auth-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--sn-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: var(--sn-primary);
}

/* ---- Checkout Card ---- */
.checkout-card {
    background: var(--sn-card-bg);
    border-radius: var(--sn-radius);
    padding: 1.5rem;
    box-shadow: var(--sn-shadow);
}

/* ---- Order Card ---- */
.order-card {
    background: var(--sn-card-bg);
    border-radius: var(--sn-radius);
    padding: 1.25rem;
    box-shadow: var(--sn-shadow);
    transition: all 0.2s;
}

.order-card:hover {
    box-shadow: var(--sn-shadow-hover);
}

/* ---- Order Timeline ---- */
.order-timeline {
    background: #f9f9f9;
    border-radius: var(--sn-radius);
    padding: 1rem;
}

/* ---- Stats Cards (Vendor Dashboard) ---- */
.stat-card {
    background: var(--sn-card-bg);
    border-radius: var(--sn-radius);
    padding: 1.25rem;
    box-shadow: var(--sn-shadow);
    text-align: center;
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sn-shadow-hover);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    font-size: 1.2rem;
}

.bg-primary-light { background: var(--sn-primary-light); }
.bg-success-light { background: var(--sn-success-light); }
.bg-warning-light { background: var(--sn-warning-light); }
.bg-info-light { background: var(--sn-info-light); }

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sn-text);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--sn-text-muted);
    font-weight: 500;
}

/* ---- Filter Sidebar ---- */
.filter-sidebar {
    background: var(--sn-card-bg);
    border-radius: var(--sn-radius);
    padding: 1.25rem;
    box-shadow: var(--sn-shadow);
    position: sticky;
    top: 80px;
}

/* ---- Shop Detail Header ---- */
.shop-banner {
    height: 200px;
    border-radius: var(--sn-radius);
    background-size: cover;
    background-position: center;
    margin-bottom: 1rem;
}

.shop-banner-default {
    background: linear-gradient(135deg, var(--sn-primary), var(--sn-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-detail-info {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.shop-logo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: var(--sn-shadow);
}

/* ---- Badge variants ---- */
.bg-budget {
    background: #E8F5E9 !important;
    color: #2E7D32 !important;
}

.bg-premium {
    background: #FFF3E0 !important;
    color: #E65100 !important;
}

/* ---- Toast ---- */
.shopnow-toast {
    border-radius: var(--sn-radius) !important;
    animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- Footer ---- */
.shopnow-footer {
    background: #1A1A2E;
    color: #E0E0E0;
    padding: 3rem 0 1.5rem;
    margin-top: 3rem;
}

.footer-brand {
    color: white;
    font-weight: 700;
    font-size: 1.3rem;
}

.footer-heading {
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.footer-links li {
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.footer-links a {
    color: #BDBDBD;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--sn-primary);
}

/* ---- Pagination ---- */
.page-item.active .page-link {
    background: var(--sn-primary);
    border-color: var(--sn-primary);
}

.page-link {
    color: var(--sn-primary);
    border-radius: 6px;
    margin: 0 2px;
}

.page-link:hover {
    color: var(--sn-primary-dark);
}

/* ---- Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.product-card,
.shop-card,
.stat-card,
.order-card {
    animation: fadeInUp 0.4s ease;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .product-card-img {
        height: 140px;
    }

    .shop-card-images {
        height: 80px;
    }

    .product-main-image img {
        height: 280px;
    }

    .product-detail-price {
        font-size: 1.4rem;
    }

    .filter-sidebar {
        position: static;
    }

    .cart-summary {
        position: static;
    }

    .cart-item {
        flex-wrap: wrap;
    }

    .cart-item-price {
        width: 100%;
        text-align: left;
        margin-top: 0.5rem;
    }
}

@media (max-width: 576px) {
    .toggle-btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.6rem;
    }

    .filter-pill {
        font-size: 0.78rem;
        padding: 0.3rem 0.7rem;
    }

    .product-card-name {
        font-size: 0.8rem;
    }

    .product-card-price {
        font-size: 0.85rem;
    }

    .btn-add-to-cart {
        font-size: 0.75rem;
        padding: 0.3rem;
    }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ---- Forms ---- */
.form-control:focus,
.form-select:focus {
    border-color: var(--sn-primary);
    box-shadow: 0 0 0 0.2rem rgba(226, 55, 68, 0.15);
}

/* ---- Table ---- */
.table {
    background: var(--sn-card-bg);
    border-radius: var(--sn-radius);
    overflow: hidden;
    box-shadow: var(--sn-shadow);
}

.table thead th {
    background: #fafafa;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--sn-text-muted);
    border-bottom: 2px solid var(--sn-border);
}

/* ---- Dropdown ---- */
.dropdown-menu {
    border: none;
    box-shadow: var(--sn-shadow-hover);
    border-radius: var(--sn-radius);
}

.dropdown-item:hover {
    background: var(--sn-primary-light);
    color: var(--sn-primary);
}

/* ---- Offcanvas ---- */
.offcanvas-body .nav-link {
    padding: 0.75rem 1rem;
    border-radius: var(--sn-radius);
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--sn-text);
}

.offcanvas-body .nav-link:hover {
    background: var(--sn-primary-light);
    color: var(--sn-primary);
}
