/* Root Variables & Theme definition */
:root {
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;

    /* Colors - Default Dark Theme */
    --bg-app: #0b0f19;
    --bg-panel: #131a26;
    --bg-card: #182235;
    --bg-control: #1f2b3e;
    --border-color: #223049;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.25);
    
    --success: #10b981;
    --success-hover: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    --transition-speed: 0.25s;
    --card-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.2);
}

/* Light Theme Variables */
[data-bs-theme="light"] {
    --bg-app: #f4f6f9;
    --bg-panel: #ffffff;
    --bg-card: #ffffff;
    --bg-control: #f8fafc;
    --border-color: #e2e8f0;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.15);
    
    --success: #10b981;
    --success-hover: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;

    --card-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.05);
}

/* Global Styles */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    font-family: var(--font-body);
    color: var(--text-main);
    background-color: var(--bg-app);
    overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

.fs-xs {
    font-size: 0.75rem;
}
.fs-sm {
    font-size: 0.85rem;
}
.leading-tight {
    line-height: 1.25;
}

/* Utility Scrollbar Hide */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Layout Container */
.app-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-app);
}

/* Header customization */
.app-header {
    height: 70px;
    background-color: var(--bg-panel);
    border-color: var(--border-color) !important;
}

.logo-icon {
    width: 42px;
    height: 42px;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.logo-icon-svg {
    width: 22px;
    height: 22px;
}

.search-scanner-bar {
    width: 450px;
    max-width: 100%;
    transition: all var(--transition-speed) ease;
    border-color: var(--border-color) !important;
}

.search-scanner-bar:focus-within {
    box-shadow: 0 0 0 3px var(--primary-glow);
    border-color: var(--primary) !important;
}

.search-scanner-bar input::placeholder {
    color: var(--text-muted);
}

.divider {
    width: 1px;
    height: 32px;
    background-color: var(--border-color);
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-weight: 600;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-icon i,
.btn-icon svg {
    width: 20px;
    height: 20px;
}

.indicator-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

/* Main Body Layout */
.app-body {
    display: flex;
    flex: 1;
    height: calc(100vh - 70px);
    overflow: hidden;
}

/* Catalog Area (Left) */
.catalog-section {
    flex: 1;
    background-color: var(--bg-app);
    overflow: hidden;
}

.category-tabs-container {
    background-color: var(--bg-panel) !important;
    border-color: var(--border-color) !important;
}

.btn-category {
    border-radius: 30px;
    padding: 8px 18px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background-color: var(--bg-control);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.btn-category:hover {
    color: var(--text-main);
    background-color: var(--border-color);
}

.btn-category.active {
    color: #fff !important;
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.products-grid-container {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* Product Card design */
.product-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: var(--card-shadow);
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25), 0 0 0 2px var(--primary);
}

.product-img-wrapper {
    position: relative;
    padding-top: 75%; /* 4:3 Aspect Ratio */
    background-color: #1a2537;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.product-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-speed) ease;
}

.product-card:hover .product-img {
    transform: scale(1.06);
}

.product-badge-category {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    background-color: rgba(15, 23, 42, 0.6);
    color: #fff;
}

.product-badge-stock {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 4px;
}

.product-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-barcode {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.6rem;
    color: var(--text-main);
}

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

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

.btn-add-to-cart {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background-color: var(--bg-control);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.product-card:hover .btn-add-to-cart {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Cart Panel (Right) */
.cart-section {
    width: 440px;
    background-color: var(--bg-panel);
    border-color: var(--border-color) !important;
    overflow: hidden;
}

.cart-items {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* Cart Item styles */
.cart-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all var(--transition-speed) ease;
}

.cart-item:hover {
    border-color: var(--primary-glow);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.cart-item-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    background-color: #1a2537;
}

.cart-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.2;
}

.qty-control {
    background-color: var(--bg-control);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2px 4px;
}

.qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 0;
    background-color: transparent;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.qty-btn:hover {
    background-color: var(--border-color);
}

.qty-input {
    width: 32px;
    border: 0;
    background: transparent;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.qty-input:focus {
    outline: none;
}

.cart-footer {
    border-color: var(--border-color) !important;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.15);
}

/* Custom Checkbox or switch inputs for cash values */
#discount-input {
    background-color: var(--bg-control);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 6px;
}
#discount-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Custom Payment Button styles */
.btn-payment-method {
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.btn-payment-method:hover {
    border-color: var(--primary-glow);
}

.btn-payment-method.active {
    background-color: var(--bg-control);
    border-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.method-check-icon {
    width: 20px;
    height: 20px;
}

/* Quick Cash Grid */
.quick-cash-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.btn-quick-cash {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-main);
}
.btn-quick-cash:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Scanner Animation effects */
.scanner-laser {
    animation: scanAnimation 2s infinite ease-in-out;
}

@keyframes scanAnimation {
    0%, 100% {
        top: 0%;
        opacity: 0.3;
    }
    50% {
        top: 100%;
        opacity: 1;
        box-shadow: 0px 0px 8px 1px #ff0000;
    }
}

/* QRIS scanner simulation line */
.qris-scan-line {
    position: absolute;
    width: 100%;
    height: 3px;
    background-color: var(--success);
    top: 0;
    left: 0;
    box-shadow: 0 0 10px 1px var(--success);
    animation: qrisScan 3s infinite linear;
}

@keyframes qrisScan {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}

/* Custom animations */
.animate-pulse {
    animation: nfcPulse 1.8s infinite ease-in-out;
}

@keyframes nfcPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
        filter: drop-shadow(0 0 10px var(--primary));
    }
}

/* Thermal receipt mock stylings */
.thermal-receipt {
    background-color: #fff;
    color: #000;
    padding: 10px;
    border-radius: 4px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}

.receipt-divider {
    border-top: 1px dashed #333;
}

.receipt-item-row {
    margin-bottom: 6px;
    line-height: 1.15;
}

/* Keyboard badge */
kbd {
    background-color: var(--bg-control);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 0 var(--border-color);
    font-size: 0.8em;
    padding: 2px 5px;
    border-radius: 3px;
}

/* Bootstrap modals theme overrides */
.modal-content {
    background-color: var(--bg-panel);
    color: var(--text-main);
    border-color: var(--border-color);
}
.modal-header {
    border-bottom-color: var(--border-color);
}
.modal-footer {
    border-top-color: var(--border-color);
}
.btn-close {
    filter: invert(var(--theme-invert, 1));
}
[data-bs-theme="light"] .btn-close {
    filter: invert(0);
}

.form-control, .form-select {
    background-color: var(--bg-control);
    border-color: var(--border-color);
    color: var(--text-main);
}
.form-control:focus, .form-select:focus {
    background-color: var(--bg-control);
    border-color: var(--primary);
    color: var(--text-main);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Mobile bottom nav and floating cart - hidden on desktop */
@media (min-width: 768px) {
    .mobile-bottom-nav, .mobile-floating-cart {
        display: none !important;
    }
}

/* Responsive Overrides */
@media (max-width: 991.98px) {
    .app-body {
        flex-direction: column;
        overflow-y: auto;
    }
    
    .cart-section {
        width: 100%;
        border-start-width: 0px !important;
        border-top: 1px solid var(--border-color);
        max-height: 50vh;
    }
    
    .search-scanner-bar {
        width: 280px;
    }
}

/* Phone Mobile View (Optimized for Small Screens) */
@media (max-width: 767.98px) {
    .app-header {
        height: auto;
        min-height: 105px;
        flex-wrap: wrap;
        padding: 8px 12px !important;
        gap: 6px;
    }
    
    .logo-area .logo-text {
        font-size: 1.05rem;
    }
    .logo-area .logo-icon {
        width: 34px;
        height: 34px;
    }
    
    .search-scanner-bar {
        order: 10;
        width: 100%;
        margin-top: 4px;
    }

    .app-body {
        height: calc(100vh - 105px - 65px); /* Header: ~105px, Bottom Nav: ~65px */
        flex-direction: column;
        overflow: hidden;
    }

    /* Tabbed navigation active styles */
    .catalog-section, .cart-section {
        display: none !important;
    }

    .catalog-section.active-tab, .cart-section.active-tab {
        display: flex !important;
        flex: 1;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
    }

    .products-grid-container {
        padding: 12px !important;
        padding-bottom: 140px !important; /* Prevents bottom products from being covered by floating cart bar */
    }

    .product-card {
        border-radius: 12px;
    }

    .product-card-body {
        padding: 10px;
    }

    .product-title {
        font-size: 0.85rem;
        height: 2.2rem;
        margin-bottom: 4px;
    }

    .product-price {
        font-size: 0.95rem;
    }

    .product-barcode {
        font-size: 0.65rem;
    }

    .btn-add-to-cart {
        width: 28px;
        height: 28px;
        border-radius: 6px;
    }

    /* Cart modifications on mobile */
    .cart-section {
        border-top: 0px !important;
    }
    
    .cart-footer {
        padding: 12px 16px !important;
        margin-bottom: 65px; /* Offset bottom navigation */
    }

    /* Custom classes for bottom nav elements */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        display: flex !important;
        align-items: center;
        justify-content: space-around;
        z-index: 1000;
        border-top: 1px solid var(--border-color);
        background-color: var(--bg-panel);
        box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
    }

    .mobile-bottom-nav .nav-item {
        flex: 1;
        height: 100%;
        border: 0;
        background: transparent;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        font-size: 0.7rem;
        font-weight: 600;
        gap: 3px;
        transition: all 0.15s ease;
    }

    .mobile-bottom-nav .nav-item.active {
        color: var(--primary);
    }
    
    .mobile-bottom-nav .nav-item i {
        width: 20px;
        height: 20px;
    }

    .mobile-floating-cart {
        position: fixed;
        bottom: 80px;
        left: 12px;
        right: 12px;
        z-index: 999;
    }
    
    .mobile-floating-cart > div {
        animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Member Selector dropdown items styling */
.member-result-item {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    transition: background 0.15s ease;
    border: 0 !important;
}

.member-result-item:hover {
    background-color: var(--bg-control);
}

.member-result-item .member-name {
    font-weight: 600;
    color: var(--text-main);
}

.member-result-item .member-phone {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Native Printing configurations */
@media print {
    body * {
        visibility: hidden;
    }
    
    #receipt-print-area, #receipt-print-area * {
        visibility: visible;
    }
    
    #receipt-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        background: white !important;
        color: black !important;
    }
    
    .modal {
        position: absolute;
        left: 0;
        top: 0;
        margin: 0;
        padding: 0;
        min-height: 100%;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    .modal-dialog {
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: 100% !important;
    }
    
    .modal-content {
        border: none !important;
        box-shadow: none !important;
        background: white !important;
    }
    
    .modal-body {
        padding: 0 !important;
    }
}

/* Voucher Styles */
.voucher-item-row {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.voucher-item-row:hover:not(.opacity-50) {
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-xxs {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 6px;
    line-height: 1;
}

#voucher-collapse-list .card {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

#voucher-collapse-list .card::-webkit-scrollbar {
    width: 6px;
}

#voucher-collapse-list .card::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

