﻿/* ==========================================================================
   SariPOS - main stylesheet (Bootstrap 4 based)
   ========================================================================== */
:root {
    --sp-sidebar-w: 236px;
    --sp-sidebar-bg: #1e293b;
    --sp-sidebar-fg: #cbd5e1;
    --sp-sidebar-active: #0ea5e9;
    --sp-primary: #0b7285;
    --sp-bg: #f1f5f9;
    --sp-border: #e2e8f0;
    --sp-text: #1e293b;
    --sp-muted: #64748b;
}

html, body { height: 100%; }
body { background: var(--sp-bg); color: var(--sp-text); font-size: 15px; }
a { color: var(--sp-primary); }
.btn-primary { background: var(--sp-primary); border-color: var(--sp-primary); }
.btn-primary:hover, .btn-primary:focus { background: #095c6b; border-color: #095c6b; }
.btn-outline-primary { color: var(--sp-primary); border-color: var(--sp-primary); }
.btn-outline-primary:hover { background: var(--sp-primary); border-color: var(--sp-primary); }
.text-primary { color: var(--sp-primary) !important; }
.bg-primary, .badge-primary { background-color: var(--sp-primary) !important; }
.page-item.active .page-link { background: var(--sp-primary); border-color: var(--sp-primary); }
.custom-control-input:checked ~ .custom-control-label::before { background: var(--sp-primary); border-color: var(--sp-primary); }

/* ---------- Layout ---------- */
.sp-wrapper { display: flex; min-height: 100vh; }
.sp-sidebar {
    width: var(--sp-sidebar-w); background: var(--sp-sidebar-bg); color: var(--sp-sidebar-fg);
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 1040; overflow-y: auto; transition: transform .2s ease;
}
.sp-brand { display: flex; align-items: center; padding: 16px 18px; color: #fff; font-weight: 700; font-size: 1.25rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.sp-brand:hover { color: #fff; text-decoration: none; }
.sp-brand .logo { width: 34px; height: 34px; border-radius: 8px; background: var(--sp-sidebar-active); display: inline-flex; align-items: center; justify-content: center; margin-right: 10px; font-size: 1rem; }
.sp-brand small { display: block; font-size: .68rem; font-weight: 400; color: var(--sp-sidebar-fg); }
.sp-nav { list-style: none; padding: 8px 0 24px; margin: 0; }
.sp-nav .nav-header { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 14px 20px 4px; }
.sp-nav a { display: flex; align-items: center; padding: 9px 20px; color: var(--sp-sidebar-fg); font-size: .93rem; border-left: 3px solid transparent; }
.sp-nav a i { width: 22px; margin-right: 10px; text-align: center; opacity: .85; }
.sp-nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.sp-nav a.active { background: rgba(14,165,233,.12); color: #fff; border-left-color: var(--sp-sidebar-active); }
.sp-nav a .badge { margin-left: auto; }
.sp-main { flex: 1; margin-left: var(--sp-sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.sp-navbar { background: #fff; border-bottom: 1px solid var(--sp-border); height: 58px; padding: 0 18px; display: flex; align-items: center; position: sticky; top: 0; z-index: 1030; }
.sp-navbar .page-title { font-size: 1.1rem; font-weight: 600; margin: 0; }
.sp-content { padding: 20px; flex: 1; }
.sp-footer { padding: 10px 20px; font-size: .8rem; color: var(--sp-muted); }
.sp-backdrop { display: none; }

@media (max-width: 991.98px) {
    .sp-sidebar { transform: translateX(-100%); }
    body.sidebar-open .sp-sidebar { transform: none; }
    body.sidebar-open .sp-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }
    .sp-main { margin-left: 0; }
    .sp-content { padding: 14px 10px; }
}

/* ---------- Cards / widgets ---------- */
.card { border: 1px solid var(--sp-border); border-radius: 10px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--sp-border); font-weight: 600; }
.stat-card { padding: 16px; display: flex; flex-direction: row; align-items: center; height: 100%; }
.stat-card .icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-right: 14px; flex-shrink: 0; }
.stat-card .label { font-size: .8rem; color: var(--sp-muted); text-transform: uppercase; letter-spacing: .03em; }
.stat-card .value { font-size: 1.45rem; font-weight: 700; line-height: 1.2; }
.stat-card .hint { font-size: .75rem; color: var(--sp-muted); }
.bg-soft-success { background: #dcfce7; color: #15803d; }
.bg-soft-primary { background: #cffafe; color: #0e7490; }
.bg-soft-warning { background: #fef3c7; color: #b45309; }
.bg-soft-danger { background: #fee2e2; color: #b91c1c; }
.bg-soft-info { background: #dbeafe; color: #1d4ed8; }
.bg-soft-secondary { background: #e2e8f0; color: #334155; }
.badge { font-weight: 600; padding: .35em .6em; }
.badge-warning { color: #7c4a03; background: #fcd34d; }
.empty-state { text-align: center; color: var(--sp-muted); padding: 28px 10px; }
.empty-state i { font-size: 2rem; opacity: .4; display: block; margin-bottom: 8px; }
.list-compact .list-group-item { padding: .55rem .9rem; }
.chart-box { position: relative; height: 260px; }
.table td, .table th { vertical-align: middle; }
.table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; color: var(--sp-muted); border-bottom-width: 1px; }
.dataTables_wrapper .dataTables_filter input { min-width: 220px; }
.table-actions .btn { padding: .2rem .45rem; }
.demo-banner { background: #fef2f2; border-bottom: 1px solid #fecaca; color: #991b1b; padding: 6px 18px; font-size: .85rem; }
.form-label-sm { font-size: .8rem; color: var(--sp-muted); margin-bottom: 2px; }
.swal2-popup { font-size: .95rem !important; }
.product-thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; background: #f1f5f9; }
.filters-bar .form-control, .filters-bar .custom-select { min-width: 140px; }
.summary-cards .card { border-left: 4px solid var(--sp-border); }
.summary-cards .card.b-success { border-left-color: #16a34a; }
.summary-cards .card.b-primary { border-left-color: var(--sp-primary); }
.summary-cards .card.b-danger { border-left-color: #dc2626; }
.summary-cards .card.b-warning { border-left-color: #f59e0b; }

.product-image-preview { width: 120px; height: 120px; border-radius: 10px; border: 1px solid var(--sp-border); background: #f8fafc; display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; color: #cbd5e1; font-size: 2.5rem; }
.product-image-preview img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb { border: 1px solid var(--sp-border); }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0b7285 0%, #1e293b 100%); padding: 16px; }
.auth-card { width: 100%; max-width: 400px; border-radius: 14px; border: 0; box-shadow: 0 20px 40px rgba(0,0,0,.25); }
.auth-card .brand { font-size: 1.8rem; font-weight: 800; color: var(--sp-primary); }

/* ---------- POS ---------- */
body.pos-body { overflow: hidden; }
.pos-topbar { height: 52px; background: var(--sp-sidebar-bg); color: #fff; display: flex; align-items: center; padding: 0 12px; }
.pos-topbar a, .pos-topbar .btn-link { color: #e2e8f0; }
.pos-topbar .brand { font-weight: 700; margin-right: 16px; }
.pos-shell { display: flex; height: calc(100vh - 52px); }
.pos-left { flex: 1 1 58%; display: flex; flex-direction: column; min-width: 0; padding: 10px; }
.pos-right { flex: 0 0 42%; max-width: 520px; min-width: 360px; background: #fff; border-left: 1px solid var(--sp-border); display: flex; flex-direction: column; }
.pos-search { position: relative; }
.pos-search .form-control { height: 52px; font-size: 1.15rem; padding-left: 46px; border-radius: 10px; border: 2px solid var(--sp-border); }
.pos-search .form-control:focus { border-color: var(--sp-primary); box-shadow: none; }
.pos-search .fa-barcode { position: absolute; left: 16px; top: 16px; font-size: 1.2rem; color: var(--sp-muted); }
.pos-cats { white-space: nowrap; overflow-x: auto; padding: 8px 0; }
.pos-cats .btn { border-radius: 20px; margin-right: 6px; font-size: .85rem; }
.pos-products { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-auto-rows: max-content; grid-gap: 8px; align-content: start; padding-bottom: 10px; }
.pos-product { background: #fff; border: 1px solid var(--sp-border); border-radius: 10px; padding: 8px; cursor: pointer; user-select: none; display: flex; flex-direction: column; min-height: 104px; transition: border-color .1s, transform .05s; position: relative; }
.pos-product .thumb { height: 110px; flex-shrink: 0; margin: -2px -2px 6px; border-radius: 7px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; overflow: hidden; color: #cbd5e1; font-size: 2rem; }
.pos-product .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 15%; }
.pos-product .stock-badge { position: absolute; top: 12px; right: 12px; font-size: .7rem; }
.pos-cart .cart-thumb { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; margin-right: 8px; flex-shrink: 0; border: 1px solid var(--sp-border); }
.pos-product:hover { border-color: var(--sp-primary); }
.pos-product:active { transform: scale(.98); }
.pos-product.out { opacity: .55; }
.pos-product .name { font-weight: 600; font-size: .92rem; line-height: 1.2; flex: 1; }
.pos-product .price { font-size: 1.05rem; font-weight: 700; color: var(--sp-primary); }
.pos-product .meta { font-size: .72rem; color: var(--sp-muted); display: flex; justify-content: space-between; }
.pos-cart-head { padding: 10px 12px; border-bottom: 1px solid var(--sp-border); }
.pos-cart { flex: 1; overflow-y: auto; }
.pos-cart table { margin: 0; }
.pos-cart td { padding: 8px 6px; border-top: 1px solid #f1f5f9; }
.pos-cart .item-name { font-weight: 600; font-size: .95rem; line-height: 1.2; }
.pos-cart .item-sub { font-size: .75rem; color: var(--sp-muted); }
.pos-cart .qty-box { display: flex; align-items: center; }
.pos-cart .qty-box .btn { width: 32px; height: 32px; padding: 0; font-weight: 700; }
.pos-cart .qty-box input { width: 54px; height: 32px; text-align: center; margin: 0 3px; padding: 2px; font-weight: 600; }
.pos-cart .line-total { font-weight: 700; text-align: right; white-space: nowrap; }
.pos-totals { border-top: 1px solid var(--sp-border); padding: 10px 14px; background: #f8fafc; }
.pos-totals .row-t { display: flex; justify-content: space-between; font-size: .95rem; padding: 2px 0; }
.pos-totals .grand { font-size: 1.7rem; font-weight: 800; color: var(--sp-text); }
.pos-actions { padding: 10px 14px 14px; }
.btn-checkout { height: 60px; font-size: 1.3rem; font-weight: 700; border-radius: 10px; }
.pos-empty-cart { text-align: center; color: var(--sp-muted); padding: 50px 10px; }
.pos-empty-cart i { font-size: 3rem; opacity: .25; }
.pay-methods .btn { height: 56px; font-weight: 600; }
.pay-methods .btn.active { background: var(--sp-primary) !important; color: #fff !important; border-color: var(--sp-primary) !important; }
.quick-cash .btn { min-width: 70px; margin: 0 4px 6px 0; font-weight: 600; }
.pay-amount { height: 58px; font-size: 1.6rem; font-weight: 700; text-align: right; }
.change-box { font-size: 2rem; font-weight: 800; }
.kbd-hint { font-size: .7rem; background: rgba(255,255,255,.15); border-radius: 4px; padding: 1px 5px; margin-left: 4px; }
.customer-pill { background: #f1f5f9; border-radius: 8px; padding: 6px 10px; display: flex; align-items: center; cursor: pointer; }
.customer-pill:hover { background: #e2e8f0; }

.pos-mobile-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: #fff; border-top: 1px solid var(--sp-border); padding: 8px 10px; display: flex; box-shadow: 0 -2px 8px rgba(15,23,42,.08); }
.pos-mobile-bar .btn { height: 48px; }

@media (max-width: 991.98px) {
    body.pos-body { overflow: auto; padding-bottom: 66px; }
    .pos-shell { flex-direction: column; height: auto; }
    .pos-left { height: 60vh; }
    .pos-right { max-width: none; min-width: 0; border-left: 0; border-top: 1px solid var(--sp-border); }
    .pos-cart { max-height: 50vh; }
    .pos-products { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ---------- Barcode labels ---------- */
.label-sheet { display: flex; flex-wrap: wrap; }
.barcode-label { width: 50mm; height: 30mm; border: 1px dashed #cbd5e1; padding: 2mm; margin: 1mm; text-align: center; overflow: hidden; background: #fff; }
.barcode-label .ln { font-size: 9pt; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barcode-label .lp { font-size: 10pt; font-weight: 700; }
.barcode-label svg { max-width: 100%; height: 14mm; }

@media print {
    .no-print, .sp-sidebar, .sp-navbar, .sp-footer, .demo-banner { display: none !important; }
    .sp-main { margin-left: 0 !important; }
    .sp-content { padding: 0 !important; }
    body { background: #fff !important; }
    .card { border: 0 !important; box-shadow: none !important; }
    .barcode-label { border: 0; page-break-inside: avoid; }
}

/* ---------- Public site (landing / register) ---------- */
.public-body { background: #f8fafc; }
.public-nav { background: #0f172a; padding: 12px 0; position: sticky; top: 0; z-index: 1030; }
.public-brand { color: #fff; font-weight: 800; font-size: 1.3rem; display: inline-flex; align-items: center; }
.public-brand:hover { color: #fff; text-decoration: none; }
.public-brand .logo { width: 34px; height: 34px; border-radius: 9px; background: #14b8a6; display: inline-flex; align-items: center; justify-content: center; margin-right: 10px; font-size: 1rem; }
.btn-accent { background: #14b8a6; border-color: #14b8a6; color: #fff; font-weight: 600; }
.btn-accent:hover { background: #0d9488; border-color: #0d9488; color: #fff; }
.text-accent { color: #2dd4bf !important; }
.text-coral { color: #f87171 !important; }
.text-amber { color: #fbbf24 !important; }
.hero { background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #134e4a 100%); color: #e2e8f0; padding: 70px 0 60px; }
.hero-badge { display: inline-block; background: rgba(20,184,166,.15); color: #5eead4; border: 1px solid rgba(94,234,212,.3); padding: 4px 12px; border-radius: 20px; font-size: .85rem; margin-bottom: 16px; }
.hero-title { font-size: 2.6rem; font-weight: 800; line-height: 1.15; color: #fff; }
.hero-sub { font-size: 1.1rem; color: #cbd5e1; margin: 18px 0 26px; max-width: 540px; }
.hero-card { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 18px; padding: 24px; color: #fff; backdrop-filter: blur(4px); }
.hc-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; }
.hc-value { font-size: 1.5rem; font-weight: 800; }
.hc-bars { display: flex; align-items: flex-end; height: 90px; gap: 10px; }
.hc-bars span { flex: 1; background: linear-gradient(180deg, #2dd4bf, #0f766e); border-radius: 6px 6px 2px 2px; }
.section-title { font-weight: 800; color: #0f172a; }
.feature-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 22px; transition: transform .15s, box-shadow .15s; }
.feature-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(15,23,42,.08); }
.feature-icon { width: 46px; height: 46px; border-radius: 12px; background: #ccfbf1; color: #0f766e; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; margin-bottom: 12px; }
.step-num { width: 52px; height: 52px; border-radius: 50%; background: #0f172a; color: #5eead4; font-weight: 800; font-size: 1.3rem; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.public-footer { background: #0f172a; color: #94a3b8; padding: 22px 0; font-size: .85rem; }
.register-card { border: 0; border-radius: 16px; box-shadow: 0 10px 30px rgba(15,23,42,.08); }
.reg-section { font-weight: 700; color: #0f766e; border-bottom: 1px solid #e2e8f0; padding-bottom: 6px; margin: 18px 0 14px; }
.reg-map { height: 280px; border-radius: 10px; border: 1px solid #e2e8f0; background: #f1f5f9; position: relative; }
.map-offline { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; color: #94a3b8; font-size: .85rem; z-index: 0; pointer-events: none; }
@media (max-width: 767.98px) { .hero { padding: 40px 0; } .hero-title { font-size: 1.9rem; } }

/* ---------- Master Admin ---------- */
.admin-sidebar { background: #0f172a; }
.admin-badge { background: #14b8a6; color: #fff; font-size: .65rem; padding: 2px 6px; border-radius: 4px; vertical-align: middle; }
.store-logo-sm { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; border: 1px solid var(--sp-border); background: #f1f5f9; }
.admin-map { height: 260px; border-radius: 10px; border: 1px solid var(--sp-border); background: #f1f5f9; position: relative; }
.dt-buttons .btn { margin-right: 4px; }

/* ---------- Store location map ---------- */
.reg-map, .admin-map { z-index: 0; }
.reg-map .map-offline, .admin-map .map-offline { z-index: 500; background: rgba(241,245,249,.85); padding: 12px; border-radius: 10px; }
.map-status { margin-top: 6px; min-height: 1.2em; }
.leaflet-container { font: inherit; }
.leaflet-container img { max-width: none !important; }
