/* =====================================================
   TECHHUB POS — DESIGN SYSTEM
   Palette: near-black slate + electric blue accent.
   Signature element: the "ticket" card (dashed edge,
   monospace figures) echoing a real receipt chit.
   NOTE: the --gold variable name is kept for backwards
   compatibility with .btn-gold / accent classes below —
   its value is now a tech blue, not literal gold.
   ===================================================== */

:root {
    --bg:            #0F1216;
    --surface:       #171B21;
    --surface-2:     #1E232B;
    --border:        #2C333D;
    --text:          #EDF1F5;
    --text-muted:    #92A0AD;
    --gold:          #3B82C4;
    --gold-dim:      #2A5D8F;
    --restaurant:    #4A9B7F;
    --restaurant-dim:#2E6350;
    --bar:           #C8933C;
    --bar-dim:       #8F6A2C;
    --hotel:         #8E6BA8;
    --hotel-dim:     #5E4772;
    --success:       #4A9B7F;
    --danger:        #C05A5A;
    --warning:       #C8933C;
    --radius:        10px;
    --font-display:  'Sora', -apple-system, sans-serif;
    --font-body:     'Inter', -apple-system, sans-serif;
    --font-mono:     'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

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

h1, h2, h3, .display {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
}

a { color: var(--gold); text-decoration: none; }
.text-muted { color: var(--text-muted) !important; }
.mono { font-family: var(--font-mono); }

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
}

.sidebar .brand {
    font-family: var(--font-display);
    font-size: 1.3rem;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.sidebar .brand span { color: var(--gold); }

.sidebar .outlet-tag {
    padding: 0 20px 16px;
    font-size: .78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: var(--text-muted);
    font-size: .92rem;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active {
    color: var(--text);
    background: var(--surface-2);
    border-left-color: var(--gold);
}
.nav-section-label {
    padding: 16px 20px 6px;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--gold-dim);
}

.main-content { flex: 1; padding: 28px 32px; max-width: 100%; overflow-x: hidden; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.stat-card { padding: 18px 20px; }
.stat-card .stat-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-card .stat-value { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 600; margin-top: 4px; }

/* ---------- Ticket signature element ---------- */
.ticket {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    position: relative;
    font-family: var(--font-mono);
}
.ticket::before {
    content: "";
    position: absolute;
    top: -1px; left: -1px; right: -1px;
    height: 6px;
    background-image: radial-gradient(circle at 6px 3px, var(--bg) 3px, transparent 3px);
    background-size: 12px 6px;
    background-repeat: repeat-x;
}
.ticket-header {
    border-bottom: 1px dashed var(--border);
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ticket-body { padding: 12px 14px; }
.ticket-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: .88rem; }
.ticket-footer {
    border-top: 1px dashed var(--border);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    font-weight: 700;
}

/* ---------- Module badges/accents ---------- */
.badge-module {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
}
.badge-restaurant { background: rgba(107,143,113,.15); color: var(--restaurant); border: 1px solid var(--restaurant-dim); }
.badge-bar { background: rgba(168,69,90,.15); color: var(--bar); border: 1px solid var(--bar-dim); }
.badge-hotel { background: rgba(110,134,184,.15); color: var(--hotel); border: 1px solid var(--hotel-dim); }

.module-toggle-card { border-left: 4px solid var(--border); }
.module-toggle-card.on.restaurant { border-left-color: var(--restaurant); }
.module-toggle-card.on.bar { border-left-color: var(--bar); }
.module-toggle-card.on.hotel { border-left-color: var(--hotel); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    padding: 9px 16px;
    border-radius: 8px;
    font-size: .88rem;
    cursor: pointer;
    transition: all .15s;
}
.btn:hover { border-color: var(--gold-dim); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #1A1400; font-weight: 600; }
.btn-gold:hover { background: #DBAE4D; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(192,73,90,.12); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 10px; font-size: .78rem; }

/* switch toggle */
.switch { position: relative; width: 42px; height: 24px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--border); border-radius: 24px; cursor: pointer; transition: .2s; }
.slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: var(--text); border-radius: 50%; transition: .2s; }
input:checked + .slider { background: var(--gold-dim); }
input:checked + .slider::before { transform: translateX(18px); background: var(--gold); }

/* ---------- Forms ---------- */
.form-label { font-size: .82rem; color: var(--text-muted); margin-bottom: 6px; display: block; }
.form-control, select.form-control, textarea.form-control {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: .92rem;
}
.form-control:focus { outline: none; border-color: var(--gold-dim); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); font-size: .9rem; }
tr:last-child td { border-bottom: none; }

.status-pill { padding: 3px 10px; border-radius: 20px; font-size: .74rem; text-transform: capitalize; }
.status-open, .status-pending { background: rgba(200,155,60,.15); color: var(--gold); }
.status-preparing { background: rgba(200,155,60,.25); color: var(--gold); }
.status-ready, .status-served { background: rgba(90,143,107,.15); color: var(--success); }
.status-paid { background: rgba(90,143,107,.25); color: var(--success); }
.status-void, .status-cancelled { background: rgba(192,73,90,.15); color: var(--danger); }

/* ---------- Category rows (admin menu page) ---------- */
.cat-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.cat-swatch { width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.cat-swatch img { width: 100%; height: 100%; object-fit: cover; }
.cat-swatch-sm { width: 28px; height: 28px; border-radius: 6px; }
.cat-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: .9rem; }
.flash-success { background: rgba(90,143,107,.15); border: 1px solid var(--success); color: var(--success); }
.flash-error { background: rgba(192,73,90,.15); border: 1px solid var(--danger); color: var(--danger); }

/* ---------- POS Terminal ---------- */
.pos-shell { display: grid; grid-template-columns: 1fr 360px; gap: 20px; height: calc(100vh - 40px); }
.pos-menu { overflow-y: auto; padding-right: 8px; }
.category-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.category-tab {
    padding: 8px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer; font-size: .85rem;
    display: inline-flex; align-items: center; gap: 6px;
}
.category-tab.active { background: var(--tab-color, var(--gold)); color: #14120F; border-color: var(--tab-color, var(--gold)); font-weight: 600; }
.category-tab-sub { font-size: .8rem; opacity: .9; }
.cat-tab-img { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; }
.item-card-img { width: 100%; height: 70px; object-fit: cover; border-radius: 6px; margin-bottom: 8px; }

.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.item-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; cursor: pointer; transition: all .12s;
}
.item-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.item-card .item-name { font-size: .92rem; font-weight: 600; margin-bottom: 6px; min-height: 40px; }
.item-card .item-price { font-family: var(--font-mono); color: var(--gold); font-size: .95rem; }
.item-card.unavailable { opacity: .4; pointer-events: none; }

.cart-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; height: 100%; }
.cart-header { padding: 16px; border-bottom: 1px solid var(--border); }
.cart-items { flex: 1; overflow-y: auto; padding: 10px 16px; }
.cart-line { display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .88rem; gap: 10px; }
.cart-line .qty-controls { display: flex; align-items: center; gap: 8px; align-self: center; flex-shrink: 0; }
.qty-btn { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); cursor: pointer; }
.cart-summary { padding: 14px 16px; border-top: 1px solid var(--border); font-family: var(--font-mono); font-size: .9rem; }
.cart-summary .row { display: flex; justify-content: space-between; margin-bottom: 6px; }
.cart-summary .total-row { font-size: 1.15rem; font-weight: 700; color: var(--gold); border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 6px; }
.cart-actions { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }

.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.sp-card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; cursor: pointer; }
.sp-card .sp-label { font-family: var(--font-display); font-size: 1.1rem; }
.sp-card .sp-capacity { font-size: .76rem; color: var(--text-muted); margin-top: 4px; }
.sp-card.available { border-color: var(--success); }
.sp-card.occupied { border-color: var(--gold); background: rgba(200,155,60,.08); }
.sp-card.reserved { border-color: var(--bar); }
.sp-card.cleaning { border-color: var(--text-muted); opacity: .6; }

/* ---------- KDS (kitchen/bar display) ---------- */
.kds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.kds-ticket { border-top: 4px solid var(--gold); }
.kds-ticket.overdue { border-top-color: var(--danger); }
.kds-timer { font-family: var(--font-mono); font-size: .8rem; color: var(--text-muted); }

/* ---------- Login ---------- */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at top, #201B14, var(--bg)); }
.login-card { width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 36px; }
.login-card .brand { text-align: center; margin-bottom: 28px; }
.login-card .brand h1 { font-size: 1.6rem; margin: 0; }
.login-card .brand span { color: var(--gold); }

@media (max-width: 900px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 10px; }
    .pos-shell { grid-template-columns: 1fr; height: auto; }
}

/* =====================================================
   POS TERMINAL LAYOUT — scoped to .classic-pos.
   Same functional idea as any bill-entry till (itemised
   bill on one side, category/item picker on the other),
   but styled in this app's own dark/gold/ticket language
   rather than mimicking any particular POS product.
   ===================================================== */
.classic-pos {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
    padding: 0;
}
.classic-pos .cp-accent-line {
    height: 3px;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold), var(--gold-dim));
}
.classic-pos .cp-wrap {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 0;
    min-height: calc(100vh - 3px);
}
.classic-pos .cp-bill {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 18px 14px;
    display: flex;
    flex-direction: column;
}
.classic-pos .cp-field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.classic-pos .cp-field-row label { width: 88px; font-weight: 600; font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0; }
.classic-pos .cp-field-row input, .classic-pos .cp-field-row select, .classic-pos .cp-field-row .cp-static {
    flex: 1; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px;
    font-size: .86rem; background: var(--surface-2); color: var(--text); font-family: inherit;
}
.classic-pos .cp-field-row .cp-static { color: var(--text-muted); }
.classic-pos .cp-field-row input:focus, .classic-pos .cp-field-row select:focus { outline: none; border-color: var(--gold-dim); }

.classic-pos .cp-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 11px 8px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    transition: border-color .15s;
}
.classic-pos .cp-btn:hover:not(:disabled) { border-color: var(--gold-dim); }
.classic-pos .cp-btn:active:not(:disabled) { transform: translateY(1px); }
.classic-pos .cp-btn:disabled { opacity: .4; cursor: not-allowed; }
.classic-pos .cp-btn.cp-primary { background: var(--gold); border-color: var(--gold); color: #1A1400; }
.classic-pos .cp-btn.cp-primary:hover { background: #DBAE4D; }
.classic-pos .cp-btn.cp-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.classic-pos .cp-btn.cp-danger:hover { background: rgba(192,73,90,.12); }

.classic-pos .cp-bill-table {
    flex: 1; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-2); margin: 12px 0; min-height: 160px; position: relative;
}
.classic-pos .cp-bill-table::before {
    content: "";
    position: absolute; top: -1px; left: -1px; right: -1px; height: 6px;
    background-image: radial-gradient(circle at 6px 3px, var(--surface) 3px, transparent 3px);
    background-size: 12px 6px; background-repeat: repeat-x;
}
.classic-pos table.cp-table { width: 100%; border-collapse: collapse; font-size: .82rem; font-family: var(--font-mono); }
.classic-pos table.cp-table th {
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 8px; text-align: left; font-weight: 600; color: var(--gold-dim);
    font-family: var(--font-body); text-transform: uppercase; font-size: .7rem; letter-spacing: .05em;
}
.classic-pos table.cp-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.classic-pos table.cp-table tr:last-child td { border-bottom: none; }
.classic-pos .cp-note-line { color: var(--gold); font-size: .74rem; font-style: italic; font-family: var(--font-body); }

.classic-pos .cp-totals { display: flex; gap: 16px; margin-bottom: 12px; font-family: var(--font-mono); }
.classic-pos .cp-totals label { font-weight: 600; font-size: .75rem; margin-right: 6px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.classic-pos .cp-totals input { width: 120px; border: 1px solid var(--border); background: var(--surface-2); color: var(--gold); padding: 5px 8px; font-weight: 700; border-radius: 6px; }

.classic-pos .cp-btn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.classic-pos .cp-btn-grid.cp-btn-grid-4 { grid-template-columns: repeat(4, 1fr); }

.classic-pos .cp-menu-panel { padding: 18px; display: flex; flex-direction: column; height: calc(100vh - 3px); }
.classic-pos .cp-menu-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.classic-pos .cp-crumb { font-family: var(--font-display); font-size: 1.05rem; color: var(--text); }
.classic-pos .cp-crumb b { color: var(--gold); }
.classic-pos .cp-search {
    border: 1px solid var(--border); border-radius: 20px; padding: 8px 14px; font-size: .85rem; width: 220px;
    background: var(--surface); color: var(--text);
}
.classic-pos .cp-search:focus { outline: none; border-color: var(--gold-dim); }

.classic-pos .cp-tile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; overflow-y: auto; flex: 1; align-content: start; }
.classic-pos .cp-tile {
    min-height: 96px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 700;
    font-size: .95rem;
    color: #171310;
    cursor: pointer;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
    transition: transform .12s, box-shadow .12s;
}
.classic-pos .cp-tile:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.3); }
.classic-pos .cp-tile:active { transform: translateY(0); }
.classic-pos .cp-tile.cp-tile-item { flex-direction: column; gap: 4px; font-size: .88rem; color: var(--text); border: 1px solid var(--border); }
.classic-pos .cp-tile .cp-tile-price { font-size: .82rem; font-weight: 700; font-family: var(--font-mono); color: var(--gold); }
.classic-pos .cp-tile.cp-tile-back { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); box-shadow: none; }
.classic-pos .cp-tile.unavailable, .classic-pos .cp-tile.cp-tile-out { opacity: .4; }
.classic-pos .cp-tile .cp-tile-stock { font-size: .68rem; color: var(--text-muted); }
.text-danger { color: var(--danger) !important; }

.classic-pos .cp-status-bar { margin-top: 12px; font-size: .78rem; color: var(--text-muted); display: flex; justify-content: space-between; }

.classic-pos #noteModal .card { background: var(--surface); color: var(--text); }

.classic-pos .qty-btn { width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.classic-pos .status-pill { font-size: .68rem; padding: 1px 7px; }
.classic-pos .badge-module { font-size: .68rem; }

@media (max-width: 900px) {
    .classic-pos .cp-wrap { grid-template-columns: 1fr; }
    .classic-pos .cp-tile-grid { grid-template-columns: repeat(2, 1fr); }
}
