/* ===== BERESIN KASIR – GLOBAL STYLES ===== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --bg: #f8fafc;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --nav-h: 60px;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    padding-top: var(--nav-h);
}

/* ===== NAV ===== */
.top-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1.1rem;
    white-space: nowrap;
    color: #fff;
}

.nav-logo {
    height: 36px;
    width: auto;
    border-radius: 4px;
    object-fit: contain;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: .25rem;
    flex: 1;
    flex-wrap: wrap;
}

.nav-links a {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    padding: .35rem .75rem;
    border-radius: 6px;
    font-size: .875rem;
    transition: background .15s;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255,255,255,.2);
    color: #fff;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .85rem;
    white-space: nowrap;
}

.btn-logout {
    background: rgba(255,255,255,.15);
    color: #fff !important;
    padding: .3rem .75rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: .8rem;
    transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.3); }

/* ===== CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* ===== CARDS ===== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: var(--text);
}

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    font-size: .8rem;
    color: var(--muted);
    margin-top: .25rem;
}

/* ===== TABLES ===== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

th, td {
    padding: .6rem .75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: #f1f5f9;
    font-weight: 600;
    color: var(--muted);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

tr:hover td { background: #f8fafc; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem 1rem;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    transition: opacity .15s, transform .1s;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    margin-bottom: .35rem;
    color: var(--text);
}

input[type=text], input[type=number], input[type=password],
input[type=email], input[type=file], select, textarea {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: .875rem;
    background: #fff;
    color: var(--text);
    transition: border-color .15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef9c3; color: #a16207; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }

/* ===== ALERTS ===== */
.alert {
    padding: .75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: .875rem;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fef9c3; color: #a16207; border: 1px solid #fde68a; }

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--muted);
    line-height: 1;
}

/* ===== KASIR ===== */
.kasir-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1rem;
    align-items: start;
}

.product-search-box {
    position: relative;
}

.product-suggestions {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.product-suggestions.open { display: block; }

.suggestion-item {
    padding: .6rem .75rem;
    cursor: pointer;
    font-size: .875rem;
    display: flex;
    justify-content: space-between;
}
.suggestion-item:hover { background: #f1f5f9; }

.cart-table td, .cart-table th { padding: .45rem .5rem; }

.cart-summary {
    border-top: 2px solid var(--border);
    padding-top: .75rem;
    margin-top: .5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: .875rem;
    padding: .2rem 0;
}

.summary-row.total {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    border-top: 1px solid var(--border);
    padding-top: .5rem;
    margin-top: .25rem;
}

/* ===== RECEIPT PRINT ===== */
@media print {
    body * { visibility: hidden; }
    #receipt-area, #receipt-area * { visibility: visible; }
    #receipt-area {
        position: fixed;
        top: 0; left: 0;
        width: 80mm;
        font-size: 13px;
        color: #000;
        background: #fff;
    }
}

.receipt-preview {
    width: 300px;
    margin: 0 auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #000;
    background: #fff;
    padding: 1rem;
    border: 1px dashed #ccc;
}

.receipt-header {
    text-align: center;
    margin-bottom: .75rem;
}

.receipt-logo {
    max-height: 80px;
    max-width: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto .5rem;
}

.receipt-shop-name {
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
}

.receipt-address {
    font-size: 12px;
    color: #444;
    margin-top: .2rem;
}

.receipt-divider {
    border: none;
    border-top: 1px dashed #999;
    margin: .5rem 0;
}

.receipt-items table {
    width: 100%;
    font-size: 12px;
}

.receipt-items td { padding: .2rem .2rem; }

.receipt-footer {
    text-align: center;
    font-size: 12px;
    color: #444;
    margin-top: .75rem;
    border-top: 1px dashed #999;
    padding-top: .5rem;
}

/* ===== CHARTS ===== */
.chart-container {
    position: relative;
    height: 280px;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.page-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

/* ===== LOGO PREVIEW ===== */
.logo-preview-box {
    width: 120px;
    height: 80px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8fafc;
}

.logo-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ===== APP FOOTER ===== */
.app-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: .8rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

.app-footer a { color: var(--primary); }

/* ===== GRID HELPERS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.flex-row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); font-size: .85rem; }
.fw-bold { font-weight: 700; }

@media (max-width: 768px) {
    .kasir-layout { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .nav-links { display: none; }
}

/* ===== PRODUCT IMAGES ===== */
.product-thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    display: block;
}

.product-thumb:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.product-thumb-empty {
    width: 52px;
    height: 52px;
    border-radius: 6px;
    border: 1px dashed var(--border);
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--muted);
}

.product-preview-box {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    max-width: 200px;
}

.product-preview-box img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 200px;
    object-fit: contain;
}
