/* Modern POS Design System - Kopsis SMKN 1 Jepara Theme (Ocean Blue, Gold & Cyan) */
:root {
    --pos-bg: #091328;
    --pos-card-bg: #102040;
    --pos-border: #1e3a8a;
    --pos-primary: #0284c7;
    --pos-primary-hover: #0369a1;
    --pos-accent: #f59e0b;
    --pos-accent-hover: #d97706;
    --pos-danger: #ef4444;
    --pos-warning: #f59e0b;
    --pos-text: #f8fafc;
    --pos-muted: #94a3b8;
    --pos-cart-bg: #0f1c38;
}

/* Alpine x-cloak helper to prevent un-rendered HTML flashing */
[x-cloak] {
    display: none !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--pos-bg);
    color: var(--pos-text);
    overflow-x: hidden;
    touch-action: manipulation;
}

/* Global Form Controls & Input Text Color Overrides for Dark Theme */
.form-control,
.form-select,
input,
textarea,
select {
    color: #ffffff !important;
    background-color: #091328 !important;
    border-color: #1e3a8a !important;
}

.form-control:focus,
.form-select:focus,
input:focus,
textarea:focus,
select:focus {
    color: #ffffff !important;
    background-color: #102040 !important;
    border-color: var(--pos-accent) !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25) !important;
}

.form-control::placeholder,
textarea::placeholder,
input::placeholder {
    color: #94a3b8 !important;
    opacity: 1;
}

.form-select option {
    background-color: #102040 !important;
    color: #ffffff !important;
}

.form-label {
    color: #cbd5e1 !important;
    font-weight: 500;
}

/* Navbar */
.navbar-pos {
    background: linear-gradient(180deg, #091328 0%, #060d1d 100%);
    border-bottom: 2px solid #1e3a8a;
    padding: 0.4rem 1.2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.brand-title {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.3px;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.brand-logo-img {
    height: 44px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(2, 132, 199, 0.4));
    transition: transform 0.25s ease;
}

.brand-logo-img:hover {
    transform: scale(1.06) rotate(-2deg);
}

.brand-logo-container {
    background: rgba(16, 32, 64, 0.7);
    border: 1px solid rgba(2, 132, 199, 0.3);
    border-radius: 12px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: inset 0 0 10px rgba(245, 158, 11, 0.1);
}

.brand-badge {
    background: linear-gradient(135deg, #0284c7, #1d4ed8);
    border: 1px solid #f59e0b;
    color: #ffffff;
    padding: 0.25rem 0.65rem;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 800;
    margin-left: 0.5rem;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    letter-spacing: 0.5px;
}

/* POS Container Layout (10.1" Landscape Split View) */
.pos-container {
    display: flex;
    height: calc(100vh - 65px);
    overflow: hidden;
}

.pos-catalog {
    flex: 1 1 62%;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow-y: auto;
    border-right: 1px solid var(--pos-border);
}

.pos-cart {
    flex: 0 0 38%;
    display: flex;
    flex-direction: column;
    background-color: var(--pos-cart-bg);
    padding: 1rem;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

/* Category Nav Pills */
.category-pills {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    scrollbar-width: thin;
}

.category-pill {
    padding: 0.6rem 1.1rem;
    border-radius: 12px;
    background: var(--pos-card-bg);
    border: 1px solid var(--pos-border);
    color: var(--pos-text);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-pill.active {
    background: linear-gradient(135deg, #0284c7, #1d4ed8);
    border-color: #f59e0b;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.5);
}

.category-pill:hover:not(.active) {
    background: #1e3a8a;
}

/* Search & Barcode Bar */
.search-box {
    position: relative;
    margin-bottom: 1rem;
}

.search-box input {
    background: #060d1d !important;
    border: 1px solid #1e3a8a !important;
    color: #ffffff !important;
    border-radius: 12px;
    padding: 0.75rem 1rem 0.75rem 2.8rem;
    font-size: 0.95rem;
}

.search-box input:focus {
    background: #102040 !important;
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25) !important;
}

.search-box .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pos-muted);
}

/* Product Cards Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.85rem;
    padding-bottom: 2rem;
}

.product-card {
    background: var(--pos-card-bg);
    border: 1px solid var(--pos-border);
    border-radius: 14px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    user-select: none;
    position: relative;
    min-height: 140px;
}

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

.product-card:hover {
    border-color: #f59e0b;
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.3);
}

.product-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #f8fafc;
    margin-bottom: 0.3rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-barcode {
    font-size: 0.75rem;
    color: var(--pos-muted);
    font-family: monospace;
}

.product-price {
    font-size: 1rem;
    font-weight: 800;
    color: #38bdf8;
    margin-top: 0.5rem;
}

.stock-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.stock-badge.low {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.stock-badge.out {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Cart Side Panel */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--pos-border);
    margin-bottom: 0.75rem;
}

.cart-items-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding-right: 0.2rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #060d1d;
    border: 1px solid var(--pos-border);
    border-radius: 10px;
    padding: 0.7rem;
    margin-bottom: 0.6rem;
}

.cart-item-info {
    flex: 1;
    margin-right: 0.5rem;
}

.cart-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

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

.cart-qty-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-qty {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: #1e3a8a;
    color: #ffffff;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
}

.btn-qty:active {
    background: var(--pos-accent);
    color: #000000;
}

.cart-summary {
    background: #060d1d;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--pos-border);
    margin-bottom: 1rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--pos-muted);
    margin-bottom: 0.4rem;
}

.summary-row.total {
    font-size: 1.3rem;
    font-weight: 800;
    color: #ffffff;
    border-top: 1px dashed var(--pos-border);
    padding-top: 0.6rem;
    margin-top: 0.6rem;
    margin-bottom: 0;
}

/* Pay Button */
.btn-pay {
    width: 100%;
    padding: 1rem;
    border-radius: 14px;
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    color: #000000;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.btn-pay:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.btn-pay:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quick Pay Money Buttons */
.money-shortcuts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-money {
    background: #102040;
    border: 1px solid var(--pos-border);
    color: #f8fafc;
    border-radius: 8px;
    padding: 0.6rem 0.2rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
}

.btn-money:active {
    background: var(--pos-primary);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
    background: #1e3a8a;
    border-radius: 4px;
}

/* Barcode Status Pulse */
.barcode-pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #38bdf8;
    box-shadow: 0 0 8px #38bdf8;
    margin-right: 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(56, 189, 248, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

/* 58mm Thermal Print CSS */
@media print {
    body * {
        visibility: hidden;
    }
    #receipt-print-area, #receipt-print-area * {
        visibility: visible;
    }
    #receipt-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 58mm;
        margin: 0;
        padding: 2mm;
        font-family: 'Courier New', Courier, monospace;
        font-size: 10pt;
        line-height: 1.2;
        color: #000;
        background: #fff;
    }
    @page {
        size: 58mm auto;
        margin: 0;
    }
}
