/* === POS Custom Styles — Biru Modern === */
:root {
    --pos-primary:       #1565C0;
    --pos-primary-dk:    #0D47A1;
    --pos-secondary:     #1976D2;
    --pos-primary-light: #E3F2FD;
    --pos-accent:     #42A5F5;
    --pos-sidebar-w:  240px;
    --pos-bg:         #F5F7FA;
    --pos-card:       #FFFFFF;
    --pos-text:       #212121;
    --pos-muted:      #757575;
    --pos-border:     #E0E0E0;
    --pos-success:    #2E7D32;
    --pos-danger:     #C62828;
    --pos-warning:    #E65100;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    background: var(--pos-bg);
    color: var(--pos-text);
    margin: 0;
}

/* ---- Sidebar ---- */
#pos-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--pos-sidebar-w);
    height: 100vh;
    background: var(--pos-primary-dk);
    overflow-y: auto;
    z-index: 1030;
    transition: transform .25s ease;
}
#pos-sidebar .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
#pos-sidebar .sidebar-brand img {
    width: 36px; height: 36px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
}
#pos-sidebar .sidebar-brand span {
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.2;
    word-break: break-word;
}
#pos-sidebar .nav-section {
    padding: 10px 12px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    color: rgba(255,255,255,.45);
    text-transform: uppercase;
}
#pos-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: rgba(255,255,255,.82);
    border-radius: 6px;
    margin: 1px 8px;
    font-size: 13.5px;
    transition: background .15s, color .15s;
    text-decoration: none;
}
#pos-sidebar .nav-link:hover,
#pos-sidebar .nav-link.active {
    background: var(--pos-secondary);
    color: #fff;
}
#pos-sidebar .nav-link svg,
#pos-sidebar .nav-link .icon { flex-shrink: 0; }

/* ---- Main Content ---- */
#pos-main {
    margin-left: var(--pos-sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Topbar ---- */
#pos-topbar {
    position: sticky;
    top: 0;
    background: #fff;
    border-bottom: 1px solid var(--pos-border);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1020;
    min-height: 56px;
}
#pos-topbar .topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--pos-text);
}

/* ---- Content Area ---- */
#pos-content {
    flex: 1;
    padding: 24px;
}

/* ---- Cards ---- */
.pos-card {
    background: var(--pos-card);
    border-radius: 10px;
    border: 1px solid var(--pos-border);
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    overflow: hidden;
}
.pos-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--pos-border);
    padding: 14px 20px;
    font-weight: 600;
    font-size: 14px;
}

/* ---- Stat Cards ---- */
.stat-card {
    background: var(--pos-card);
    border-radius: 10px;
    border: 1px solid var(--pos-border);
    padding: 18px 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.stat-card .stat-label {
    font-size: 12px;
    color: var(--pos-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px;
}
.stat-card .stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--pos-primary);
    line-height: 1.1;
}
.stat-card .stat-icon {
    font-size: 28px;
    opacity: .2;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

/* ---- Buttons ---- */
.btn-pos-primary {
    background: var(--pos-primary);
    border-color: var(--pos-primary);
    color: #fff;
}
.btn-pos-primary:hover {
    background: var(--pos-primary-dk);
    border-color: var(--pos-primary-dk);
    color: #fff;
}

/* ---- Tables ---- */
.pos-table { width: 100%; border-collapse: collapse; }
.pos-table th {
    background: #F5F7FA;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--pos-muted);
    padding: 10px 14px;
    border-bottom: 2px solid var(--pos-border);
    white-space: nowrap;
}
.pos-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--pos-border);
    vertical-align: middle;
}
.pos-table tr:last-child td { border-bottom: none; }
.pos-table tr:hover td { background: rgba(21,101,192,.04); }

/* ---- Deskripsi Halaman ---- */
.pos-page-info {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #f0f4ff;
    border-left: 3px solid #4f6ef7;
    color: #374151;
    font-size: 13px;
    line-height: 1.5;
    padding: 10px 16px;
    margin-bottom: 16px;
    border-radius: 0 6px 6px 0;
}

/* ---- Flash Messages ---- */
.pos-flash {
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.pos-flash-success { background: #E8F5E9; color: #1B5E20; border: 1px solid #A5D6A7; }
.pos-flash-error   { background: #FFEBEE; color: #B71C1C; border: 1px solid #EF9A9A; }
.pos-flash-info    { background: #E3F2FD; color: #0D47A1; border: 1px solid #90CAF9; }

/* ---- Login Page ---- */
.pos-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--pos-primary-dk) 0%, var(--pos-secondary) 100%);
}
.pos-login-box {
    background: #fff;
    border-radius: 14px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.pos-login-box .login-logo {
    text-align: center;
    margin-bottom: 24px;
}
.pos-login-box .login-logo img {
    max-height: 60px;
    margin-bottom: 10px;
}
.pos-login-box .login-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--pos-primary);
    text-align: center;
    margin-bottom: 4px;
}
.pos-login-box .login-sub {
    font-size: 12px;
    color: var(--pos-muted);
    text-align: center;
    margin-bottom: 24px;
}

/* ---- Kasir Split Layout ---- */
#kasir-wrap {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
}
#kasir-kiri {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fff;
    border-right: 1px solid var(--pos-border);
}
#kasir-kanan {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--pos-bg);
}
#kasir-cart-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}
#kasir-cart-footer {
    border-top: 2px solid var(--pos-border);
    padding: 16px;
    background: #fff;
}
.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--pos-border);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-nama { flex: 1; font-weight: 500; font-size: 13px; }
.cart-item-harga { font-size: 12px; color: var(--pos-muted); }
.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 4px;
}
.cart-item-qty button {
    width: 26px; height: 26px;
    border-radius: 6px;
    border: 1px solid var(--pos-border);
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-item-qty input {
    width: 44px;
    text-align: center;
    border: 1px solid var(--pos-border);
    border-radius: 6px;
    padding: 2px 4px;
    font-size: 13px;
}
.cart-item-subtotal { font-weight: 600; min-width: 80px; text-align: right; font-size: 13px; }
.cart-item-del {
    background: none; border: none; cursor: pointer;
    color: var(--pos-danger); font-size: 16px; padding: 2px 4px;
}

/* ---- Produk Search Results ---- */
#produk-hasil {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--pos-border);
    border-radius: 0 0 8px 8px;
    z-index: 500;
    max-height: 320px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.produk-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--pos-border);
    transition: background .12s;
}
.produk-item:hover { background: var(--pos-primary-light); }
.produk-item:last-child { border-bottom: none; }
.produk-item-nama { font-weight: 500; font-size: 13px; }
.produk-item-kode { font-size: 11px; color: var(--pos-muted); }
.produk-item-harga { font-weight: 700; color: var(--pos-primary); font-size: 13px; }
.produk-item-stok  { font-size: 11px; color: var(--pos-muted); }

/* ---- RFID / Santri Panel ---- */
#santri-panel {
    background: var(--pos-primary-light);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    border: 1px solid var(--pos-accent);
}
#santri-panel .santri-nama { font-weight: 700; font-size: 15px; }
#santri-panel .santri-saldo { color: var(--pos-primary); font-weight: 600; }

/* ---- Utilities ---- */
.text-rupiah { font-variant-numeric: tabular-nums; }
.fw-600 { font-weight: 600; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.cursor-pointer { cursor: pointer; }
.rounded-8 { border-radius: 8px !important; }
.btn-xs { padding: 1px 6px; font-size: 11px; line-height: 1.5; border-radius: 3px; }

/* ---- Responsive: mobile sidebar tersembunyi ---- */
@media (max-width: 768px) {
    #pos-sidebar { transform: translateX(-100%); }
    #pos-sidebar.show { transform: translateX(0); }
    #pos-main { margin-left: 0; }
    #kasir-wrap { flex-direction: column; height: auto; }
    #kasir-kanan { width: 100%; }
}

/* ---- Print ---- */
@media print {
    #pos-sidebar, #pos-topbar, .no-print, .btn-print-laporan,
    form[method="GET"], .pos-flash { display: none !important; }
    #pos-main { margin-left: 0 !important; padding: 0 !important; }
    #pos-content { padding: 0 !important; }
    body { background: #fff; font-size: 12px; }
    .pos-card { box-shadow: none !important; border: 1px solid #ddd; }
    .pos-stat-card { box-shadow: none !important; border: 1px solid #ddd; }
    table { page-break-inside: auto; }
    tr { page-break-inside: avoid; }
}

/* Print trigger button (shown on laporan pages) */
.btn-print-laporan {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

/* ================================================================
   SEARCHABLE SELECT — ss-* classes
   ================================================================ */

.ss-wrap {
    position: relative;
    display: block;
    width: 100%;
}

/* ── Tombol ── */
.ss-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: .375rem .75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: .375rem;
    cursor: pointer;
    gap: 6px;
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.ss-btn.ss-sm      { padding: .25rem .5rem; font-size: .875rem; border-radius: .25rem; }
.ss-btn:hover      { border-color: #adb5bd; }
.ss-btn:focus      { outline: 0; border-color: #86b7fe; box-shadow: 0 0 0 .25rem rgba(13,110,253,.25); }
.ss-btn.open       { border-color: #86b7fe; box-shadow: 0 0 0 .25rem rgba(13,110,253,.25); }

.ss-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    min-width: 0;
}

/* SVG caret — ukuran dikunci lewat atribut width/height di HTML, CSS hanya untuk transisi */
.ss-caret-icon {
    flex-shrink: 0;
    display: block;
    color: #6c757d;
    transition: transform .2s ease;
}
.ss-btn.open .ss-caret-icon { transform: rotate(180deg); }

/* ── Panel — TERSEMBUNYI secara default ── */
.ss-panel {
    display: none;           /* HIDDEN */
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1060;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: .5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.13);
    overflow: hidden;
    min-width: 180px;
    /* flex-direction column diterapkan HANYA saat open, via inline style di JS */
}
.ss-panel.open {
    display: flex;
    flex-direction: column;
}
.ss-panel.up {
    top: auto;
    bottom: calc(100% + 4px);
}

/* ── Baris pencarian ── */
.ss-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border-bottom: 1px solid #f0f2f5;
    background: #f8f9fa;
    flex-shrink: 0;
}
.ss-search-icon {
    flex-shrink: 0;
    display: block;
    color: #9ca3af;
}
.ss-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-size: .875rem;
    color: #212529;
    padding: 0;
    line-height: 1.5;
}
.ss-input::placeholder { color: #adb5bd; }

/* ── Daftar ── */
.ss-list {
    overflow-y: auto;
    max-height: 224px;
    padding: 4px 0;
}
.ss-list::-webkit-scrollbar       { width: 4px; }
.ss-list::-webkit-scrollbar-track { background: transparent; }
.ss-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

.ss-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    font-size: .875rem;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background .08s;
}
.ss-item:hover,
.ss-item.ss-item-active { background: var(--pos-primary-light); color: var(--pos-primary); }

.ss-item.ss-selected     { font-weight: 600; color: var(--pos-primary); }
.ss-tick                 { flex-shrink: 0; display: block; color: var(--pos-primary); }
.ss-tick-gap             { display: inline-block; width: 12px; flex-shrink: 0; }

/* ── Kosong ── */
.ss-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    font-size: .85rem;
    color: #9ca3af;
}

/* ── Highlight ── */
mark.ss-mark {
    padding: 0 1px;
    background: #fef3c7;
    color: #78350f;
    border-radius: 2px;
    font-weight: 600;
}
