/* =====================================================================
 * Components
 *
 * Everything introduced with pagination, filters, the PWA shell and the
 * Kuwait checkout. Kept separate from style.css so the original theme
 * rules stay readable.
 * ===================================================================== */

:root {
    /* Point the older component rules at the design-system tokens in
       style.css so there is only one palette to change. */
    --brand-1: var(--gold, #b48a3f);
    --brand-2: var(--ink, #14110f);
    /* Height of the fixed mobile nav, used to pad the bottom of the page */
    --mobile-nav-h: 62px;
}

/* Keyboard users need a way past the navigation */
/* Parked above the viewport rather than off to the side: a negative `left`
   scrolls the page sideways in the Arabic (RTL) layout. */
.skip-link {
    position: absolute;
    inset-inline-start: 0;
    top: -100px;
    z-index: 2000;
    padding: .75rem 1.25rem;
    background: #fff;
    border-radius: 0 0 var(--radius) 0;
    box-shadow: var(--shadow-md);
    transition: top .15s ease;
}
.skip-link:focus { top: 0; }

.announcement-bar {
    background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
    color: #fff;
    font-size: .85rem;
    padding: .45rem 0;
}

.site-header {
    background: #fff;
    box-shadow: var(--shadow-sm);
}

/* ---------- Header search ---------- */

.header-search {
    position: relative;
    display: flex;
    min-width: 200px;
}
.header-search .form-control {
    border-radius: 999px 0 0 999px;
    border-right: 0;
}
.header-search .btn {
    border: 1px solid #dee2e6;
    border-left: 0;
    border-radius: 0 999px 999px 0;
    background: #fff;
}
.search-suggest {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: 60vh;
    overflow-y: auto;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}
.search-suggest a {
    display: flex;
    gap: .65rem;
    align-items: center;
    padding: .55rem .75rem;
    color: inherit;
    border-bottom: 1px solid #f1eff6;
}
.search-suggest a:last-child { border-bottom: 0; }
.search-suggest a:hover { background: #faf9fd; }
.search-suggest img {
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.cart-badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: .68rem;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: #dc3545;
    border-radius: 999px;
}
.cart-badge--nav { top: 4px; right: 22%; }

/* ---------- Product card ---------- */

.product-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}
.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.product-card__media {
    aspect-ratio: 1 / 1;
    background: #f7f5fb;
    overflow: hidden;
}
.product-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.product-card__badges {
    position: absolute;
    top: .5rem;
    left: .5rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    align-items: flex-start;
}
.product-card__badges .badge { font-size: .68rem; }
.product-card__wish {
    position: absolute;
    top: .5rem;
    right: .5rem;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: #6c757d;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}
.product-card__wish:hover,
.product-card__wish.is-active { color: #dc3545; }
.product-card__wish.is-active i { font-weight: 900; }
.product-card__body { padding: .75rem; }
.product-card__meta {
    font-size: .74rem;
    color: #6c757d;
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}
.product-card__rating { font-size: .75rem; color: #f0a500; }
.product-brand {
    font-size: .7rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #6c757d;
}
.product-title {
    font-size: .92rem;
    font-weight: 600;
    margin: .15rem 0 .3rem;
    line-height: 1.35;
    /* Clamp to two lines so every card in a row is the same height */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-title a { color: inherit; }
.product-price { font-weight: 700; color: var(--brand-1); }
.original-price {
    font-weight: 400;
    font-size: .82em;
    color: #6c757d;
    text-decoration: line-through;
    margin-left: .35rem;
}

/* ---------- Filters ---------- */

.filter-group {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eeecf3;
}
.filter-group:last-of-type { border-bottom: 0; }
.filter-group__title {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #6c757d;
    margin-bottom: .5rem;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    padding: .3rem .7rem;
    font-size: .8rem;
    color: #3d3355;
    background: #f2effa;
    border-radius: 999px;
    border: 1px solid #e3ddf5;
}
.filter-chip:hover { background: #e7e1f8; color: #3d3355; }
.filter-chip--clear { background: transparent; border-style: dashed; }

@media (min-width: 992px) {
    .offcanvas-lg .offcanvas-body { padding: 0; }
}

.search-hero { max-width: 720px; margin-inline: auto; }

/* ---------- Checkout ---------- */

.payment-option {
    display: flex;
    gap: .75rem;
    align-items: center;
    width: 100%;
    padding: .85rem 1rem;
    margin-bottom: .5rem;
    border: 2px solid #e9e6f2;
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.payment-option:hover { background: #faf9fd; }
.payment-option.is-selected {
    border-color: var(--brand-1);
    background: #f7f4fe;
}
.payment-option input { accent-color: var(--brand-1); }
.payment-option i {
    font-size: 1.15rem;
    color: var(--brand-1);
    width: 22px;
    text-align: center;
}

.checkout-summary { position: sticky; top: 90px; }
.checkout-items {
    max-height: 260px;
    overflow-y: auto;
    display: grid;
    gap: .6rem;
}

.checkout-totals {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .35rem 1rem;
    margin: 0;
    font-size: .92rem;
}
.checkout-totals dt { font-weight: 400; color: #6c757d; }
.checkout-totals dd { margin: 0; text-align: right; }
.checkout-totals .total {
    padding-top: .5rem;
    margin-top: .25rem;
    border-top: 1px solid #eeecf3;
    font-size: 1.1rem;
    font-weight: 700;
    color: #212529;
}

.form-label.required::after { content: " *"; color: #dc3545; }

/* ---------- Order confirmation ---------- */

.order-success__tick {
    width: 72px;
    height: 72px;
    margin-inline: auto;
    display: grid;
    place-items: center;
    font-size: 1.9rem;
    color: #fff;
    background: linear-gradient(135deg, #24b47e, #12805c);
    border-radius: 50%;
    animation: pop .35s ease;
}
@keyframes pop {
    from { transform: scale(.4); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.order-progress {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-x: auto;
}
.order-progress__step {
    position: relative;
    flex: 1 0 auto;
    min-width: 92px;
    text-align: center;
    font-size: .74rem;
    color: #6c757d;
}
/* Connecting line sits behind the dots */
.order-progress__step::before {
    content: "";
    position: absolute;
    top: 13px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: #e6e2f0;
    z-index: 0;
}
.order-progress__step:first-child::before { display: none; }
.order-progress__step.is-done::before,
.order-progress__step.is-current::before { background: var(--brand-1); }
.order-progress__dot {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin: 0 auto .35rem;
    font-size: .7rem;
    color: #fff;
    background: #e6e2f0;
    border-radius: 50%;
}
.order-progress__step.is-done .order-progress__dot { background: #24b47e; }
.order-progress__step.is-current .order-progress__dot {
    background: var(--brand-1);
    box-shadow: 0 0 0 4px rgba(106, 17, 203, .18);
}
.order-progress__step.is-current .order-progress__label {
    color: var(--brand-1);
    font-weight: 600;
}

/* ---------- CMS pages ---------- */

.cms-page { font-size: 1.02rem; line-height: 1.85; }
.cms-page h2 { margin-top: 2rem; font-size: 1.4rem; }
.cms-page h3 { margin-top: 1.5rem; font-size: 1.15rem; }
.cms-page img { max-width: 100%; height: auto; border-radius: var(--radius); }
.cms-page table { width: 100%; margin: 1.25rem 0; }
.cms-page table th,
.cms-page table td { padding: .5rem .75rem; border: 1px solid #e6e2f0; }

/* ---------- Footer ---------- */

.site-footer { background: #14101f; color: #cfc9dd; }
.footer-heading {
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: .85rem;
}
.footer-text { color: #a49cb8; font-size: .9rem; }
.footer-links a,
.footer-contact a { color: #cfc9dd; font-size: .9rem; }
.footer-links li { margin-bottom: .45rem; }
.footer-links a:hover,
.footer-contact a:hover { color: #fff; }
.footer-contact li {
    display: flex;
    gap: .55rem;
    align-items: flex-start;
    margin-bottom: .45rem;
    font-size: .9rem;
}
.footer-contact i { margin-top: .28rem; color: var(--brand-2); }
.footer-social a {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-right: .4rem;
    color: #fff;
    background: rgba(255, 255, 255, .1);
    border-radius: 50%;
}
.footer-social a:hover { background: var(--brand-1); }
.pay-chip {
    display: inline-block;
    padding: .25rem .6rem;
    margin: 0 .3rem .3rem 0;
    font-size: .72rem;
    font-weight: 600;
    color: #14101f;
    background: #fff;
    border-radius: 6px;
}

/* ---------- Mobile bottom navigation ---------- */

.mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    background: #fff;
    border-top: 1px solid #eeecf3;
    /* Clear the iPhone home indicator */
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 12px rgba(16, 12, 40, .07);
}
.mobile-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    /* 56px keeps every target comfortably thumb-sized */
    min-height: 56px;
    padding: .35rem 0;
    font-size: .68rem;
    color: #6c757d;
}
.mobile-nav__item i { font-size: 1.05rem; }
.mobile-nav__item:hover,
.mobile-nav__item.is-active { color: var(--brand-1); }

@media (max-width: 991.98px) {
    body { padding-bottom: var(--mobile-nav-h); }
    .whatsapp-float { bottom: calc(var(--mobile-nav-h) + 12px); }
}

/* ---------- Toast ---------- */

.app-toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--mobile-nav-h) + 20px);
    transform: translateX(-50%) translateY(12px);
    z-index: 1080;
    max-width: 92vw;
    padding: .7rem 1.1rem;
    font-size: .9rem;
    color: #fff;
    background: #22143b;
    border-radius: 999px;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}
.app-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.app-toast--error { background: #a11b2e; }
.app-toast--success { background: #12805c; }

@media (min-width: 992px) {
    .app-toast { bottom: 24px; }
}

/* ---------- Admin tables on small screens ---------- */

@media (max-width: 575.98px) {
    .admin-table thead { display: none; }
    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td { display: block; width: 100%; }
    .admin-table tr {
        margin-bottom: .75rem;
        padding: .5rem;
        border: 1px solid #eeecf3;
        border-radius: var(--radius);
    }
    .admin-table td { border: 0; padding: .3rem .5rem; }
    .admin-table td.text-end { text-align: left !important; }
}

.min-w-0 { min-width: 0; }
.object-fit-cover { object-fit: cover; }

/* Respect users who ask for reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

@media print {
    .site-header, .site-footer, .mobile-nav, .whatsapp-float,
    .announcement-bar, .btn, .breadcrumb { display: none !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}
