:root {
    --primary: #008be3;
    --primary-rgb: 0, 139, 227;
    --primary-hover: #0077c5;
    --primary-light: #e8f4fc;
    --primary-dark: #0a2240;
    --brand-orange: #f35f22;
    --brand-orange-rgb: 243, 95, 34;
    --brand-orange-hover: #dc4d12;
    --brand-orange-light: #fff0e9;
    --brand-navy: #0a2240;
    --accent: #10b981;
    --accent-hover: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #0a2240;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --card-radius: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(0, 139, 227, 0.25);
    --shadow-orange-glow: 0 0 20px rgba(243, 95, 34, 0.25);
}

body {
    font-family: var(--font-sans);
    background-color: #f4f7fb;
    color: var(--slate-800);
    min-height: 100vh;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Navbar */
.navbar-pos {
    background: #ffffff;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, #008be3 0%, #f35f22 100%) 1;
    box-shadow: 0 4px 15px rgba(10, 34, 64, 0.04);
    padding: 0.55rem 1.25rem;
}

.navbar-logo-img {
    height: 44px;
    width: auto;
    max-width: 175px;
    object-fit: contain;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.06));
}

.navbar-logo-img:hover {
    transform: scale(1.02);
}

@media (max-width: 575.98px) {
    .navbar-logo-img {
        height: 36px;
        max-width: 135px;
    }
}

.brand-badge {
    background: linear-gradient(135deg, #008be3, #006eb4);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(0, 139, 227, 0.3);
}

.badge-role-admin {
    background: linear-gradient(135deg, #f35f22, #ea580c) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(243, 95, 34, 0.35);
}

.badge-role-kasir {
    background: linear-gradient(135deg, #008be3, #0284c7) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(0, 139, 227, 0.35);
}

.nav-link-custom {
    color: var(--slate-600);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-link-custom:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-link-custom.active {
    color: var(--primary);
    background: var(--primary-light);
}

/* Main POS Grid Layout */
.pos-wrapper {
    height: calc(100vh - 65px);
    overflow: hidden;
}

@media (max-width: 991.98px) {
    .pos-wrapper {
        height: auto;
        overflow: visible;
        padding-bottom: 80px;
    }
}

.product-section {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1rem;
}

@media (max-width: 991.98px) {
    .product-section {
        height: auto;
        overflow: visible;
        padding: 0.75rem;
    }
}

/* Search and Barcode Bar */
.search-box-card {
    background: #ffffff;
    border-radius: var(--card-radius);
    padding: 0.85rem;
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.85rem;
}

.search-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon-left {
    position: absolute;
    left: 14px;
    color: var(--slate-500);
    font-size: 1.15rem;
    pointer-events: none;
    z-index: 5;
}

.pos-search-input {
    padding-left: 2.6rem;
    padding-right: 2.5rem;
    height: 48px;
    font-size: 0.95rem;
    border-radius: 12px;
    border: 1.5px solid var(--slate-200);
    transition: all 0.2s ease;
}

.pos-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 139, 227, 0.15);
}

.btn-scan-trigger {
    background: linear-gradient(135deg, #0a2240 0%, #008be3 100%);
    color: #ffffff;
    height: 48px;
    padding: 0 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 139, 227, 0.28);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.btn-scan-trigger:hover {
    background: linear-gradient(135deg, #0d2f59 0%, #0099fa 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 139, 227, 0.4);
    color: #ffffff;
}

/* Category Filter Bar */
.category-filter-scroller {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 0.85rem;
    scrollbar-width: none;
}

.category-filter-scroller::-webkit-scrollbar {
    display: none;
}

.btn-category-pill {
    padding: 0.45rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    background: #ffffff;
    border: 1px solid var(--slate-200);
    color: var(--slate-600);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-category-pill:hover {
    background: var(--slate-100);
    color: var(--slate-800);
}

.btn-category-pill.active {
    background: var(--dark);
    color: #ffffff;
    border-color: var(--dark);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

/* Product Catalog Grid */
.product-grid-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.85rem;
}

@media (min-width: 1400px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 575.98px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.65rem;
    }
}

.product-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid var(--slate-200);
    padding: 0.85rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    user-select: none;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.product-card:active {
    transform: scale(0.98);
}

.product-card.out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f8fafc;
}

.product-card.out-of-stock:hover {
    transform: none;
    box-shadow: none;
}

.product-card-thumb {
    width: 100%;
    height: 105px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.65rem;
    overflow: hidden;
    position: relative;
}

.product-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-icon-fallback {
    font-size: 2.25rem;
    color: var(--slate-500);
}

.product-stock-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

.badge-stock-ok {
    background: rgba(16, 185, 129, 0.9);
    color: white;
}

.badge-stock-low {
    background: rgba(245, 158, 11, 0.9);
    color: white;
}

.badge-stock-empty {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.product-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--slate-800);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.3rem;
    min-height: 2.3rem;
}

.product-barcode-code {
    font-size: 0.72rem;
    color: var(--slate-500);
    font-family: monospace;
    margin-bottom: 0.4rem;
}

.product-price-row {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-price {
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--primary);
}

.product-btn-add {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.15s ease;
}

.product-card:hover .product-btn-add {
    background: var(--primary);
    color: #ffffff;
}

/* Cart Panel (Right Side) */
.cart-panel {
    height: 100%;
    background: #ffffff;
    border-left: 1px solid var(--slate-200);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 991.98px) {
    .cart-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 85vh;
        z-index: 1045;
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        box-shadow: 0 -10px 25px rgba(0,0,0,0.15);
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .cart-panel.open-mobile {
        transform: translateY(0);
    }
}

.cart-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
}

.cart-items-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1.25rem;
}

.cart-item-row {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    padding: 0.75rem;
    margin-bottom: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    transition: all 0.2s ease;
}

.cart-item-row:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--slate-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.15rem;
}

.cart-item-price {
    font-size: 0.8rem;
    color: var(--slate-500);
}

.qty-control-group {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid var(--slate-200);
    border-radius: 10px;
    padding: 2px;
}

.btn-qty-step {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--slate-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.btn-qty-step:hover {
    background: var(--slate-100);
    color: var(--primary);
}

.qty-display-val {
    width: 32px;
    text-align: center;
    font-weight: 700;
    font-size: 0.88rem;
    border: none;
    background: transparent;
}

.cart-item-total {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--slate-800);
    text-align: right;
    min-width: 75px;
}

.btn-cart-remove {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    padding: 4px;
    transition: color 0.15s;
}

.btn-cart-remove:hover {
    color: var(--danger);
}

/* Cart Summary & Footer */
.cart-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--slate-200);
    background: #ffffff;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.02);
}

.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
    margin-bottom: 0.4rem;
    color: var(--slate-600);
}

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--slate-800);
    margin-top: 0.5rem;
    padding-top: 0.6rem;
    border-top: 1.5px dashed var(--slate-200);
}

.btn-checkout {
    width: 100%;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    margin-top: 0.85rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    transition: all 0.2s ease;
}

.btn-checkout:hover {
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
    transform: translateY(-1px);
    color: #ffffff;
}

.btn-checkout:disabled {
    background: var(--slate-300);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Mobile Sticky Cart Trigger */
.mobile-cart-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid var(--slate-200);
    padding: 0.75rem 1rem;
    z-index: 1030;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}

@media (max-width: 991.98px) {
    .mobile-cart-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
}

/* Barcode Scanner Modal Viewfinder */
.scanner-viewport-box {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    background: #000000;
}

#camera-reader {
    width: 100% !important;
}

.laser-scanner-line {
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 3px;
    background: #10b981;
    box-shadow: 0 0 12px 3px rgba(16, 185, 129, 0.8);
    animation: scannerSweep 2s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 10;
}

@keyframes scannerSweep {
    0% { top: 15%; opacity: 0.8; }
    50% { opacity: 1; }
    100% { top: 85%; opacity: 0.8; }
}

/* Thermal Receipt Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    #receipt-print-area, #receipt-print-area * {
        visibility: visible;
    }
    #receipt-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 76mm;
        margin: 0;
        padding: 4mm;
        font-family: 'Courier New', Courier, monospace;
        font-size: 11px;
        color: #000;
        background: #fff;
    }
    .no-print {
        display: none !important;
    }
}

.thermal-receipt-paper {
    width: 320px;
    background: #ffffff;
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-md);
    padding: 1.25rem;
    margin: 0 auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.4;
    color: #111827;
}

.receipt-divider {
    border-top: 1px dashed #94a3b8;
    margin: 8px 0;
}

.quick-money-btn {
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.5rem;
    background: var(--slate-100);
    color: var(--slate-700);
    border: 1px solid var(--slate-200);
    transition: all 0.15s;
}

.quick-money-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}
