/* ROOT VARIABLES FOR APP-WIDE COLORS */
:root {
    --primary: #0F172A;
    --green-light: #ffffff; /* White background for the card */
    --error: #EF4444;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --white: #FFFFFF;
}

/* =========================================
   MODERN APPAREL CATALOG UI CSS
========================================= */
#catalog-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; }
.product-card { background: var(--green-light); border-radius: 12px; overflow: hidden; border: 1px solid #E2E8F0; box-shadow: 0 4px 15px rgba(0,0,0,0.03); display: flex; flex-direction: column; position: relative; transition: transform 0.2s ease, box-shadow 0.2s ease; height: auto; }
.product-card:active { transform: scale(0.98); box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
.img-carousel-container { position: relative; width: 100%; aspect-ratio: 3.5/4; background: linear-gradient(180deg,#F4E1E1,#FDF2F2); border-bottom: 1px solid #F1F5F9; border-radius: 20px 20px 0 0; overflow: hidden; }
.img-carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; width: 100%; height: 100%; scrollbar-width: none; -webkit-overflow-scrolling: touch; cursor: pointer; justify-content: flex-start; }
.img-carousel::-webkit-scrollbar { display: none; }
.carousel-slide { min-width: 100%; height: 100%; scroll-snap-align: start; display: flex; justify-content: center; align-items: center; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; object-fit: contain; }
.carousel-dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; pointer-events: none; }
.carousel-dot { width: 12px; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.5); backdrop-filter: blur(2px); transition: all 0.3s; }
.carousel-dot.active { background: var(--primary); width: 18px; }

.stock-badge { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 4px; background: rgba(59,130,246,0.12); color: #2563EB; border: 1px solid rgba(59,130,246,0.18); padding: 4px 10px; border-radius: 999px; font-size: 10px; font-weight: 700; backdrop-filter: blur(8px); box-shadow: 0 4px 10px rgba(0,0,0,0.04); letter-spacing: 0.3px; z-index: 2; }
.stock-badge.low-stock { color: var(--error); background: #FEF2F2; border-color: rgba(239, 68, 68, 0.2); }
.discount-badge { position: absolute; top: 0; right: 10px; width: 22px; background: linear-gradient(180deg,#FEF9C3,#FECACA); color: #92400E; font-size: 8px; font-weight: 800; text-align: center; padding: 6px 2px 10px; line-height: 10px; border-radius: 0 0 4px 4px; box-shadow: 0 4px 10px rgba(251,191,36,.22); z-index: 5; }
.discount-badge::after { content: ''; position: absolute; bottom: -6px; left: 0; width: 100%; height: 6px; background: #FECACA; clip-path: polygon(0 0, 50% 100%, 100% 0); }

.product-info { padding: 6px; display: flex; flex-direction: column; gap: 1px; flex-grow: 1; justify-content: flex-start; }
.product-header { display: flex; flex-direction: column; gap: 2px; }
.product-title { font-size: 10px; font-weight: 700; color: var(--text-main); margin: 0; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; letter-spacing: -0.2px; }
.product-id { font-size: 9px; color: var(--text-muted); font-family: 'SFMono-Regular', Consolas, monospace; font-weight: 500; }

.variants-grid { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 2px; margin-top: 4px;}
.variant-section { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.variant-label { font-size: 8px; font-weight: 600; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.5px; display: flex; justify-content: space-between; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.size-row { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.size-row::-webkit-scrollbar { display: none; }
.size-btn { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 50%; background: var(--white); font-size: 9px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all 0.2s; padding: 0; flex-shrink: 0; }
.size-btn.active { border-color: var(--primary); background: var(--primary); color: white; }

.price-add-row { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 4px; border-top: 1px solid #F1F5F9; padding-top: 6px; }
.price-col { display: flex; flex-direction: column; line-height: 1.1; }
.product-price { display: flex; align-items: flex-start; color: var(--text-main); }
.product-price .rupee { font-size: 10px; font-weight: 600; margin-top: 2px; margin-right: 1px; color: var(--text-muted); }
.product-price .amount { font-size: 15px; font-weight: 800; letter-spacing: -0.5px; }
.original-price { font-size: 10px; color: #94A3B8; text-decoration: line-through; font-weight: 500; margin-top: 2px; }

.qty-control { display: flex; align-items: center; background: #F1F5F9; border-radius: 16px; overflow: hidden; height: 26px; border: 1px solid #E2E8F0; }
.qty-btn { background: transparent; color: var(--text-main); border: none; width: 24px; height: 100%; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; transition: background 0.2s; }
.qty-btn:active { background: #E2E8F0; }
.qty-input { width: 24px; height: 100%; border: none; text-align: center; font-size: 11px; font-weight: 700; color: var(--text-main); background: transparent; margin: 0; padding: 0; outline: none; -moz-appearance: textfield; }
.btn-add-initial { background: var(--primary); color: white; border: none; height: 26px; padding: 0 10px; border-radius: 16px; font-size: 9px; font-weight: 700; letter-spacing: 0.5px; cursor: pointer; transition: transform 0.2s; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2); width: auto; margin: 0;}
.btn-add-initial:active:not(:disabled) { transform: scale(0.95); }
.catalog-container { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 4px; 
    padding: 4px; 
    align-items: start; /* <--- ADD THIS LINE */
}
.color-row { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.color-row::-webkit-scrollbar { display: none; }
.color-btn { padding: 2px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); font-size: 8px; font-weight: 600; color: var(--text-muted); cursor: pointer; white-space: nowrap; transition: all 0.2s; }
.color-btn.active { border-color: var(--primary); background: var(--primary); color: white; }