/* =========================================================
   Folerbazar — Stylesheet (fully refactored)
   - Fixes the broken --webkit-background-clip typo
   - Single-source-of-truth design tokens
   - De-duplicated rules
   - Navbar contrast fixed over hero
   - Footer wave fill matches footer surface
   - Section title / badge styling actually present
   - Empty-cart badge hidden, animated bump on add
   - Mobile sticky summary disabled, qty controls accessible
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
    --primary:        #27ae60;
    --primary-hover:  #219150;
    --primary-dark:   #1b6d3c;
    --bg-light:       #f9fafb;
    --surface:        #ffffff;
    --text:           #2c3e50;
    --text-muted:     #64748b;
    --border:         #e2e8f0;
    --danger:         #e53935;
    --warn:           #f59e0b;
    --gradient-start: #27ae60;
    --gradient-end:   #16a34a;
    --shadow-sm:      0 2px 4px rgba(15, 23, 42, .04), 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-md:      0 4px 6px -1px rgba(15, 23, 42, .08), 0 2px 4px -1px rgba(15, 23, 42, .04);
    --shadow-lg:      0 10px 15px -3px rgba(15, 23, 42, .1), 0 4px 6px -2px rgba(15, 23, 42, .05);
    --radius-sm:      8px;
    --radius:         12px;
    --radius-lg:      16px;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

img { max-width: 100%; height: auto; }

/* Skip-link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    border-radius: 0 0 var(--radius-sm) 0;
    z-index: 9999;
    transition: top .2s ease;
}
.skip-link:focus { top: 0; }

/* Bootstrap btn-primary palette override (single, not duplicated) */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
    --bs-btn-disabled-bg: var(--primary);
    --bs-btn-disabled-border-color: var(--primary);
}
.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
    --bs-btn-active-bg: var(--primary-hover);
    --bs-btn-active-border-color: var(--primary-hover);
}
.text-success { color: var(--primary) !important; }
.bg-success   { background-color: var(--primary) !important; }

/* Form focus ring tinted to brand */
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .2rem rgba(39, 174, 96, .15);
}
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* =========================================================
   TOP BAR
   ========================================================= */
.top-bar {
    background: var(--gradient-start);
    color: #fff;
    font-size: .9rem;
    padding: .45rem 0;
}
.top-bar a, .top-bar-link {
    color: #fff;
    text-decoration: none;
    transition: opacity .2s ease;
}
.top-bar a:hover { opacity: .85; }

/* =========================================================
   NAVBAR
   - Solid white background (was transparent glass over green hero — unreadable)
   - Adds shadow on scroll
   ========================================================= */
.navbar {
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
    transition: box-shadow .2s ease, background .2s ease;
    padding: .75rem 0;
}
.navbar.navbar-scrolled {
    box-shadow: 0 4px 16px rgba(15, 23, 42, .08);
}
.navbar-brand {
    font-weight: 700;
    color: var(--primary) !important;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.navbar-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}
.brand-text { color: var(--text); }
.brand-accent { color: var(--primary); }
.brand-bd {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: .65em;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 6px;
    vertical-align: middle;
    letter-spacing: .04em;
    margin-left: 2px;
    line-height: 1.4;
}

.navbar .nav-link {
    position: relative;
    font-weight: 500;
    color: var(--text) !important;
    transition: color .25s ease;
    padding: .5rem 1rem;
}
.navbar .nav-link.active,
.navbar .nav-link:hover { color: var(--primary) !important; }

.navbar .nav-link::after {
    content: '';
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 4px;
    height: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .25s ease;
}
.navbar .nav-link:hover::after,
.navbar .nav-link.active::after { transform: scaleX(1); }

.nav-icon {
    margin-right: .25rem;
    font-size: 1rem;
}

/* =========================================================
   FLOATING CART
   ========================================================= */
.floating-cart {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(39, 174, 96, .35);
    z-index: 1040;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}
.floating-cart:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 28px rgba(39, 174, 96, .45);
    color: #fff;
}
.floating-cart-inner { position: relative; display: inline-flex; }
.floating-cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger);
    color: #fff;
    border-radius: 999px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-size: .75rem;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
    transition: transform .2s ease;
}
/* Hide badge when cart is empty (don't display "0") */
.floating-cart.is-empty .floating-cart-badge { display: none; }

/* Bump animation when item added */
@keyframes cart-bump {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.floating-cart.cart-bump { animation: cart-bump .4s ease; }

/* =========================================================
   HERO
   ========================================================= */
.hero-section {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #fff;
    padding: 6rem 0 5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .12), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 0, 0, .15), transparent 50%);
    pointer-events: none;
    z-index: 1;
}
.hero-section::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .15);
    pointer-events: none;
    z-index: 1;
}
.hero-section .hero-content {
    position: relative;
    z-index: 2;
}
.hero-title,
.hero-subtitle { text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }

.hero-badge {
    display: inline-block;
    background: rgba(255, 255, 255, .2);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 999px;
    padding: .35rem 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.hero-title {
    font-size: clamp(2.25rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1rem;
}

/* Gradient text — FIXED: was --webkit-background-clip (CSS variable, broken) */
.hero-title .text-gradient {
    background: linear-gradient(45deg, #ffeb3b, #ff9800);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    /* Fallback for non-supporting UAs */
    text-shadow: none;
}
@supports not (background-clip: text) {
    .hero-title .text-gradient { color: #ffeb3b; }
}

.hero-subtitle {
    max-width: 600px;
    margin: 1.25rem auto 2rem;
    font-size: 1.1rem;
    opacity: .95;
}
.hero-cta .btn,
.hero-cta .hero-btn {
    background: #fff;
    color: var(--primary);
    border: none;
    padding: .85rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
    transition: transform .2s ease, box-shadow .2s ease;
    display: inline-flex;
    align-items: center;
}
.hero-cta .btn:hover,
.hero-cta .hero-btn:hover {
    background: #fff;
    color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .2);
}

.hero-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
}
.stat-label {
    display: block;
    font-size: .85rem;
    opacity: .9;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, .35);
}

/* =========================================================
   SECTIONS — actually styled now (these had no rules before)
   ========================================================= */
.products-section,
.checkout-section,
.product-detail-section { padding: 4rem 0; }

.section-header { max-width: 700px; margin-inline: auto; }
.section-badge {
    display: inline-block;
    background: rgba(39, 174, 96, .1);
    color: var(--primary);
    border-radius: 999px;
    padding: .35rem 1rem;
    font-weight: 600;
    font-size: .85rem;
    margin-bottom: .75rem;
}
.section-title {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 800;
    color: var(--text);
    margin-bottom: .75rem;
}
.section-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 0;
}

/* =========================================================
   ORDER TRACKING — step indicator
   ========================================================= */
.track-steps {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    margin: 1.5rem 0;
}
.track-steps::before {
    content: '';
    position: absolute;
    left: 8%;
    right: 8%;
    top: 18px;
    height: 3px;
    background: var(--border);
    z-index: 0;
}
.track-step {
    flex: 1 1 0;
    text-align: center;
    position: relative;
    z-index: 1;
    padding: 0 .25rem;
}
.track-step-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--border);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    transition: all .25s ease;
}
.track-step-label {
    margin-top: .5rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
}
.track-step-done .track-step-dot {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.track-step-done .track-step-label { color: var(--primary); }
.track-step-active .track-step-dot {
    background: #fff;
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 4px rgba(39,174,96,.18);
    animation: track-pulse 1.6s ease-in-out infinite;
}
.track-step-active .track-step-label { color: var(--primary); font-weight: 700; }
@keyframes track-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(39,174,96,.18); }
    50%      { box-shadow: 0 0 0 8px rgba(39,174,96,.10); }
}
@media (max-width: 575.98px) {
    .track-step-label { font-size: .7rem; }
    .track-step-dot   { width: 30px; height: 30px; font-size: .85rem; }
    .track-steps::before { top: 15px; }
}

/* Items table on tracking page — prevents column collapse / overflow */
.track-items-table { table-layout: auto; width: 100%; }
.track-items-table tfoot td { border-top: 1px solid var(--border); }
.track-items-table tfoot tr:last-child td {
    border-top: 2px solid var(--text);
    padding-top: .75rem;
    font-size: 1.05rem;
}
.track-items-table .text-break {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* =========================================================
   STOCK STATE
   ========================================================= */
.product-card.is-out-of-stock {
    opacity: .68;
    filter: grayscale(.4);
}
.product-card.is-out-of-stock:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}
.stock-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    padding: .35rem .75rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    box-shadow: 0 4px 8px rgba(0, 0, 0, .15);
}
.stock-overlay-out { background: var(--danger); color: #fff; }
.stock-overlay-low { background: var(--warn);   color: #fff; }

/* =========================================================
   PRODUCT CARD
   ========================================================= */
.product-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
    background: var(--surface);
    overflow: hidden;
}
.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(39, 174, 96, .3);
}
.product-img-link { display: block; }
.product-img-wrap {
    aspect-ratio: 1 / 1;
    background: #f1f5f9;
    overflow: hidden;
    position: relative;
}
.product-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}
.product-card:hover .product-img-wrap img { transform: scale(1.05); }

.card-title {
    color: var(--text);
    font-size: 1rem;
    min-height: 2.6em;       /* keep card heights consistent */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.price-tag {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}
.price-tag-large {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

/* =========================================================
   PRODUCT DETAIL PAGE
   ========================================================= */
.product-detail-img img {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    aspect-ratio: 1 / 1;
    object-fit: cover;
}
.product-desc {
    color: var(--text-muted);
    white-space: pre-wrap;
    font-size: 1.05rem;
    line-height: 1.65;
}
.qty-selector .input-group .form-control {
    border-left: 0;
    border-right: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}
.qty-selector input::-webkit-outer-spin-button,
.qty-selector input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* =========================================================
   BREADCRUMB
   ========================================================= */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
    font-size: .9rem;
}
.breadcrumb-item + .breadcrumb-item::before {
    content: '›';
    color: var(--text-muted);
    padding: 0 .5em;
}
.breadcrumb-item a { color: var(--primary); text-decoration: none; }
.breadcrumb-item.active { color: var(--text-muted); }

/* =========================================================
   CHECKOUT
   ========================================================= */
.checkout-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}
.summary-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.75rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
@media (min-width: 992px) {
    .summary-box {
        position: sticky;
        top: 100px;
    }
}

/* Sticky summary disabled on mobile (was inline `top:100px` causing overlap) */
.summary-box .list-group-item { padding-block: .85rem; }

.cart-remove-btn {
    text-decoration: none;
    font-size: .85rem;
}
.cart-remove-btn:hover { text-decoration: underline; }

/* =========================================================
   ORDER SUCCESS — single, de-duped definition
   ========================================================= */
.order-success-section {
    background: var(--bg-light);
    padding: 4rem 0;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.success-card {
    background: var(--surface);
    padding: 3rem 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 520px;
    width: 100%;
}
.success-icon {
    animation: pop .6s ease-out both;
}
.success-icon svg {
    width: 96px;
    height: 96px;
    color: var(--primary);
}
@keyframes pop {
    0%   { transform: scale(0); opacity: 0; }
    70%  { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}

/* =========================================================
   FOOTER — wave fill matches footer surface (was wrong color)
   ========================================================= */
.site-footer {
    background: var(--gradient-start);
    color: #fff;
    position: relative;
    margin-top: 4rem;
}
.footer-wave {
    position: absolute;
    top: -1px;       /* pixel-shift hides any subpixel seam */
    left: 0;
    right: 0;
    line-height: 0;
    transform: translateY(-99%);
    color: var(--gradient-start);   /* SVG path uses fill: currentColor */
}
.footer-wave svg {
    width: 100%;
    height: 80px;
    display: block;
    fill: currentColor;
}
.footer-main {
    padding: 3rem 0 2rem;
}
.footer-bottom {
    background: rgba(0, 0, 0, .15);
    padding: 1rem 0;
    font-size: .85rem;
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
}
.footer-brand-name {
    margin: 0;
    color: #fff;
    font-weight: 700;
    font-size: 1.5rem;
}
.footer-brand-name span { color: #ffeb3b; }   /* contrast against green bg */
.footer-brand-bd {
    display: inline-block;
    background: #ffeb3b;
    color: var(--primary-dark) !important;
    font-size: .65em;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    vertical-align: middle;
    letter-spacing: .04em;
    margin-left: 4px;
    line-height: 1.4;
}
.footer-desc {
    color: rgba(255, 255, 255, .85);
    line-height: 1.65;
    margin-bottom: 1.25rem;
}
.footer-heading {
    color: #fff;
    font-weight: 700;
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
}
.footer-links {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.footer-links li { margin-bottom: .5rem; }
.footer-links a {
    color: rgba(255, 255, 255, .85);
    text-decoration: none;
    transition: color .2s ease, padding-left .2s ease;
    display: inline-block;
}
.footer-links a:hover {
    color: #fff;
    padding-left: 4px;
    text-decoration: none;
}

.footer-contact .contact-item {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    margin-bottom: .75rem;
    color: rgba(255, 255, 255, .9);
}
.footer-contact a {
    color: rgba(255, 255, 255, .9);
    text-decoration: none;
}
.footer-contact a:hover { color: #fff; }

.footer-social {
    display: flex;
    gap: .75rem;
    margin-top: .5rem;
}
.social-link {
    width: 36px; height: 36px;
    display: inline-flex;
    align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    border-radius: 50%;
    transition: background .2s ease, transform .2s ease;
}
.social-link:hover {
    background: #fff;
    color: var(--primary);
    transform: translateY(-2px);
}

/* =========================================================
   TOAST
   ========================================================= */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1090;
    pointer-events: none;
}
.toast-container .toast {
    pointer-events: auto;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 240px;
}
.toast-success { background: var(--primary); }
.toast-danger  { background: var(--danger); }
.toast-warn    { background: var(--warn); color: #fff; }

/* =========================================================
   ADMIN
   ========================================================= */
.admin-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--surface);
        margin-top: .5rem;
        padding: 1rem;
        border-radius: var(--radius);
        box-shadow: var(--shadow-md);
    }
    .navbar .nav-link::after { display: none; }
}

@media (max-width: 767.98px) {
    .hero-section { padding: 4rem 0 3rem; }
    .hero-stats { gap: 1.25rem; }
    .stat-divider { display: none; }
    .top-bar { text-align: center; font-size: .8rem; }
    .floating-cart { bottom: 1rem; right: 1rem; width: 52px; height: 52px; }
    .checkout-card, .summary-box { padding: 1.25rem; }
    .products-section,
    .checkout-section,
    .product-detail-section { padding: 2.5rem 0; }
}

@media (max-width: 575.98px) {
    .success-card { padding: 2rem 1.25rem; }
    .price-tag-large { font-size: 1.5rem; }
}

/* =========================================================
   PRINT (invoice friendliness when reusing same stylesheet)
   ========================================================= */
@media print {
    .top-bar, .navbar, .floating-cart, .site-footer, .toast-container { display: none !important; }
    body { background: #fff; }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}
