/**
 * Storefront layout core — Phase 1 (STOREFRONT_MODERNIZATION_PHASE_PLAN).
 * Global primitives previously inline in resources/views/storefront/layout.blade.php.
 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--fg);
    line-height: 1.5;
    background: var(--sf-page-bg);
    font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[lang="ar"] body {
    font-family: "Cairo", "Public Sans", system-ui, sans-serif;
}

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

a:hover {
    color: var(--sf-brand-hover);
    text-decoration: underline;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.25rem;
}

.card {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #f1f5f9;
}

.card-body {
    padding: 0.5rem 0.58rem;
    font-size: 0.82rem;
}

.price {
    color: var(--muted);
    font-size: 0.74rem;
}

.cats {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
}

.cats > li {
    margin-bottom: 0.35rem;
}

.cats ul {
    list-style: none;
    padding-inline-start: 1rem;
    margin: 0.25rem 0;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.pagination a,
.pagination span {
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.product-hero {
    max-width: 420px;
    margin: 0 auto 1.5rem;
}

.product-hero img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.thumbs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.thumbs img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.btn {
    display: inline-block;
    padding: 0.45rem 0.85rem;
    background: var(--sf-btn-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
}

.card .btn {
    padding: 0.34rem 0.58rem;
    border-radius: 5px;
    font-size: 0.72rem;
}

/* Mobile-first shop/product cards */
@media (max-width: 359px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .card-body {
        padding: 0.58rem 0.62rem;
        font-size: 0.86rem;
    }

    .price {
        font-size: 0.76rem;
    }

    .card .btn {
        font-size: 0.72rem;
        padding: 0.4rem 0.58rem;
        min-height: 34px;
    }
}

@media (min-width: 360px) and (max-width: 639px) {
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.85rem;
    }

    .card-body {
        padding: 0.52rem 0.56rem;
        font-size: 0.8rem;
    }

    .price {
        font-size: 0.72rem;
    }

    .card .btn {
        font-size: 0.68rem;
        padding: 0.34rem 0.5rem;
        min-height: 32px;
    }
}

.btn:hover {
    background: var(--sf-btn-primary-hover);
    text-decoration: none;
    color: #fff;
}

.flash {
    padding: 0.65rem 0.85rem;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Phase 6 — post–add-to-cart (layout, non-cart pages) */
.flash--success {
    background: #ecfdf5;
    border-color: #34d399;
    color: #065f46;
    font-weight: 500;
}
