/**
 * GalpaPOS - Core Stylesheet
 * Desktop iPos 5 Style & Responsive Foundation
 */

:root {
    --pos-primary: #0284c7;
    --pos-primary-hover: #0369a1;
    --pos-primary-light: #e0f2fe;
    --pos-secondary: #475569;
    --pos-success: #10b981;
    --pos-warning: #f59e0b;
    --pos-danger: #ef4444;
    --pos-bg: #f8fafc;
    --pos-card-bg: #ffffff;
    --pos-border: #e2e8f0;
    --pos-text-main: #0f172a;
    --pos-text-muted: #64748b;
    --pos-sidebar-width: 250px;
    --pos-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --pos-mono: 'JetBrains Mono', monospace;
}

body {
    font-family: var(--pos-font);
    background-color: var(--pos-bg);
    color: var(--pos-text-main);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

/* Layout Wrapper */
.pos-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
.pos-sidebar {
    width: var(--pos-sidebar-width);
    background: #ffffff;
    border-right: 1px solid var(--pos-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.25s ease-in-out;
}

.sidebar-menu-wrapper {
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav .nav-header {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.05em;
    padding: 12px 14px 4px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    color: #334155;
    font-weight: 500;
    font-size: 13.5px;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: all 0.15s ease;
}

.sidebar-nav .nav-link i {
    font-size: 17px;
    color: #64748b;
    transition: color 0.15s ease;
}

.sidebar-nav .nav-link:hover {
    background-color: #f1f5f9;
    color: var(--pos-primary);
}

.sidebar-nav .nav-link:hover i {
    color: var(--pos-primary);
}

.sidebar-nav .nav-link.active {
    background-color: var(--pos-primary-light);
    color: var(--pos-primary);
    font-weight: 600;
}

.sidebar-nav .nav-link.active i {
    color: var(--pos-primary);
}

/* Main Content Area */
.pos-main {
    flex: 1;
    margin-left: var(--pos-sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pos-topbar {
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.pos-content {
    flex: 1;
    padding: 0;
}

.avatar-circle-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

/* Online / Offline Status Badge */
.connection-status-badge {
    font-size: 12px;
    letter-spacing: 0.03em;
}

.pulse-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.9; }
    50% { transform: scale(1.2); opacity: 0.5; }
    100% { transform: scale(0.95); opacity: 0.9; }
}

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1030;
}

@media (max-width: 991.98px) {
    .pos-sidebar {
        transform: translateX(-100%);
    }
    .pos-sidebar.show {
        transform: translateX(0);
    }
    .pos-main {
        margin-left: 0;
    }
    .sidebar-backdrop.show {
        display: block;
    }
}

/* Cashier POS iPos 5 Full Layout */
.pos-screen-container {
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-split-view {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.pos-left-catalog {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--pos-border);
    background: #f8fafc;
    overflow: hidden;
}

.pos-right-cart {
    width: 440px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.03);
    z-index: 10;
}

@media (max-width: 1199.98px) {
    .pos-right-cart {
        width: 380px;
    }
}

/* Category Pills */
.pos-category-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 15px;
    background: #ffffff;
    border-bottom: 1px solid var(--pos-border);
    white-space: nowrap;
}

.btn-cat-chip {
    border-radius: 20px;
    font-size: 13px;
    padding: 6px 14px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-cat-chip:hover {
    background: #f1f5f9;
    color: var(--pos-primary);
}

.btn-cat-chip.active {
    background: var(--pos-primary);
    color: #ffffff;
    border-color: var(--pos-primary);
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

/* Product Card Grid */
.pos-product-grid {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    align-content: flex-start;
}

.pos-product-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.pos-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.06);
    border-color: #cbd5e1;
}

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

.pos-product-thumb {
    width: 100%;
    height: 125px;
    object-fit: cover;
    background: #f1f5f9;
}

.pos-product-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 11px;
    padding: 3px 7px;
    border-radius: 6px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pos-product-info {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pos-product-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.pos-product-price {
    font-family: var(--pos-mono);
    font-weight: 700;
    font-size: 14px;
    color: var(--pos-primary);
}

/* Cart Items List */
.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px 15px;
}

.pos-cart-row {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    transition: background 0.15s;
}

.pos-cart-row:hover {
    background: #f1f5f9;
}

.pos-cart-summary {
    background: #ffffff;
    border-top: 2px dashed #e2e8f0;
    padding: 15px;
}

.grand-total-display {
    font-family: var(--pos-mono);
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
}

/* Shortcuts Bar Bottom (iPos 5 Style) */
.pos-shortcuts-bar {
    background: #1e293b;
    color: #f8fafc;
    padding: 8px 15px;
    font-size: 12px;
    display: flex;
    gap: 15px;
    overflow-x: auto;
    white-space: nowrap;
}

.shortcut-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.shortcut-key {
    background: #334155;
    color: #38bdf8;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--pos-mono);
    font-weight: 700;
    font-size: 11px;
}

/* Print Thermal Receipt (ESC/POS 58mm / 80mm preview) */
.receipt-paper {
    width: 320px;
    margin: 0 auto;
    background: #fff;
    padding: 15px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 4px;
    color: #000;
}

@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;
    }
    .no-print {
        display: none !important;
    }
}
