:root {
    --primary: #CD7C32; 
    --secondary: #101010;
    --bg-color: #EEEEEE; 
    --card-bg: #FFFFFF;
    --text-main: #101010; 
    --text-muted: #6F6F6F; 
    --border-color: #E2E2E2;
    --success: #10B981;
    --danger: #EF4444; 
    --warning: #F59E0B;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius-md: 12px;
    --radius-pill: 50px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', 'Poppins', system-ui, -apple-system, sans-serif; }
body { background: var(--bg-color); color: var(--text-main); }

/* LOGIN UI */
.login-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 2000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(5px);}
.login-box { background: #FFFFFF; padding: 40px; border-radius: var(--radius-md); text-align: center; max-width: 380px; width: 90%; border: 1px solid var(--border-color); box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.login-input { width: 100%; padding: 14px; border-radius: var(--radius-md); border: 1px solid var(--border-color); margin-bottom: 20px; background: #FAFAFA; font-size: 14px; }
.login-btn { background: var(--primary); color: white; width: 100%; padding: 14px; border: none; border-radius: var(--radius-pill); cursor: pointer; font-weight: 700; text-transform: uppercase; font-size: 13px; letter-spacing: 0.5px; }
.login-btn:hover { background: #222222; }

.app-header { background: var(--secondary); padding: 15px 20px; display: flex; align-items: center; gap: 15px; border-bottom: 1px solid #333; position: sticky; top: 0; z-index: 40; }
.hamburger-btn { background: none; border: none; font-size: 26px; cursor: pointer; color: #FFF; }
.app-header h1 { font-size: 22px; color: #FFF; font-weight: 700; letter-spacing: -0.5px; }

.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 99; opacity: 0; pointer-events: none; transition: 0.3s; }
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }
.sidebar { position: fixed; top: 0; bottom: 0; left: -280px; width: 260px; background: var(--secondary); z-index: 100; transition: 0.3s; display: flex; flex-direction: column; border-right: 1px solid var(--border-color); }
.sidebar.open { left: 0; }
.sidebar-header { padding: 20px; display: flex; justify-content: space-between; border-bottom: 1px solid #333; align-items: center;}
.store-name { font-weight: 800; font-size: 18px; letter-spacing: -0.5px; color: var(--primary); }
.close-sidebar-btn { background: none; border: none; font-size: 28px; color: #FFF; cursor: pointer; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 15px 20px; font-weight: 500; cursor: pointer; color: #CCC; }
.menu-item:hover { background: #222; color: #FFF; }
.menu-item.active { background: #222; color: var(--primary); font-weight: 700; border-right: 4px solid var(--primary); }
.menu-list { flex: 1; overflow-y: auto; padding-bottom: 20px; }

.app-container { padding: 20px 15px; max-width: 1200px; margin: 0 auto; }
.dashboard-cards { display: grid; gap: 15px; }
.dash-card { background: var(--card-bg); padding: 20px; border-radius: var(--radius-md); border: 1px solid var(--border-color); border-top: 4px solid var(--primary); }
.dash-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 8px;}

/* POS CASHIER */
.main-content { display: flex; gap: 20px; }
@media (max-width: 800px) { .main-content { flex-direction: column; } }
.products-section, .cart-section { background: var(--card-bg); padding: 20px; border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.products-section { flex: 2; } .cart-section { flex: 1; }
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; margin-top: 15px;}

.product-card { border: 1px solid var(--border-color); padding: 14px; border-radius: 12px; text-align: left; transition: 0.18s ease; background: #FFFFFF; display: flex; flex-direction: column; }
.product-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.06); }
.product-card img { width: 100%; height: 130px; object-fit: cover; border-radius: 10px; margin-bottom: 10px; background: var(--bg-color); }
.product-card__badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.product-card__title { font-size: 13px; font-weight: 600; color: #111827; line-height: 1.35; margin: 0 0 6px; height: 36px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; letter-spacing: -0.1px; cursor: pointer; transition: color 0.15s; }
.product-card__title:hover { color: var(--primary); }
.product-card .price { font-size: 17px; color: var(--primary); font-weight: 800; margin: 0 0 4px; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }
.product-card__stock { font-size: 11px; color: #6B7280; margin: 0 0 10px; font-weight: 500; }
.product-card .stock { font-size: 12px; background: var(--bg-color); padding: 4px; margin-bottom: 10px; border-radius: 4px;}
.product-card button { background: var(--primary); color: white; border: none; padding: 10px 14px; width: 100%; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 13px; letter-spacing: 0.2px; margin-top: auto; transition: 0.15s; }
.product-card button:hover { background: var(--primary-700, #A05F22); transform: translateY(-1px); }
.product-card button:disabled { background: #E5E7EB; color: #9CA3AF; cursor: not-allowed; transform: none; }

input, select, textarea { width: 100%; padding: 14px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: #FAFAFA; color: var(--text-main); font-size: 14px; margin-bottom:10px; transition: 0.2s;}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: #FFFFFF;}
.small-lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); display: block; margin-bottom: 6px; }

/* INVENTORY (WMS) */
.btn-primary, .btn-secondary, .btn-success, .btn-dark { padding: 14px 24px; border: none; border-radius: var(--radius-pill); color: white; cursor: pointer; font-weight: 600; margin-bottom:10px; text-transform: uppercase; font-size: 12px; letter-spacing: 0.5px;}
.btn-primary { background: var(--primary); }
.btn-secondary { background: var(--text-muted); }
.btn-success { background: var(--success); width: 100%;}
.btn-dark { background: #111827; }

.admin-card { background: var(--card-bg); padding: 25px; border-radius: var(--radius-md); border: 1px solid var(--border-color); margin-bottom: 20px; }

/* TABLE */
.table-responsive { overflow-x: auto; background: var(--card-bg); border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.inventory-table { width: 100%; border-collapse: collapse; text-align: left; }
.inventory-table th, .inventory-table td { padding: 15px; border-bottom: 1px solid var(--border-color); font-size: 13px; }
.inventory-table th { background: #FAFAFA; font-weight: 700; color: var(--text-muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px;}
.sku-badge { background: #F3F4F6; color: #4B5563; padding: 2px 7px; border-radius: 5px; font-size: 10px; font-weight: 600; border: 1px solid #E5E7EB; font-family: ui-monospace, SFMono-Regular, monospace; letter-spacing: 0.2px; }
.cat-badge { background: #FEF3C7; color: #92400E; padding: 2px 8px; border-radius: 5px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

.cart-item { display: flex; justify-content: space-between; align-items: center; margin-bottom:15px; border-bottom:1px solid var(--border-color); padding-bottom:15px;}
.cart-item button { width: 28px; height: 28px; border-radius: 14px; border: 1px solid var(--border-color); background: #FFF; cursor: pointer; font-weight: bold;}
.cart-title { font-size: 18px; margin-bottom: 20px; font-weight: 700; border-bottom: 2px solid var(--primary); padding-bottom: 10px; display: inline-block;}
.checkout-btn { background: var(--primary); color: white; padding: 16px; width: 100%; font-weight: 700; border:none; border-radius: var(--radius-pill); cursor:pointer; text-transform: uppercase; letter-spacing: 1px; font-size: 13px; margin-top:20px;}
.checkout-btn:hover { background: #222222; }

.history-card { background: var(--card-bg); padding: 20px; border-left: 4px solid var(--primary); margin-bottom:15px; border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.badge-status { padding: 4px 10px; border-radius: var(--radius-pill); font-size: 10px; font-weight: 700; color:white; text-transform: uppercase; letter-spacing: 0.5px;}

/* MOBILE POS MODE EXCLUSIVE STYLES */
body.pos-mobile-mode .main-content {
    display: block;
    padding-bottom: 80px; /* Space for the floating bottom bar */
}
body.pos-mobile-mode .products-section {
    width: 100%;
    border: none;
    padding: 0;
}
body.pos-mobile-mode .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}
body.pos-mobile-mode .cart-section {
    position: fixed;
    top: 100%;
    left: 0;
    right: 0;
    height: 90vh; /* Bottom sheet height */
    z-index: 5001;
    background: #FFFFFF;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -5px 40px rgba(0,0,0,0.15);
    transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding-bottom: 50px;
}
body.pos-mobile-mode .cart-section.drawer-open {
    top: 10vh; /* slides up and stops 10vh from top */
}
body.pos-mobile-mode .desktop-cart-title {
    display: none;
}
body.pos-mobile-mode .mobile-cart-header {
    display: flex !important;
}
body.pos-mobile-mode #mobileCartFloatingBar {
    display: flex !important;
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--primary);
    color: white;
    padding: 16px 20px;
    border-radius: var(--radius-pill);
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    z-index: 4999;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.2s;
}
body.pos-mobile-mode #mobileCartFloatingBar:active {
    transform: scale(0.98);
}

/* PRINT MEDIA FOR BARCODE LABELS (THERMAL PRINTER FORMAT) */
@media print {
    body * {
        visibility: hidden;
    }
    #printLabelArea, #printLabelArea * {
        visibility: visible;
    }
    #printLabelArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
    }
    /* Specifically style the barcode elements for 50x30mm thermal rolls */
    .barcode-label-wrapper {
        page-break-after: always;
        text-align: center;
        width: 100%;
        margin-bottom: 10px;
    }
    .barcode-label-wrapper img {
        max-width: 100%;
        height: auto;
    }
}
