:root {
    --accent: #22a45d;
    --accent-hover: #1d8f50;
    --accent-light: #e6f7ee;
    --bg: #f5f6f5;
    --white: #ffffff;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg); color: var(--gray-800); -webkit-font-smoothing: antialiased; }

/* Header */
.shop-header { background: var(--white); border-bottom: 1px solid var(--gray-200); padding: 10px 20px; position: sticky; top: 0; z-index: 50; }
.shop-header-inner { display: flex; align-items: center; gap: 16px; }
.shop-logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.shop-logo-icon { width: 32px; height: 32px; background: var(--accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 11px; }
.shop-logo-text { font-size: 15px; font-weight: 700; color: var(--gray-900); }
.shop-header-search { flex: 1; position: relative; max-width: 400px; }
.shop-header-search input { width: 100%; padding: 9px 14px 9px 36px; border: 1.5px solid var(--gray-200); border-radius: 8px; font-size: 13px; font-family: inherit; background: var(--gray-100); }
.shop-header-search input:focus { outline: none; border-color: var(--accent); background: var(--white); }
.shop-header-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--gray-400); }
.shop-cart-btn { margin-left: auto; position: relative; background: none; border: none; cursor: pointer; padding: 10px; border-radius: 50%; flex-shrink: 0; }
.shop-cart-btn:hover { background: var(--gray-100); }
.shop-cart-btn svg { width: 22px; height: 22px; color: var(--gray-700); }
.shop-cart-badge { position: absolute; top: 2px; right: 2px; background: var(--accent); color: #fff; width: 18px; height: 18px; border-radius: 50%; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--white); }
.shop-cart-badge.bounce { animation: cartBounce 0.4s ease; }
@keyframes cartBounce { 0%{transform:scale(1)} 40%{transform:scale(1.4)} 100%{transform:scale(1)} }

/* Promo Banner */
.promo-banner { position: relative; overflow: hidden; height: 220px; }
.promo-slides { position: relative; height: 100%; }
.promo-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; opacity: 0; transition: opacity 0.6s ease; background: var(--slide-bg); }
.promo-slide.active { opacity: 1; }
.promo-content { padding: 0 40px; max-width: 45%; position: relative; z-index: 3; color: #fff; }
.promo-tag { display: inline-block; background: rgba(255,255,255,0.15); backdrop-filter: blur(4px); padding: 5px 12px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: 1px; margin-bottom: 12px; }
.promo-content h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 8px; line-height: 1.1; }
.promo-content p { font-size: 13px; opacity: 0.75; margin-bottom: 16px; line-height: 1.4; }
.promo-btn { background: #fff; color: var(--gray-900); border: none; padding: 10px 22px; border-radius: 6px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; transition: transform 0.2s, box-shadow 0.2s; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.promo-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.promo-image { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.promo-image img { width: 100%; height: 100%; object-fit: cover; object-position: center right; }
.promo-image::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to right, var(--slide-bg) 15%, transparent 55%); }
.promo-dots { position: absolute; bottom: 14px; left: 40px; display: flex; gap: 6px; z-index: 3; }
.promo-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.35); cursor: pointer; transition: all 0.2s; }
.promo-dot.active { background: #fff; width: 22px; border-radius: 4px; }

/* Layout */
.shop-layout { display: grid; grid-template-columns: 220px 1fr; gap: 0; position: sticky; top: 60px; }

/* Sidebar */
.shop-sidebar { background: var(--white); border-right: 1px solid var(--gray-200); padding: 20px 16px; overflow-y: auto; height: 100%; }
.sidebar-section { margin-bottom: 24px; }
.sidebar-section h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-500); margin-bottom: 10px; }
.cat-list { display: flex; flex-direction: column; gap: 2px; }
.cat-item { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 6px; border: none; background: none; cursor: pointer; font-family: inherit; font-size: 13px; color: var(--gray-700); transition: all 0.15s; width: 100%; text-align: left; }
.cat-item:hover { background: var(--gray-100); }
.cat-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.cat-count { font-size: 11px; color: var(--gray-400); background: var(--gray-100); padding: 2px 7px; border-radius: 10px; }
.cat-item.active .cat-count { background: rgba(34,164,93,0.15); color: var(--accent); }

/* Price Range */
.price-range { display: flex; flex-direction: column; gap: 10px; }
.price-inputs { display: flex; align-items: center; gap: 8px; }
.price-inputs input { width: 70px; padding: 7px 8px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 12px; font-family: inherit; text-align: center; }
.price-inputs input:focus { outline: none; border-color: var(--accent); }
.price-inputs span { color: var(--gray-400); font-size: 12px; }
.price-slider { width: 100%; height: 4px; -webkit-appearance: none; appearance: none; background: var(--gray-200); border-radius: 2px; outline: none; }
.price-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--white); box-shadow: 0 1px 4px rgba(0,0,0,0.2); }
.price-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--gray-400); }
.filter-apply-btn { width: 100%; padding: 8px; background: var(--accent); color: #fff; border: none; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; margin-top: 4px; }
.filter-apply-btn:hover { background: var(--accent-hover); }
.shop-sort { width: 100%; padding: 9px 10px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 12px; font-family: inherit; background: var(--white); }

/* Main Products Area */
.shop-main { padding: 16px; overflow-y: auto; height: 100%; }
.shop-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.shop-results { font-size: 12px; color: var(--gray-500); }
.mobile-filter-btn { display: none; padding: 8px 14px; border: 1px solid var(--gray-200); border-radius: 6px; background: var(--white); font-size: 12px; font-weight: 600; color: var(--gray-600); cursor: pointer; font-family: inherit; gap: 6px; align-items: center; }
.shop-products { display: flex; flex-direction: column; gap: 28px; }

/* Category group section */
.cat-section { }
.cat-section-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cat-section-tag { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px 6px 10px; background: var(--accent-light); border: 1.5px solid rgba(34,164,93,0.25); border-radius: 20px; cursor: pointer; transition: all 0.18s; text-decoration: none; }
.cat-section-tag:hover { background: var(--accent); border-color: var(--accent); }
.cat-section-tag:hover .cat-section-tag-icon,
.cat-section-tag:hover .cat-section-tag-name,
.cat-section-tag:hover .cat-section-tag-count { color: #fff !important; background: rgba(255,255,255,0.18) !important; }
.cat-section-tag-name { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 0.1px; }
.cat-section-tag-count { font-size: 10px; font-weight: 700; color: var(--accent); background: rgba(34,164,93,0.12); padding: 2px 7px; border-radius: 10px; transition: all 0.18s; }
.cat-section-line { flex: 1; height: 1px; background: var(--gray-200); }
.cat-section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.shop-empty { grid-column: 1/-1; text-align: center; padding: 60px 20px; color: var(--gray-400); font-size: 14px; }
.shop-product-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: 10px; overflow: hidden; transition: all 0.2s; }
.shop-product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.shop-product-img { height: 170px; background: var(--gray-100); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.shop-product-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.shop-product-card:hover .shop-product-img img { transform: scale(1.04); }
.shop-product-body { padding: 12px; }
.shop-product-category { font-size: 9.5px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.shop-product-name { font-size: 13px; font-weight: 600; color: var(--gray-800); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-product-price { font-size: 15px; font-weight: 800; color: var(--gray-900); margin-bottom: 6px; }
.shop-product-stock { font-size: 10.5px; color: var(--gray-500); margin-bottom: 10px; }
.shop-add-btn { width: 100%; padding: 9px; background: var(--accent); color: #fff; border: none; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background 0.2s; }
.shop-add-btn:hover { background: var(--accent-hover); }

/* Flying item */
.flying-item { position: fixed; width: 60px; height: 60px; border-radius: 10px; background: var(--white); box-shadow: 0 8px 24px rgba(0,0,0,0.2); z-index: 9999; pointer-events: none; overflow: hidden; transition: all 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); opacity: 1; }
.flying-item img { width: 100%; height: 100%; object-fit: cover; }
.flying-item.fly { opacity: 0; transform: scale(0.3) rotate(20deg); }

/* Cart Drawer */
.cart-drawer-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 10001; display: none; }
.cart-drawer-overlay.open { display: block; }
.cart-drawer { position: fixed; top: 0; right: -400px; width: 400px; max-width: 90vw; height: 100vh; background: var(--white); z-index: 10002; display: flex; flex-direction: column; transition: right 0.3s; box-shadow: -4px 0 20px rgba(0,0,0,0.1); }
.cart-drawer.open { right: 0; }
.cart-drawer-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.cart-drawer-header h3 { font-size: 16px; font-weight: 700; }
.cart-drawer-close { background: none; border: none; cursor: pointer; padding: 6px; border-radius: 6px; }
.cart-drawer-close:hover { background: var(--gray-100); }
.cart-drawer-close svg { width: 18px; height: 18px; color: var(--gray-500); }
.cart-drawer-items { flex: 1; overflow-y: auto; padding: 12px 20px; }
.cart-drawer-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.cart-drawer-item-info { flex: 1; }
.cart-drawer-item-name { font-size: 13px; font-weight: 600; }
.cart-drawer-item-price { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.cart-drawer-item-total { font-size: 13px; font-weight: 700; }
.cart-drawer-footer { padding: 16px 20px 28px; border-top: 1px solid var(--gray-200); background: var(--gray-100); flex-shrink: 0; }
.cart-drawer-total { display: flex; justify-content: space-between; font-size: 17px; font-weight: 800; margin-bottom: 14px; }
.checkout-btn { width: 100%; padding: 12px; background: var(--accent); color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
.checkout-btn:hover { background: var(--accent-hover); }
.checkout-form { margin-top: 14px; display: none; }
.checkout-form.show { display: block; }
.checkout-form label { display: block; font-size: 11px; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; margin-top: 10px; }
.checkout-form input, .checkout-form select { width: 100%; padding: 9px 10px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 12px; font-family: inherit; }

/* In grouped view, per-card category label is redundant — hide it */
.cat-section-grid .shop-product-category { display: none; }
/* But show it again when it's a search/filter flat result */
.cat-section-grid.show-cat .shop-product-category { display: block; }

/* Footer */
.shop-footer { text-align: center; padding: 20px 16px; color: var(--gray-400); font-size: 11px; border-top: 1px solid var(--gray-200); }

/* Sidebar overlay for mobile */
.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 60; display: none; }
.sidebar-overlay.open { display: block; }

/* Responsive */
@media (max-width: 900px) {
    .shop-layout { grid-template-columns: 1fr; height: auto; position: static; }
    .shop-main { overflow-y: visible; height: auto; }
    .shop-sidebar { position: fixed; top: 0; left: -280px; width: 260px; height: 100vh; z-index: 70; transition: left 0.3s; box-shadow: 4px 0 20px rgba(0,0,0,0.1); }
    .shop-sidebar.open { left: 0; }
    .mobile-filter-btn { display: flex; }
    .promo-banner { height: 180px; }
    .promo-content { padding: 0 24px; }
    .promo-content h2 { font-size: 20px; }
}

@media (max-width: 600px) {
    .shop-header { padding: 8px 12px; }
    .shop-header-search { max-width: none; }
    .shop-logo-text { display: none; }
    .shop-products { gap: 20px; }
    .cat-section-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .shop-product-img { height: 130px; }
    .shop-product-body { padding: 10px; }
    .shop-product-name { font-size: 12px; }
    .shop-product-price { font-size: 13px; }
    .shop-add-btn { padding: 8px; font-size: 11px; }
    .shop-main { padding: 12px; }
    .promo-banner { height: 200px; }
    .promo-content { max-width: 55%; padding: 0 20px; }
    .promo-content h2 { font-size: 18px; }
    .promo-content p { font-size: 11px; }
    .promo-tag { font-size: 9px; padding: 3px 8px; }
    .promo-btn { padding: 7px 14px; font-size: 11px; }
    .promo-dots { left: 20px; }
}

@media (max-width: 400px) {
    .shop-product-img { height: 110px; }
    .shop-product-body { padding: 8px; }
    .shop-product-category { font-size: 9px; }
    .shop-product-name { font-size: 11px; }
    .shop-product-price { font-size: 12px; margin-bottom: 4px; }
    .shop-product-stock { display: none; }
    .promo-content { max-width: 70%; }
    .promo-content h2 { font-size: 16px; }
}

/* Product Detail Modal */
.product-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); backdrop-filter: blur(3px); z-index: 10100; display: none; align-items: center; justify-content: center; padding: 20px; }
.product-modal-overlay.open { display: flex; }
.product-modal { background: var(--white); border-radius: 16px; max-width: 860px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; animation: modalSlideUp 0.3s ease; }
@keyframes modalSlideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.product-modal-close { position: absolute; top: 16px; right: 16px; background: var(--white); border: 1px solid var(--gray-200); border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 5; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.product-modal-close:hover { background: var(--gray-100); }
.product-modal-close svg { width: 18px; height: 18px; color: var(--gray-600); }
.product-modal-grid { display: grid; grid-template-columns: 1fr 1fr; }
.product-modal-image { background: var(--gray-100); overflow: hidden; min-height: 400px; }
.product-modal-image img { width: 100%; height: 100%; object-fit: cover; }
.product-modal-info { padding: 32px; display: flex; flex-direction: column; gap: 4px; }
.pm-category { font-size: 11px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.8px; }
.pm-name { font-size: 22px; font-weight: 800; color: var(--gray-900); letter-spacing: -0.5px; margin: 6px 0; }
.pm-price { font-size: 24px; font-weight: 800; color: var(--gray-900); margin-bottom: 8px; }
.pm-description { font-size: 13px; color: var(--gray-600); line-height: 1.6; margin-bottom: 16px; }
.pm-section { margin-bottom: 16px; }
.pm-section h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-500); margin-bottom: 8px; }
.pm-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-color-tag { padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); cursor: pointer; transition: all 0.15s; }
.pm-sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.pm-size-tag { padding: 8px 16px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--white); color: var(--gray-700); border: 1.5px solid var(--gray-200); cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.pm-size-tag:hover { border-color: var(--accent); color: var(--accent); }
.pm-details-grid { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; padding: 16px; background: var(--gray-100); border-radius: 10px; }
.pm-detail-item { display: flex; align-items: flex-start; gap: 10px; }
.pm-detail-item svg { flex-shrink: 0; color: var(--accent); margin-top: 2px; }
.pm-detail-item div { display: flex; flex-direction: column; }
.pm-detail-item strong { font-size: 12px; font-weight: 600; color: var(--gray-800); margin-bottom: 2px; }
.pm-detail-item span { font-size: 12px; color: var(--gray-500); line-height: 1.4; }
.pm-stock { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 16px; }
.pm-add-btn { width: 100%; padding: 14px; background: var(--accent); color: #fff; border: none; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit; transition: background 0.2s; }
.pm-add-btn:hover { background: var(--accent-hover); }

@media (max-width: 700px) {
    .product-modal-grid { grid-template-columns: 1fr; }
    .product-modal-image-section { border-radius: 16px 16px 0 0; }
    .product-modal-image { min-height: 250px; border-radius: 0; }
    .product-modal-info { padding: 20px; }
    .pm-name { font-size: 18px; }
    .pm-price { font-size: 20px; }
    .product-modal-overlay { padding: 10px; }
    .product-modal { max-height: 95vh; }
}

/* Product Modal - Interactive selections */
.pm-color-tag.selected { background: var(--accent-light); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.pm-size-tag.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.pm-qty { display: flex; align-items: center; gap: 14px; }
.pm-qty-btn { width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--gray-200); background: var(--white); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; font-weight: 600; color: var(--gray-700); transition: all 0.15s; font-family: inherit; }
.pm-qty-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.pm-qty span, #modalQty { font-size: 18px; font-weight: 700; color: var(--gray-900); min-width: 24px; text-align: center; }


/* ===== PRODUCT MODAL IMAGE GALLERY ===== */
.product-modal-image-section {
    display: flex;
    flex-direction: column;
    background: var(--gray-100);
    border-radius: 16px 0 0 16px;
    overflow: hidden;
}

.product-modal-image-section .product-modal-image {
    flex: 1;
    min-height: 350px;
    position: relative;
    overflow: hidden;
    border-radius: 0;
}

.product-modal-image-section .product-modal-image img {
    transition: opacity 0.15s ease;
}

/* Thumbnail strip */
.pm-gallery-thumbs {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pm-thumb {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--gray-200);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
    opacity: 0.6;
}

.pm-thumb:hover {
    opacity: 1;
    border-color: var(--gray-400);
}

.pm-thumb.active {
    border-color: var(--accent);
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(34, 164, 93, 0.2);
}

.pm-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Zoom overlay */
.pm-zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: fadeIn 0.2s ease;
    padding: 20px;
}

.pm-zoom-overlay img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.pm-zoom-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.pm-zoom-close:hover {
    background: rgba(255,255,255,0.3);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive gallery */
@media (max-width: 700px) {
    .product-modal-image-section {
        border-radius: 16px 16px 0 0;
    }

    .product-modal-image-section .product-modal-image {
        min-height: 220px;
    }

    .pm-gallery-thumbs {
        padding: 8px 10px;
    }

    .pm-thumb {
        width: 44px;
        height: 44px;
    }

    .pm-zoom-overlay img {
        max-width: 95%;
    }
}

/* ===== CHAT WIDGET ===== */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    font-family: 'Inter', sans-serif;
}

/* FAB Button */
.chat-fab {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: transform 0.2s;
    position: relative;
    overflow: visible;
    animation: fabPulse 4s ease-in-out infinite;
}

.chat-fab:hover {
    transform: scale(1.06);
    box-shadow: none;
    animation: none;
}

@keyframes fabPulse {
    0%, 80%, 100% { transform: scale(1); }
    85% { transform: scale(1.05); }
    90% { transform: scale(0.98); }
}

.chat-agent-icon { width: 80px; height: 80px; }
.chat-agent-icon svg { width: 100%; height: 100%; }
.chat-agent-icon lottie-player { width: 80px !important; height: 80px !important; }

.chat-fab svg.chat-fab-close { width: 20px; height: 20px; color: #6b7280; }

.chat-fab-icon { display: block; }
.chat-fab-close { display: none; }
.chat-widget.open .chat-fab-icon { display: none; }
.chat-widget.open .chat-fab-close { display: block; }
.chat-widget.open .chat-fab-label { display: none; }
.chat-widget.open .chat-fab { animation: none; background: transparent; border: none; }

.chat-fab-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 18px;
    height: 18px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.chat-fab-label {
    position: absolute;
    bottom: 26px;
    right: 88px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    padding: 9px 14px;
    border-radius: 8px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.08);
    border: 1px solid #f3f4f6;
    white-space: nowrap;
    pointer-events: none;
    animation: labelShow 10s ease infinite;
}

.chat-fab-label::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #fff;
}

@keyframes labelShow {
    0%, 65%, 100% { opacity: 1; }
    72%, 92% { opacity: 0; }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: 340px;
    max-width: calc(100vw - 32px);
    height: 470px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-widget.open .chat-window {
    display: flex;
    animation: chatOpen 0.2s ease;
}

@keyframes chatOpen {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #f3f4f6;
    background: #fff;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header-avatar lottie-player {
    width: 38px !important;
    height: 38px !important;
}

.chat-header-avatar svg,
.chat-header-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.chat-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #fff;
}

.chat-header-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.chat-header-status {
    font-size: 11px;
    color: #9ca3af;
}

.chat-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.chat-close-btn:hover { opacity: 1; }
.chat-close-btn svg { width: 20px; height: 20px; color: #6b7280; }

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #fafbfc;
}

/* Welcome message */
.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.chat-welcome-text {
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 11px 14px;
    border-radius: 0 12px 12px 12px;
    font-size: 13.5px;
    line-height: 1.5;
    color: #374151;
    max-width: 85%;
}

.chat-welcome-time {
    font-size: 10px;
    color: #9ca3af;
    margin-left: 4px;
}

/* Message bubbles */
.chat-msg { max-width: 85%; }
.chat-msg.user { align-self: flex-end; text-align: right; }
.chat-msg.bot { align-self: flex-start; }

.chat-msg-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-msg-avatar-sm {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    background: #10b981;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-msg-bubble {
    padding: 10px 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-msg.user .chat-msg-bubble {
    background: #1f2937;
    color: #fff;
    border-radius: 12px 12px 0 12px;
}

.chat-msg.bot .chat-msg-bubble {
    background: #fff;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 0 12px 12px 12px;
}

.chat-msg-bubble .chat-product-link {
    color: #22a45d;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 0.15s;
}

.chat-msg-bubble .chat-product-link:hover {
    color: #16803c;
    text-decoration-style: solid;
}

.chat-msg-time {
    font-size: 10px;
    color: #9ca3af;
    display: block;
    margin-top: 4px;
}

/* Typing */
.chat-msg-bubble.typing {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0 12px 12px 12px;
}

.chat-msg-bubble.typing span {
    width: 6px;
    height: 6px;
    background: #d1d5db;
    border-radius: 50%;
    animation: typing 1s infinite;
}

.chat-msg-bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-msg-bubble.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-3px); opacity: 1; }
}

/* Suggestions */
.chat-suggestions {
    display: flex;
    gap: 6px;
    padding: 8px 16px 4px;
    flex-wrap: wrap;
    background: #fafbfc;
    border-top: 1px solid #f3f4f6;
}

.chat-suggestions button {
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #374151;
    font-size: 12px;
    font-weight: 500;
    padding: 7px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s;
}

.chat-suggestions button:hover {
    border-color: #9ca3af;
}

/* Input */
.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.chat-input-area input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    background: #fafbfc;
}

.chat-input-area input:focus {
    border-color: #9ca3af;
    background: #fff;
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #1f2937;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.chat-send-btn:hover { background: #374151; }
.chat-send-btn svg { width: 16px; height: 16px; color: #fff; }

/* Footer */
.chat-footer {
    text-align: center;
    padding: 8px 14px;
    background: #fff;
    border-top: 1px solid #f3f4f6;
}

.chat-whatsapp-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #25d366;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 14px;
    transition: background 0.15s;
}

.chat-whatsapp-link:hover {
    background: #f0fdf4;
}

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 100px);
        bottom: 72px;
        right: -16px;
    }
    .chat-widget { bottom: 16px; right: 16px; }
    .chat-fab-label { display: none; }
}
