/* ============================================
   SHOPFLY CATALOG — Mobile-first, optimized for slow connections
   ============================================ */

:root {
    --primary: #25D366;
    --primary-dark: #1da851;
    --primary-light: #e8f8ee;
    --dark: #0f172a;
    --gray: #64748b;
    --gray-light: #f1f5f9;
    --gray-200: #e2e8f0;
    --white: #ffffff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--gray-light);
    color: var(--dark);
    line-height: 1.5;
    padding-bottom: 80px;
}

/* ---- HEADER ---- */
.catalog-header {
    background: var(--white);
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.shop-logo {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    overflow: hidden;
}

.shop-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-left h1 {
    font-size: 1.1rem;
    font-weight: 700;
}

.header-left p {
    font-size: 0.8rem;
    color: var(--gray);
}

.wa-btn-header {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: all 0.3s;
}

.wa-btn-header:hover { background: var(--primary-dark); }

/* ---- SEARCH ---- */
.search-section {
    max-width: 800px;
    margin: 16px auto;
    padding: 0 16px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 2px solid var(--gray-200);
    margin-bottom: 12px;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 50px;
    background: var(--white);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
    font-family: inherit;
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ---- PRODUCTS GRID ---- */
.products-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    position: relative;
}

.product-card:active { transform: scale(0.98); }

.product-img {
    width: 100%;
    height: 150px;
    background: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    overflow: hidden;
    position: relative;
}

.product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.9);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.fav-btn.active { background: #fee2e2; }

.product-info {
    padding: 12px;
}

.product-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.product-desc {
    font-size: 0.75rem;
    color: var(--gray);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-actions {
    display: flex;
    gap: 6px;
}

.product-actions button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-wa {
    background: var(--primary);
    color: white;
}
.btn-wa:hover { background: var(--primary-dark); }

.btn-cart {
    background: var(--gray-light);
    color: var(--dark);
}
.btn-cart:hover { background: var(--gray-200); }

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }

/* ---- FLOATING CART ---- */
.floating-cart {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 200;
}

.cart-btn {
    width: 56px;
    height: 56px;
    background: var(--dark);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    position: relative;
    transition: all 0.3s;
}

.cart-btn:hover { transform: scale(1.1); }

.cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--primary);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- CART PANEL ---- */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    display: none;
}

.cart-overlay.active { display: block; }

.cart-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    z-index: 301;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.cart-panel.active { transform: translateY(0); }

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--gray-light);
}

.cart-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--gray);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-light);
}

.cart-item-img {
    width: 60px;
    height: 60px;
    background: var(--gray-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info { flex: 1; }
.cart-item-info h4 { font-size: 0.9rem; margin-bottom: 4px; }
.cart-item-info .price { color: var(--primary-dark); font-weight: 700; font-size: 0.85rem; }

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.cart-item-qty button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--white);
    cursor: pointer;
    font-weight: 700;
}

.cart-item-remove {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    font-size: 1.1rem;
    align-self: flex-start;
}

.empty-cart {
    text-align: center;
    padding: 40px 0;
    color: var(--gray);
}

.cart-footer {
    padding: 20px;
    border-top: 1px solid var(--gray-light);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 16px;
}

/* ---- WHATSAPP FLOATING ---- */
.wa-float {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    transition: all 0.3s;
}

.wa-float:hover { transform: scale(1.1); }

/* ---- RESPONSIVE ---- */
@media (min-width: 600px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 900px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}