﻿/* =================================================================
   MARUTI POS — STABLE UI v3.1 (Fixed)
   ================================================================= */

/* â”€â”€ Design Tokens â”€â”€ */
:root {
    --brand:           #f97316;
    --brand-dark:      #ea6c0a;
    --brand-2:         #fb923c;
    --brand-glow:      rgba(249,115,22,0.20);
    --brand-subtle:    rgba(249,115,22,0.08);

    --bg:              #f4f6fb;
    --surface:         #ffffff;
    --surface-2:       #f8fafc;
    --surface-3:       #eff2f8;

    --text-1:          #0d1117;
    --text-2:          #4b5563;
    --text-3:          #9ca3af;

    /* Legacy aliases kept for JS compatibility */
    --text-primary:    #0d1117;
    --text-secondary:  #4b5563;
    --text-muted:      #9ca3af;

    --success:         #16a34a;
    --danger:          #dc2626;
    --border-color:    rgba(0,0,0,0.08);

    --r-sm:   8px;
    --r-md:   14px;
    --r-lg:   20px;
    --r-full: 999px;

    --shadow-xs:    0 1px 3px rgba(0,0,0,0.06);
    --shadow-sm:    0 2px 8px rgba(0,0,0,0.08);
    --shadow-card:  0 2px 10px rgba(0,0,0,0.07);
    --shadow-brand: 0 6px 18px rgba(249,115,22,0.26);

    --ease:        cubic-bezier(0.25,0.46,0.45,0.94);
    --ease-spring: cubic-bezier(0.34,1.56,0.64,1);
    --dur:         0.22s;

    --font: 'Poppins', sans-serif;
}

/* â”€â”€ Reset â”€â”€ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-1);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.container {
    width: 100%;
    max-width: 1360px;
    padding: 0 16px;
    margin: 0 auto;
}

/* =================================================================
   OFFER BAR
   ================================================================= */
.offer-bar {
    background: linear-gradient(90deg, var(--brand) 0%, #fbbf24 50%, var(--brand) 100%);
    background-size: 300% 100%;
    animation: offer-shimmer 4s linear infinite;
    color: #fff;
    text-align: center;
    padding: 8px 16px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@keyframes offer-shimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* =================================================================
   HEADER
   ================================================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 500;
    background: rgba(255,255,255,0.88);
    border-bottom: 1px solid rgba(0,0,0,0.08);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    transition: box-shadow var(--dur) var(--ease);
}
.site-header.scrolled { box-shadow: 0 4px 16px rgba(0,0,0,0.10); }

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-1);
    flex-shrink: 0;
}
.logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 0.95rem;
    box-shadow: var(--shadow-brand);
    flex-shrink: 0;
}
.logo-text {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-1);
    letter-spacing: -0.02em;
    /* Gradient text only where supported */
}

/* Header actions */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.icon-btn {
    position: relative;
    width: 38px; height: 38px;
    background: var(--surface-2);
    border: 1.5px solid var(--border-color);
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-2);
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    flex-shrink: 0;
}
.icon-btn:hover, .icon-btn:active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: var(--shadow-brand);
}

.badge {
    position: absolute;
    top: -5px; right: -5px;
    background: #ef4444;
    color: #fff;
    border-radius: var(--r-full);
    padding: 1px 5px;
    font-size: 0.58rem;
    font-weight: 900;
    min-width: 16px;
    text-align: center;
    border: 2px solid var(--surface);
    line-height: 14px;
}
.badge.small { font-size: 0.55rem; top: -3px; right: -3px; }

/* =================================================================
   SEARCH BAR
   ================================================================= */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    margin: 14px 0 0;
}

.search-bar input {
    flex: 1;
    width: 100%;
    height: 50px;
    padding: 0 100px 0 46px;
    background: var(--surface);
    border: 1.5px solid var(--border-color);
    border-radius: var(--r-full);
    font-family: var(--font);
    font-size: 0.92rem;
    color: var(--text-1);
    outline: none;
    transition: border-color var(--dur), box-shadow var(--dur);
    box-shadow: var(--shadow-xs);
}
.search-bar input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow), var(--shadow-sm);
}
.search-bar input::placeholder { color: var(--text-3); }

/* Search icon left */
.search-bar::before {
    content: '\f002';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 16px;
    color: var(--text-3);
    font-size: 0.9rem;
    z-index: 1;
    pointer-events: none;
}
.search-bar:focus-within::before { color: var(--brand); }

.search-clear-btn {
    position: absolute;
    right: 52px;
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px;
    display: none;
    line-height: 1;
    z-index: 1;
}
.search-clear-btn:hover { color: var(--danger); }

#search-btn {
    position: absolute;
    right: 5px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    border: none;
    color: #fff;
    width: 40px; height: 40px;
    border-radius: var(--r-full);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: var(--shadow-brand);
    transition: transform var(--dur) var(--ease);
    z-index: 1;
    flex-shrink: 0;
}
#search-btn:hover  { transform: scale(1.05); }
#search-btn:active { transform: scale(0.94); }

/* =================================================================
   CATEGORIES STRIP
   ================================================================= */
.categories-strip-section {
    position: sticky;
    top: 60px;
    z-index: 490;
    background: rgba(244,246,251,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding-bottom: 4px;
    transition: box-shadow var(--dur) var(--ease);
}
.categories-strip-section.is-pinned {
    box-shadow: 0 4px 14px -2px rgba(0,0,0,0.08);
}

.categories-strip {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 12px 0 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.categories-strip::-webkit-scrollbar { display: none; }

.category-item {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: var(--r-full);
    background: var(--surface);
    border: 1.5px solid var(--border-color);
    color: var(--text-2);
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: all var(--dur) var(--ease);
}
.category-item i { font-size: 0.82rem; }
.category-item:hover {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-subtle);
}
.category-item.active {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-brand);
}

/* =================================================================
   SECTION TITLES
   ================================================================= */
.product-section { margin-top: 4px; }

.section-title {
    margin: 22px 0 14px;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =================================================================
   PRODUCT GRID
   ================================================================= */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* =================================================================
   PRODUCT CARD
   ================================================================= */
.product-card {
    background: var(--surface);
    border-radius: var(--r-lg);
    border: 1px solid rgba(0,0,0,0.07);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
    box-shadow: var(--shadow-card);
}
.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.11);
}
.product-card:active { transform: scale(0.98); }

/* Image */
.image-container {
    position: relative;
    background: var(--surface-3);
    overflow: hidden;
}
.product-card img {
    width: 100%;
    height: 130px;
    object-fit: contain;
    padding: 10px;
    display: block;
    transition: transform 0.3s var(--ease);
}
.product-card:hover img { transform: scale(1.06); }

.trending-badge {
    position: absolute;
    top: 8px; left: 8px;
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: var(--r-full);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Product info */
.product-info {
    padding: 10px 12px 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 4px;
}

.product-price {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--text-1);
}

.product-quantity {
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--surface-3);
    color: var(--text-2);
    padding: 2px 8px;
    border-radius: var(--r-full);
}
.product-quantity.text-red { color: var(--danger); background: #fef2f2; }

/* =================================================================
   ADD / QTY BUTTONS
   ================================================================= */
.btn-add {
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    border-radius: var(--r-md);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: all var(--dur) var(--ease-spring);
    background: var(--brand-subtle);
    border: 1.5px solid rgba(249,115,22,0.25);
    color: var(--brand);
    letter-spacing: 0.02em;
}
.btn-add:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-brand);
    transform: translateY(-1px);
}
.btn-add:active:not(:disabled) { transform: scale(0.97); }
.btn-add:disabled {
    background: var(--surface-2);
    border-color: var(--border-color);
    color: var(--text-3);
    cursor: not-allowed;
}

/* Qty controls */
.qty-controls {
    display: none;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1.5px solid var(--brand);
    background: var(--surface);
    animation: pop-in var(--dur) var(--ease-spring) forwards;
}
@keyframes pop-in {
    from { transform: scale(0.88); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}
.qty-controls.visible { display: flex; }

.qty-btn {
    flex: 0 0 40px;
    height: 38px;
    background: none;
    border: none;
    color: var(--brand);
    font-size: 1.15rem;
    font-weight: 900;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--dur);
    font-family: var(--font);
}
.qty-btn:hover { background: var(--brand); color: #fff; }
.qty-btn.minus:hover { background: var(--danger); }

.qty-display {
    flex-grow: 1;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-1);
    background: var(--brand-subtle);
    height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-left: 1px solid rgba(249,115,22,0.2);
    border-right: 1px solid rgba(249,115,22,0.2);
}

.qty-timer-bar {
    height: 2px;
    background: linear-gradient(to right, var(--brand), var(--brand-2));
    border-radius: 0 0 var(--r-md) var(--r-md);
    transform-origin: left;
    animation: qty-shrink 3s linear forwards;
    display: none;
}
.qty-timer-bar.visible { display: block; }
@keyframes qty-shrink {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* =================================================================
   OUT OF STOCK
   ================================================================= */
.out-of-stock .image-container { opacity: 0.55; filter: grayscale(65%); }
.out-of-stock-badge {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20,20,20,0.80);
    color: #fff;
    padding: 5px 12px;
    border-radius: var(--r-sm);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    backdrop-filter: blur(3px);
}

/* =================================================================
   SKELETON LOADER
   ================================================================= */
.skeleton {
    border-radius: var(--r-lg);
    background: linear-gradient(90deg, #e8ecf4 25%, #f3f5fa 50%, #e8ecf4 75%);
    background-size: 200% 100%;
    animation: shimmer 1.6s infinite linear;
    border: none;
}
@keyframes shimmer { to { background-position-x: -200%; } }

/* =================================================================
   TOASTS
   ================================================================= */
#toast-container {
    position: fixed;
    bottom: 88px;
    right: 14px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
    max-width: 300px;
}

.toast {
    background: #1e293b;
    color: #fff;
    padding: 12px 16px;
    border-radius: var(--r-md);
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 10px 24px rgba(0,0,0,0.20);
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(110%);
    opacity: 0;
    transition: all 0.3s var(--ease-spring);
    pointer-events: auto;
    border-left: 3px solid transparent;
    word-break: break-word;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.success { border-left-color: #16a34a; }
.toast.error   { border-left-color: #dc2626; }

/* Bottom Nav moved to design-system.css for global consistency */
/* =================================================================
   MODALS — shared overlay
   ================================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,10,20,0.55);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
@keyframes slideUp {
    from { transform: translateY(28px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* QR Modal content */
#qr-modal .modal-content {
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: 28px 22px;
    text-align: center;
    max-width: 340px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 56px rgba(0,0,0,0.18);
    animation: slideUp 0.28s var(--ease) forwards;
    border: 1px solid rgba(0,0,0,0.06);
}

#close-qr-btn {
    position: absolute;
    top: 12px; right: 12px;
    width: 30px; height: 30px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-2);
    transition: all var(--dur);
    line-height: 1;
}
#close-qr-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* Customer alert modal content */
#customer-alert-modal .modal-content {
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: 28px 20px;
    text-align: center;
    max-width: 360px;
    width: 100%;
    position: relative;
    box-shadow: 0 16px 48px rgba(220,38,38,0.22);
    animation: slideUp 0.3s var(--ease) forwards;
    border: 2px solid #fecaca;
}

/* =================================================================
   NOTIFICATION DRAWER (kept from original)
   ================================================================= */
.notif-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s; cursor: default;
}
.notif-item:hover  { background: rgba(255,255,255,0.04); }
.notif-item.unread { background: rgba(255,62,108,0.05); }
.notif-item.unread .notif-dot { opacity: 1; }
.notif-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #ff3e6c; flex-shrink: 0;
    margin-top: 6px; opacity: 0;
}
.notif-icon-wrap {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; color: #fff; flex-shrink: 0;
}
.notif-msg { font-size: 0.78rem; color: #c0c0d4; line-height: 1.48; }
.notif-msg strong { color: #f1f1f5; font-weight: 700; }
.notif-time { font-size: 0.62rem; color: #6b6b88; margin-top: 4px; }
.notif-badge-pill {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: 0.6rem; font-weight: 800; letter-spacing: .04em;
    text-transform: uppercase; margin-bottom: 4px;
}

/* =================================================================
   RESPONSIVE
   ================================================================= */
@media (max-width: 767px) {
    .desktop-only { display: none !important; }
}

@media (max-width: 380px) {
    .container { padding: 0 10px; }
    .header-actions { gap: 6px; }
    .icon-btn { width: 34px; height: 34px; font-size: 0.88rem; }
    .product-grid { gap: 8px; }
    .product-card img { height: 108px; }
    .product-name { font-size: 0.78rem; }
    .product-price { font-size: 0.95rem; }
    .btn-add { padding: 8px; font-size: 0.78rem; }
}

@media (min-width: 768px) {
    body { padding-bottom: 0; }
    .container { padding: 0 24px; }
    /* Bottom nav hidden at desktop — managed by design-system.css */
    .product-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
    .section-title { font-size: 1.2rem; }
    .product-card img { height: 150px; }
    .search-bar input { height: 52px; font-size: 0.95rem; }
}

@media (min-width: 1024px) {
    .product-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
    .product-card img { height: 165px; }
}

@media (min-width: 1280px) {
    .product-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (min-width: 1536px) {
    .product-grid { grid-template-columns: repeat(6, 1fr); }
}

/* =================================================================
   DESKTOP FOOTER
   ================================================================= */
.site-footer {
    background: #0d1117;
    color: #9ca3af;
    margin-top: 60px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-family: var(--font);
}

.footer-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 60px 16px;
}

@media (min-width: 768px) {
    .footer-container { grid-template-columns: 1.5fr 1fr; }
}

@media (min-width: 1024px) {
    .footer-container { grid-template-columns: 1.5fr 1fr 1fr; }
}

.footer-col .logo-text { color: #fff !important; }
.footer-col .tagline {
    color: var(--brand);
    font-weight: 700;
    font-size: 0.95rem;
    margin: 12px 0 6px;
    letter-spacing: 0.02em;
}
.footer-col .desc {
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

.ecosystem-links { display: flex; flex-direction: column; gap: 10px; }
.ecosystem-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--r-md);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    width: fit-content;
    transition: all var(--dur) var(--ease);
}
.ecosystem-link i { font-size: 1.1rem; color: var(--brand); }
.ecosystem-link:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--brand);
    transform: translateY(-2px);
}

.footer-title {
    color: var(--brand-2);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 20px;
}

.footer-nav { display: flex; flex-direction: column; gap: 12px; }
.footer-nav a {
    color: #c0c0d4;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: color var(--dur);
}
.footer-nav a:hover { color: var(--brand); }
.footer-nav i { width: 16px; text-align: center; opacity: 0.8; }

.footer-info-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.footer-info-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: #c0c0d4;
    line-height: 1.5;
}
.footer-info-list i { color: var(--brand); margin-top: 3px; }

.accepted-payments { display: flex; gap: 8px; flex-wrap: wrap; }
.payment-badge {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: var(--r-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.payment-badge i { color: var(--brand); }

.footer-bottom {
    background: rgba(0,0,0,0.3);
    border-top: 1px solid rgba(255,255,255,0.04);
}
.bottom-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
}
@media (min-width: 768px) {
    .bottom-container { flex-direction: row; justify-content: space-between; }
}
.copyright, .made-with-love { font-size: 0.75rem; color: #6b6b88; font-weight: 500; }
