/**
 * File: shop-style.css
 * Description: UI Enhancement - Fully Responsive Grid & Layout for PC, TAB, and Mobile with Responsive Popup.
 * Version: 28.0 (Fixed PC Popup Visibility)
 */

:root {
    --rahi-green: #10b981;
    --rahi-green-bg: #f0fdf4;
    --rahi-bg: #f8fafc; 
    --rahi-text-main: #1e293b;
    --rahi-text-muted: #64748b;
    --rahi-border: #f1f5f9;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--rahi-bg);
    margin: 0;
    font-family: 'Inter', -apple-system, sans-serif;
    overflow-x: hidden;
    width: 100%;
}

#main-app-wrapper { 
    display: flex; 
    height: 100vh; 
    background: var(--rahi-bg); 
    overflow: hidden;
    width: 100vw;
}

.app-sidebar { 
    width: 65px; 
    background: #fff; 
    border-right: 1px solid #e2e8f0; 
    overflow-y: auto; 
    scrollbar-width: none; 
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .app-sidebar { width: 60px; }
}

.cat-item { padding: 12px 2px; text-align: center; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.cat-item.active { background: var(--rahi-green-bg); border-left: 4px solid var(--rahi-green); }
.cat-item span { font-size: 9px; font-weight: 700; display: block; margin-top: 4px; line-height: 1.1; }

.app-content { 
    flex: 1; 
    overflow-y: auto; 
    overflow-x: hidden;
    padding: 8px; 
    padding-bottom: 120px; 
    background: var(--rahi-bg); 
    -webkit-overflow-scrolling: touch;
}

.product-grid { 
    display: grid; 
    gap: 8px; 
    width: 100%;
}

@media (max-width: 480px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
}

.app-product-card { 
    background: #fff; 
    border: 1px solid rgba(0,0,0,0.05); 
    border-radius: 12px; 
    padding: 8px; 
    position: relative; 
    display: flex; 
    flex-direction: column; 
    height: 100%; 
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.discount-badge {
    position: absolute; top: 0; left: 0; background: #2563eb; color: #fff;
    font-size: 9px; font-weight: 900; padding: 3px 5px; border-radius: 8px 0 8px 0; z-index: 5;
}

.prod-img-container {
    width: 100%; height: 90px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.prod-img { max-width: 100%; max-height: 100%; object-fit: contain; }

.eta-pill {
    font-size: 8px; font-weight: 800; color: #9a3412; background: #fff7ed;
    padding: 2px 5px; border-radius: 4px; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 4px 0;
}

.prod-title { 
    font-size: 11px; font-weight: 600; color: #1f2937; line-height: 1.2;
    height: 28px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.prod-meta { font-size: 10px; color: #6b7280; margin: 2px 0; font-weight: 500; }

.price-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-top: auto; 
    padding-top: 5px;
}

.price-info { 
    display: flex; 
    flex-direction: column; 
    flex: 1; 
    min-width: 0;
}

.prod-price { font-size: 13px; font-weight: 800; color: #000; line-height: 1.1; }
.old-price { font-size: 9px; text-decoration: line-through; color: #9ca3af; margin-top: 2px; }

.savings-tag-premium {
    font-size: 8px; background: #ef4444; color: #fff; padding: 1px 4px; border-radius: 3px;
    font-weight: 800; display: inline-block; text-transform: uppercase; margin-bottom: 3px;
}
.rahi-pulse { animation: rahiPulse 2s infinite ease-in-out; }
@keyframes rahiPulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

/* Long Bottom Button UI Reset */
.add-to-cart-container.full-width-btn { 
    width: 100%; 
    height: 34px; 
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-btn-init { 
    width: 100%; height: 100%; background: #fff; color: var(--rahi-green); 
    border: 1.5px solid var(--rahi-green); border-radius: 8px; 
    font-weight: 800; font-size: 11px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

.qty-btn-box { 
    width: 100%; height: 100%; display: flex; align-items: center; 
    justify-content: space-between; background: var(--rahi-green); 
    border-radius: 8px; padding: 0 4px;
}

.qty-btn { background: none; border: none; color: #fff; width: 18px; font-weight: 900; font-size: 15px; cursor: pointer; }
.qty-val { font-size: 12px; font-weight: 900; color: #fff; }

/* --- RESPONSIVE POPUP FIX FOR PC --- */
.sheet-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    background: rgba(0, 0, 0, 0.6); 
    z-index: 999998; 
    display: none; 
    backdrop-filter: blur(4px); 
}

#variant-sheet, .rahi-bottom-sheet { 
    position: fixed; 
    left: 0; 
    right: 0; 
    bottom: -100%; 
    width: 100%; 
    max-width: 500px; 
    margin: 0 auto; 
    background: #fff; 
    z-index: 999999; 
    border-radius: 24px 24px 0 0; 
    overflow: hidden; 
    display: none; 
    box-shadow: 0 -10px 40px rgba(0,0,0,0.2); 
    transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); 
}

#rahi-sticky-cart {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: var(--rahi-green);
    color: #fff;
    padding: 12px 20px;
    border-radius: 12px;
    display: none; /* JS will handle this */
    justify-content: space-between;
    align-items: center;
    z-index: 999999;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

/* PC Specific Fix */
@media screen and (min-width: 768px) {
    #variant-sheet, .rahi-bottom-sheet {
        bottom: auto;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.9); /* Center align on PC */
        border-radius: 24px;
        opacity: 0;
        display: none;
    }
    
    #variant-sheet.active, .rahi-bottom-sheet.active {
        display: block !important;
        opacity: 1 !important;
        transform: translate(-50%, -50%) scale(1) !important; /* Proper active state visibility */
    }
}

/* Mobile Alignment remains bottom sheet */
@media screen and (max-width: 767px) {
    #variant-sheet, .rahi-bottom-sheet {
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        bottom: -100%; 
    }
}

