/* ================= GLOBAL & TYPOGRAPHY ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #f7f7f5;
    color: #111;
    line-height: 1.5;
    overflow-x: hidden;
}

h1 {
    font-family: "Playfair Display", serif;
    font-size: clamp(32px, 5vw, 48px); /* Responsive font size */
    text-align: center;
    letter-spacing: -1px;
    margin-top: 10px;
}

.subtitle {
    text-align: center;
    color: #777;
    margin-top: 8px;
    margin-bottom: 45px;
    font-size: 15px;
}

/* ================= MAIN CONTAINER ================= */
.shop {
    width: 100%;
    max-width: 1200px;
    margin: auto;
    padding: 100px 20px 60px;
}

/* ================= CATEGORY SLIDER ================= */
.category-slider {
    display: flex;
    justify-content: flex-start; /* Better for scrolling */
    align-items: flex-start;
    gap: 34px;
    margin-bottom: 40px;
    overflow-x: auto;
    scrollbar-width: none; /* Hide for Firefox */
    padding: 10px 5px;
}

/* Center items if they don't overflow */
@media (min-width: 992px) {
    .category-slider { justify-content: center; }
}

.category-slider::-webkit-scrollbar { display: none; }

.cat-circle {
    flex: 0 0 auto;
    text-align: center;
}

.cat-circle a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
}

.cat-circle img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    padding: 5px;
    background: white;
    border: 3px solid transparent;
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cat-circle span {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 500;
}

.cat-circle.active img {
    border-color: black;
    transform: scale(1.05);
}

.cat-circle:hover img {
    transform: scale(1.07);
}

.underline {
    width: 0;
    height: 3px;
    background: black;
    margin-top: 6px;
    transition: 0.3s;
}

.cat-circle.active .underline {
    width: 35px;
}

/* ================= FILTER BAR ================= */
.filter-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.filter-btn,
.sort-select,
#search {
    padding: 12px 20px;
    border-radius: 40px;
    border: 1px solid #ddd;
    background: white;
    font-size: 14px;
    transition: 0.2s;
    outline: none;
}

#search { width: 300px; }

.filter-btn:hover,
.sort-select:hover,
#search:focus {
    border-color: #aaa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* ================= FILTER DROPDOWN ================= */
.filter-dropdown { position: relative; }

.filter-menu {
    position: absolute;
    top: 55px;
    left: 0;
    width: 280px;
    background: white;
    padding: 24px;
    border-radius: 18px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    gap: 18px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: 0.3s;
    z-index: 100;
}

.filter-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
}

.filter-item input[type="range"] {
    accent-color: black;
}

.clear-btn {
    margin-top: 10px;
    padding: 10px;
    border: none;
    border-radius: 20px;
    background: black;
    color: white;
    cursor: pointer;
    font-weight: 500;
}

/* ================= PRODUCT GRID ================= */
.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 28px;
    margin-top: 20px;
}

/* ================= PRODUCT CARD ================= */
.card {
    background: white;
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
    transition: 0.3s;
    height: 100%;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 45px rgba(0,0,0,0.1);
}

.discount-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #e63946;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    z-index: 2;
}

.card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: #f9f9f9;
    border-radius: 14px;
    transition: 0.4s;
}

.card:hover img { transform: scale(1.02); }

.card-body {
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-body h3 {
    font-size: 16px;
    margin-bottom: -15px;
    color: #1a1a1a;
    line-height: 1.3;
}

/* PRICE SECTION */
.price-box {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.price {
    font-weight: 700;
    font-size: 19px;
    color: #000;
}

.mrp {
    text-decoration: line-through;
    color: #999;
    font-size: 14px;
}

/* VARIANT TAGS */
.variants-tags {
    margin-bottom: -5px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.v-tag {
    background: #f3f4f6;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    color: #555;
    border: 1px solid #e5e7eb;
}

/* ================= BUTTONS & CART CONTROL ================= */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    gap: 10px;
}

.view-btn {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: 0.2s;
}

.view-btn:hover { color: #000; }

.cart-control {
    width: 120px;
}

.add-btn {
    width: 100%;
    padding: 10px;
    border: 1px solid #000;
    border-radius: 25px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: 0.2s;
}

.add-btn:hover {
    background: black;
    color: white;
}

.qty-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f3f4f6;
    border-radius: 25px;
    padding: 6px 10px;
}

.qty-box button {
    border: none;
    background: none;
    font-size: 18px;
    cursor: pointer;
    width: 30px;
    color: #000;
}

.qty { font-weight: 700; font-size: 14px; }

/* ================= TOAST MESSAGE ================= */
.toast-message {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #1a1a1a;
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 1000;
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
}

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

/* ================= RESPONSIVE ================= */

@media (max-width: 992px) {
    .products { grid-template-columns: repeat(3, 1fr); }
    .cat-circle img { width: 80px; height: 80px; }
}

@media (max-width: 768px) {
    .products { grid-template-columns: repeat(2, 1fr); }
    .shop { padding: 90px 15px 40px; }
    #search { width: 100%; order: -1; } /* Search moves to top on mobile filter */
}

@media (max-width: 600px) {
    .products { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .card { padding: 12px; }
    .card img { height: 160px; }
    .price { font-size: 16px; }
    .cat-circle img { width: 70px; height: 70px; }
    .card-footer { flex-direction: column; align-items: stretch; }
    .view-btn { text-align: center; margin-bottom: 5px; }
    .cart-control { width: 100%; }
}

/* Flipkart Style Pricing & Ratings */

.fk-card {
    text-align: left !important; /* Items are left-aligned in marketplace style */
    border: 1px solid #f0f0f0;
}

.brand-text {
    font-size: 14px;
    color: #878787;
    font-weight: 500;
    margin-bottom: 2px;
}

.product-title {
    font-size: 16px;
    font-weight: 400;
    color: #212121;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Rating Badge & Count */
.rating-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.rating-badge {
    background-color: #388e3c; /* Flipkart Green */
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

.rating-count {
    color: #878787;
    font-size: 14px;
    font-weight: 500;
}

/* Price Section */
.price-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.price {
    font-size: 20px;
    font-weight: 700;
    color: #212121;
}

.mrp {
    font-size: 14px;
    color: #878787;
    text-decoration: line-through;
}

.discount-text {
    font-size: 14px;
    color: #388e3c; /* Flipkart Green */
    font-weight: 600;
}

/* Buttons Alignment */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
}

.view-btn {
    text-decoration: none;
    color: #2874f0; /* Flipkart Blue */
    font-size: 14px;
    font-weight: 600;
}

.add-btn {
    background-color: #000000 !important; /* Flipkart Yellow */
    color: white !important;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 700;
    cursor: pointer;
}

/* FIX: Space for the 70px fixed header */
.shop {
    padding-top: 80px; 
    max-width: 1200px;
    margin: 0 auto;
}

/* DYNAMIC STAR SYSTEM */
.stars-outer {
    position: relative;
    display: inline-block;
    color: #e0e0e0;
    font-family: serif;
    line-height: 1;
    font-size: 0.95rem;
}
.stars-outer::before { content: "★★★★★"; letter-spacing: 1px; }

.stars-inner {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    overflow: hidden;
    color: #D4AF37; /* Subio Gold */
    width: 0;
}
.stars-inner::before { content: "★★★★★"; letter-spacing: 1px; }

.rating-flex {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

/* Green Rating Badge Style */
.rating-pill {
    background-color: #388e3c; /* Exact Green from image */
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.rating-pill span {
    font-size: 0.75rem; /* Star size */
}

.review-count-text {
    color: #71717A;
    font-size: 0.9rem;
    margin-left: 6px;
}

/* Price & Discount Style */
.price-row-custom {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 15px 0;
}

.price-now-fk {
    font-size: 2rem;
    font-weight: 800;
    color: #1a1a1a;
}

.price-old-fk {
    text-decoration: line-through;
    color: #71717A;
    font-size: 1.1rem;
}

.discount-pill-fk {
    background: #DCFCE7; /* Light green background */
    color: #166534; /* Dark green text */
    padding: 4px 12px;
    border-radius: 100px;
    font-weight: 700;
    font-size: 0.85rem;
}

/* Green Rating Pill Style */
.rating-pill {
    background-color: #388e3c; /* Exact green from image */
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    line-height: 1;
}
.rating-pill span { font-size: 0.7rem; }

.review-count-text {
    color: #878787;
    font-size: 0.85rem;
    margin-left: 6px;
}

/* FK Style Price Box */
.price-box-fk {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}
.price-now {
    font-size: 1.15rem;
    font-weight: 800;
    color: #212121;
}
.price-old {
    text-decoration: line-through;
    color: #878787;
    font-size: 0.9rem;
}
.discount-text-fk {
    color: #388e3c;
    font-weight: 700;
    font-size: 0.85rem;
}

.product-title {
    font-size: 1rem;
    font-weight: 500;
    color: #212121;
    margin-bottom: 5px;
    /* Truncate long titles to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.4em; 
}

/* Container for the swap logic */
.cart-control-wrapper {
    flex: 1;
    height: 38px; /* Fixed height to match button */
}

/* The Black Add Button */
.add-btn {
    width: 100%;
    height: 38px;
    background: #212121;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.add-btn:hover {
    background: #333333;
}

.add-btn:active {
    transform: scale(0.98);
}



/* The Plus/Minus Buttons */
.qty-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    width: 35px;
    height: 100%;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.qty-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* The Number in the middle */
#qty-val-{{ p.id }}, 
.qty-box-interactive span {
    font-size: 1rem;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
    user-select: none;
}

.qty-pop {
    animation: qtyPop 0.25s ease;
}

@keyframes qtyPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); color: #00ffcc; }
    100% { transform: scale(1); }
}

.qty-pop {
    animation: smoothPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes smoothPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.5); color: #00ffcc; }
    100% { transform: scale(1); }
}

/* ================= PREMIUM UNIFIED QTY ================= */
.qty-box-interactive {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    width: 100%;
    background: #1f1f1f;
    border-radius: 10px;
    padding: 0 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

/* REMOVE PATCH LOOK */
.qty-box-interactive button {
    flex: 1;
    height: 100%;
    border: none;
    background: transparent; /* 🔥 IMPORTANT */
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* hover effect (subtle) */
.qty-box-interactive button:hover {
    color: #ddd;
}

/* click */
.qty-box-interactive button:active {
    transform: scale(0.9);
}

/* ================= NUMBER ================= */
.qty-box-interactive span {
    flex: 1;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

/* ===== SAME BASE FOR BOTH ===== */
.add-btn,
.qty-box-interactive {
    width: 100%;
    height: 38px;              /* ✅ SAME */
    border-radius: 8px;        /* ✅ SAME */
    box-sizing: border-box;
}

.add-btn {
    background: #212121;
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-box-interactive {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #212121;       /* SAME as button */
    padding: 0 8px;
}

/* buttons */
.qty-btn {
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

/* number */
.qty-box-interactive span {
    flex: 1;
    text-align: center;
    color: #fff;
    font-weight: 700;
}

.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 260px));
    justify-content: center;   /* center items */
    gap: 28px;
}

.card-footer {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* SAME SIZE FOR BOTH */
.view-btn,
.add-btn {
    flex: 1;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
}

/* VIEW BUTTON (NO BORDER) */
.view-btn {
    background: #f5f5f5;   /* light clean background */
    color: #212121;
    border: none;          /* ❌ removed border */
}

/* ADD BUTTON */
.add-btn {
    background: #000;
    color: #fff;
    border: none;
}

/* FIX WRAPPER */
.cart-control-wrapper {
    flex: 1;
    height: 40px;
}

@media (max-width: 600px) {

    .card-footer {
        flex-direction: row !important;   /* 🔥 force side-by-side */
        gap: 8px;
    }

    .view-btn,
    .add-btn {
        flex: 1;               /* equal width */
        height: 38px;
        font-size: 13px;
    }

    .cart-control-wrapper {
        flex: 1;
    }
}

.view-btn {
    background: #f3f3f3;
}

.add-btn {
    background: #000;
    color: #fff;
}

.img-box {
    width: 100%;
    aspect-ratio: 1 / 1;   /* 🔥 PERFECT SQUARE ALWAYS */
    border-radius: 16px;
    overflow: hidden;
    background: #fff;

    display: flex;
    align-items: center;
    justify-content: center;
}

.img-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;   /* 🔥 FULL IMAGE VISIBLE */
}

.card {
    display: flex;
    flex-direction: column;
    height: 100%;  /* adaptive */
}

.img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;   /* 🔥 CHANGE THIS */
}