/* Khau POS - High-Contrast Minimalist Light Theme & Professional Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    --success: #059669;
    --success-light: #ecfdf5;
    --warning: #d97706;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --text-main: #0f172a; /* Slate 900 - High Contrast */
    --text-muted: #475569; /* Slate 600 - High Contrast Muted */
    --border-color: #cbd5e1; /* Slate 300 - High Contrast Border */
    --focus-ring: 0 0 0 3px rgba(79, 70, 229, 0.25);
    --radius: 10px;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', -apple-system, sans-serif; }

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* Navbar */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.3px;
}

.brand-icon {
    background: var(--accent);
    color: #ffffff;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-links { display: flex; gap: 4px; align-items: center; }

.nav-item {
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.nav-item:hover {
    color: var(--text-main);
    background: #e2e8f0;
}

.nav-item.active {
    color: var(--accent);
    background: var(--accent-light);
    font-weight: 700;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.825rem;
    color: var(--text-main);
    font-weight: 600;
}

.role-pill {
    background: var(--accent);
    color: #ffffff;
    font-size: 0.685rem;
    text-transform: uppercase;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.3px;
}

/* Layout */
.main-container {
    flex: 1;
    padding: 24px;
    max-width: 1750px;
    margin: 0 auto;
    width: 100%;
}

.pos-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
}

@media (max-width: 1024px) {
    .pos-grid { grid-template-columns: 1fr; }
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    letter-spacing: -0.2px;
}

/* Metric Cards System */
.metric-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.15s ease;
}

.metric-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.metric-label {
    font-size: 0.775rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.metric-value.success { color: var(--success); }
.metric-value.primary { color: var(--accent); }
.metric-value.info { color: #2563eb; }
.metric-value.warning { color: var(--warning); }

/* Form & Inputs */
.form-group { margin-bottom: 14px; }
label { display: block; font-size: 0.8rem; font-weight: 700; color: #334155; margin-bottom: 6px; }

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.input-mono { font-family: 'JetBrains Mono', monospace; font-weight: 700; }

/* Table */
.table-responsive { overflow-x: auto; margin-top: 8px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th {
    text-align: left;
    padding: 11px 14px;
    background: #e2e8f0; /* Clear high-contrast header background */
    color: #1e293b; /* Slate 800 bold headers */
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #cbd5e1;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    color: var(--text-main);
    font-weight: 500;
}

tr:hover td { background: #f1f5f9; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.25;
}

.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-success { background: var(--success); color: #ffffff; }
.btn-success:hover { background: #047857; }

.btn-danger { background: var(--danger); color: #ffffff; }
.btn-danger:hover { background: #b91c1c; }

.btn-outline { background: #ffffff; border: 1px solid var(--border-color); color: #1e293b; font-weight: 600; }
.btn-outline:hover { background: #f1f5f9; border-color: #94a3b8; }

.btn-block { width: 100%; }

/* Hotkey Pills */
.kbd {
    background: #e2e8f0;
    border: 1px solid #94a3b8;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: #0f172a;
}

/* Totals Summary Box */
.summary-box {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
    margin-top: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.875rem;
    color: #475569;
    font-weight: 600;
}

.summary-row.total {
    border-top: 2px solid var(--border-color);
    margin-top: 6px;
    padding-top: 10px;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--success);
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: #ffffff;
    color: var(--text-main);
    padding: 12px 18px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow-md);
    font-size: 0.875rem;
    font-weight: 600;
    animation: slideIn 0.25s ease;
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Receipt Thermal Paper Modal (80mm Restaurant POS Standard) */
#receipt-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.receipt-paper {
    background: #ffffff;
    color: #000000;
    width: 310px; /* 80mm Standard POS Thermal Width */
    padding: 16px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.3;
    box-shadow: var(--shadow-md);
    border-radius: 6px;
}

.receipt-header { text-align: center; margin-bottom: 12px; }
.receipt-header h2 { font-size: 18px; font-weight: bold; margin-bottom: 2px; }
.receipt-header p { font-size: 11px; margin: 2px 0; }
.receipt-table { width: 100%; margin: 8px 0; border-collapse: collapse; }
.receipt-table th, .receipt-table td { color: #000; background: none; border: none; padding: 4px 0; font-size: 11px; font-family: 'JetBrains Mono', monospace; }
.receipt-divider { border-top: 1px dashed #000; margin: 8px 0; }

@media print {
    @page {
        size: 80mm auto;
        margin: 0;
    }
    body {
        margin: 0;
        padding: 0;
        background: #ffffff;
    }
    body * { visibility: hidden; }
    #receipt-paper, #receipt-paper * { visibility: visible; }
    #receipt-paper {
        position: absolute;
        left: 0;
        top: 0;
        width: 78mm;
        margin: 0;
        padding: 4mm;
        box-shadow: none;
        border-radius: 0;
    }
}

.dropdown-item-row {
    padding: 10px 14px;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
    transition: background 0.1s ease;
}

.dropdown-item-row:hover, .dropdown-item-row.active {
    background: #eef2ff;
    color: var(--accent);
    font-weight: 700;
}

/* Lucide Icon styling */
.icon-inline {
    width: 16px;
    height: 16px;
    stroke-width: 2.2px;
    vertical-align: middle;
}

/* Responsive Grid & Layout Utilities */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.action-button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}
@media (max-width: 480px) {
    .action-button-grid {
        grid-template-columns: 1fr;
    }
}

.pos-input-group {
    display: grid;
    grid-template-columns: 120px 1fr 100px 160px;
    gap: 12px;
    margin-bottom: 16px;
}
@media (max-width: 576px) {
    .pos-input-group {
        grid-template-columns: 1fr;
    }
}

.split-fields-group {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}
@media (max-width: 480px) {
    .split-fields-group {
        grid-template-columns: 1fr;
    }
}

.lookup-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    width: 190px;
}
@media (max-width: 480px) {
    .lookup-column {
        width: 100%;
        max-width: 100%;
    }
}
