/* ============================================================
   AYURCALL — components.css
   All reusable components: buttons, badges, product cards,
   concern cards, brand cards, type cards, dosha card.
   Used across multiple pages — do not add page-specific styles here.
   ============================================================ */

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font-family);
    font-size: var(--font-size-small);
    font-weight: 500;
    padding: 10px 22px;
    min-height: 40px;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--transition), opacity var(--transition);
    text-decoration: none;
}

.btn--primary {
    background: var(--color-accent);
    color: #fff;
}
.btn--primary:hover { background: #c98a00; }

.btn--secondary {
    background: transparent;
    border: 0.5px solid var(--color-primary);
    color: var(--color-primary);
}
.btn--secondary:hover { background: var(--color-primary-light); }

.btn--ghost {
    background: transparent;
    border: 0.5px solid rgba(255,255,255,0.35);
    color: #fff;
}
.btn--ghost:hover { background: rgba(255,255,255,0.1); }

/* Amber CTA — used on hero and prominent actions */
.btn--accent { background: var(--color-accent); color: #fff; }
.btn--accent:hover { background: #c98a00; }

/* Ghost variant for use on coloured/dark backgrounds */
.btn--ghost-white {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.55);
    color: #fff;
}
.btn--ghost-white:hover { background: rgba(255,255,255,0.1); border-color: #fff; }

/* Add to cart — used on product cards, never wraps */
.btn--add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-small);
    font-weight: 500;
    padding: 8px var(--space-2);
    min-height: 36px;
    white-space: nowrap;  /* NEVER wraps */
    cursor: pointer;
    transition: background var(--transition);
}
.btn--add:hover { background: var(--color-primary-dark); }

/* Add to cart — amber variant (best sellers section) */
.btn--add-accent {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-small);
    font-weight: 500;
    padding: 8px var(--space-2);
    min-height: 36px;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--transition);
}
.btn--add-accent:hover { background: #c98a00; }

/* ================================================================
   BADGES
   ================================================================ */
.badge {
    display: inline-block;
    border-radius: var(--radius-sm);
    padding: 2px 7px;
    font-size: var(--font-size-micro);
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.4;
}
.badge--discount { background: var(--color-primary); color: #fff; }
.badge--popular  { background: var(--color-primary-light); color: var(--color-primary); }
.badge--new       { background: var(--color-accent-light); color: var(--color-accent); }
.badge--bestseller { background: var(--color-primary); color: #fff; }  /* teal — matches brand; was amber (user request) */

/* ================================================================
   PRODUCT CARD
   Used in: Best Sellers, Top Discounts, brand pages, search results
   ================================================================ */
.product-card {
    background: var(--color-surface);
    border: 0.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: border-color var(--transition);
    text-decoration: none;
    color: inherit;
}
.product-card:hover { border-color: var(--color-primary); }

/* Discount / label badge — absolute top LEFT (heart button stays top-right) */
.product-card__badge {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    z-index: 2;   /* UAT#7 — sit above .product-card__img (OOS img builds a stacking
                     context via grayscale filter, which was hiding the badge) */
}

/* Image container — fixed height, consistent across all cards */
.product-card__img {
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 200px;
    background: var(--color-primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-2);
    overflow: hidden;
    flex-shrink: 0;
}
.product-card__img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: var(--space-2);
}

/* Brand name — uppercase, small */
.product-card__brand {
    font-size: var(--font-size-micro);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 3px;
}

/* Product name — 2 lines max, never overflows */
.product-card__name {
    font-size: var(--font-size-small);
    font-weight: 500;
    color: var(--color-text-primary);
    line-height: 1.35;
    margin-bottom: var(--space-1);
    flex: 1; /* pushes price + button to bottom */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Price row */
.product-card__price {
    display: flex;
    align-items: baseline;
    gap: var(--space-1);
    flex-wrap: nowrap;
    margin-bottom: var(--space-2);
    margin-top: var(--space-1);
}
.product-card__sale { font-size: 15px; font-weight: 600; color: var(--color-text-primary); white-space: nowrap; }
.product-card__mrp  { font-size: var(--font-size-small); color: var(--color-text-muted); text-decoration: line-through; white-space: nowrap; }
.product-card__off  { font-size: var(--font-size-small); color: var(--color-primary); font-weight: 500; white-space: nowrap; }

/* ================================================================
   PRODUCT GRID LAYOUTS
   ================================================================ */

/* 4-column — best sellers */
.product-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-3);
}

/* 5-column — top discounts */
.product-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-3);
}

/* ================================================================
   PRODUCT SLIDER — canonical, single source of truth.
   Used by home, cart, and product-detail rails. Do NOT redefine
   per page (it used to live in home.css/cart.css/product.css with
   drifting widths, which made the same rail look different per page).
   Desktop: 5 cards fill the row, arrows beside the rail.
   Tablet (<=1024): 4 across. Mobile (<=768): touch-scroll, fixed
   168px cards, arrows hidden.
   ================================================================ */
.product-slider-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    max-width: 1440px;
    margin: 0 auto;
}
.product-slider {
    flex: 1;
    display: flex;
    gap: var(--space-3);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.product-slider::-webkit-scrollbar { display: none; }
.product-slider .product-card {
    scroll-snap-align: start;
    flex-shrink: 0;
    min-width: calc((100% - 4 * var(--space-3)) / 5);
    max-width: calc((100% - 4 * var(--space-3)) / 5);
}
.slider-btn {
    width: 36px; height: 36px;
    border-radius: var(--radius-full);
    background: var(--color-surface);
    border: 0.5px solid var(--color-border);
    color: var(--color-text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition),
                border-color var(--transition), opacity var(--transition);
}
.slider-btn:hover:not(:disabled) {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.slider-btn:disabled { opacity: 0.25; cursor: default; }
.slider-btn i { font-size: 18px; pointer-events: none; }
@media (max-width: 1024px) {
    .product-slider .product-card {
        min-width: calc((100% - 3 * var(--space-3)) / 4);
        max-width: calc((100% - 3 * var(--space-3)) / 4);
    }
}
@media (max-width: 768px) {
    .slider-btn { display: none; }            /* touch-scroll on mobile */
    .product-slider-wrap { gap: 0; }
    .product-slider .product-card {
        /* Mobile: 2 full cards + a ~36px peek of the 3rd, to signal it scrolls.
           Container-relative (NOT vw) so the page's side padding is accounted for —
           (100% - one gap) / 2 is exactly two cards filling the slider; shaving 24px
           off each frees 48px, which becomes the 12px gap to the 3rd card + a ~36px
           peek. Matches how the desktop/tablet rules above are sized. */
        min-width: calc((100% - var(--space-3)) / 2 - 24px);
        max-width: calc((100% - var(--space-3)) / 2 - 24px);
    }
    .product-slider .product-card .product-card__img {
        aspect-ratio: 1 / 1; max-height: none;
    }
}

/* ================================================================
   LISTING GRID — paginated product listings (brand, search, list).
   Wraps responsively; never becomes a mobile slider. 5-up default;
   The filtered medicine-list page uses its own .medicine-grid at 4-up.
   ================================================================ */
.listing-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-3);
}
@media (max-width: 1200px) { .listing-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .listing-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 768px)  { .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); } }

/* Horizontal scroll — used on mobile and any page needing a rail */
.product-rail {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: var(--space-1);
}
.product-rail::-webkit-scrollbar { display: none; }
.product-rail .product-card      { min-width: 150px; max-width: 170px; flex-shrink: 0; }

/* ================================================================
   CONCERN CARD (health groups — "What's bothering you?")
   ================================================================ */
.concern-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: var(--space-2);
}

.concern-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-2);
    background: var(--color-surface);
    border: 0.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-decoration: none;
    transition: border-color var(--transition);
    min-height: 120px;
    justify-content: center;
}
.concern-card:hover { border-color: var(--color-primary); }

.concern-card__icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.concern-card__icon i { font-size: 24px; }

.concern-card__label {
    font-size: var(--font-size-small);
    font-weight: 500;
    color: var(--color-text-primary);
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
}
.concern-card__count {
    font-size: var(--font-size-micro);
    color: var(--color-text-secondary);
}

/* Mobile: horizontal scroll rail */
.concern-rail {
    display: flex;
    gap: var(--space-4);
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: var(--space-1);
}
.concern-rail::-webkit-scrollbar { display: none; }
.concern-rail .concern-card {
    min-width: 72px;
    border: none;
    background: transparent;
    padding: 0;
    min-height: auto;
}

/* ================================================================
   BRAND CARD
   ================================================================ */
.brand-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-3);
}

.brand-card {
    background: var(--color-surface);
    border: 0.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-2);
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    transition: border-color var(--transition);
}
.brand-card:hover { border-color: var(--color-primary); }

.brand-card__logo {
    width: 64px; height: 64px;
    border-radius: var(--radius-md);   /* rounded square — logos need corners */
    background: var(--color-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-2);
    overflow: hidden;
    border: 0.5px solid var(--color-border);
}
.brand-card__logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }

.brand-card__name  {
    font-size: var(--font-size-small);
    font-weight: 500;
    color: var(--color-text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.brand-card__count { font-size: var(--font-size-micro); color: var(--color-text-secondary); margin-top: 2px; }

.brand-card--more {
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
}
.brand-card--more i    { font-size: 22px; color: var(--color-primary); }
.brand-card--more span { font-size: var(--font-size-small); color: var(--color-primary); font-weight: 500; }

/* ================================================================
   PRODUCT TYPE CARD (Tailam, Arishtam, Churnam…)
   ================================================================ */
.ptype-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: var(--space-2);
}

.ptype-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-2);
    min-height: 110px;   /* uniform height — fixes the 2-line vs 4-line problem */
    background: var(--color-surface);
    border: 0.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-decoration: none;
    transition: border-color var(--transition);
    justify-content: center;
}
.ptype-card:hover { border-color: var(--color-primary); }

.ptype-card__icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-md);
    background: var(--color-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 0.5px solid var(--color-border);
}
.ptype-card__icon i { font-size: 22px; color: var(--color-primary); }

.ptype-card__name {
    font-size: var(--font-size-small);
    font-weight: 500;
    text-align: center;
    color: var(--color-text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;  /* max 2 lines always */
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ptype-card__sub {
    font-size: var(--font-size-micro);
    color: var(--color-text-secondary);
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 1;  /* max 1 line always */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mobile rail */
.ptype-rail {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: var(--space-1);
}
.ptype-rail::-webkit-scrollbar { display: none; }
.ptype-rail .ptype-card { min-width: 100px; flex-shrink: 0; }

/* ================================================================
   DOSHA / CTA CARD
   ================================================================ */
.dosha-card {
    background: var(--color-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-5);
}
.dosha-card__text h3 { font-size: var(--font-size-card); font-weight: 500; color: #fff; margin-bottom: var(--space-1); }
.dosha-card__text p  { font-size: var(--font-size-small); color: #A8DCDA; line-height: 1.5; }
.dosha-card__right   { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }

.dosha-tag {
    font-size: var(--font-size-small);
    color: #A8DCDA;
    background: rgba(255,255,255,0.12);
    border-radius: var(--radius-full);
    padding: 4px 12px;
    white-space: nowrap;
}

/* ================================================================
   CONSULT BANNER
   ================================================================ */
.consult-card {
    background: #FFFBEB;
    border: 0.5px solid #FDE68A;
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-5);
}
.consult-card__icon {
    width: 60px; height: 60px;
    background: #FEF3C7;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.consult-card__icon i { font-size: 28px; color: var(--color-accent); }
.consult-card__text   { flex: 1; }
.consult-card__text h3 { font-size: var(--font-size-card); font-weight: 500; color: #78350F; margin-bottom: var(--space-1); }
.consult-card__text p  { font-size: var(--font-size-small); color: #92400E; line-height: 1.6; }

/* ================================================================
   RESPONSIVE OVERRIDES FOR COMPONENTS
   ================================================================ */
@media (max-width: 1024px) {
    .product-grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .product-grid-5 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .concern-grid   { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .brand-grid     { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .ptype-grid     { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    /* Product cards go to horizontal rails on mobile */
    .product-grid-4,
    .product-grid-5 {
        display: flex;
        gap: var(--space-2);
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: var(--space-1);
    }
    .product-grid-4::-webkit-scrollbar,
    .product-grid-5::-webkit-scrollbar { display: none; }
    .product-grid-4 .product-card,
    .product-grid-5 .product-card { min-width: 150px; max-width: 165px; flex-shrink: 0; }

    /* Concern grid → rail */
    .concern-grid {
        display: flex;
        gap: var(--space-4);
        overflow-x: auto;
        scrollbar-width: none;
    }
    .concern-grid::-webkit-scrollbar { display: none; }
    .concern-grid .concern-card {
        min-width: 72px;
        border: none;
        background: transparent;
        padding: 0;
        min-height: auto;
        gap: var(--space-1);
    }
    .concern-card__icon { width: 48px; height: 48px; }

    /* Brand grid — 3 col on mobile */
    .brand-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }

    /* Product type → rail on mobile */
    .ptype-grid {
        display: flex;
        gap: var(--space-2);
        overflow-x: auto;
        scrollbar-width: none;
    }
    .ptype-grid::-webkit-scrollbar { display: none; }
    .ptype-grid .ptype-card { min-width: 100px; flex-shrink: 0; }

    /* Dosha card stacks on mobile */
    .dosha-card {
        flex-direction: column;
        align-items: flex-start;
        padding: var(--space-4);
    }
    .dosha-card__right { width: 100%; justify-content: space-between; }

    /* Consult card stacks on mobile */
    .consult-card { flex-direction: column; padding: var(--space-4); }

    /* Buttons — full width on mobile where appropriate */
    .btn--add, .btn--add-accent { min-height: 40px; }

    /* (Mobile slider card sizing now lives in the canonical PRODUCT SLIDER block.) */
}
/* Out-of-stock badge */
.badge--oos {
    background: #FEF2F2;
    color: #DC2626;
    border: 0.5px solid #FECACA;
}

/* Out-of-stock card — subtle visual dimming */
.product-card--oos {
    opacity: 0.80;
}

.product-card--oos .product-card__img {
    filter: grayscale(30%);
}

/* Disabled Add to cart button (OOS state) */
.btn--add:disabled,
.btn--add-accent:disabled {
    background: var(--color-border);
    color: var(--color-text-muted);
    cursor: not-allowed;
    opacity: 1; /* override browser default so our style shows */
}
