/* style.css - ZimbaPOS Global Stylesheet */
/* Theme: White + Soft Orange. No gradients. */

:root {
    --primary:        #FF8C42;
    --primary-dark:   #E07B39;
    --primary-light:  #FFF0E6;
    --bg:             #FFFFFF;
    --bg-soft:        #FFF5EE;
    --bg-card:        #FAFAFA;
    --border:         #E8D5C4;
    --border-light:   #F0E8DF;
    --text:           #333333;
    --text-muted:     #888888;
    --text-light:     #AAAAAA;
    --success:        #28A745;
    --danger:         #DC3545;
    --warning:        #FFC107;
    --info:           #17A2B8;
    --table-empty:    #FFFFFF;
    --table-running:  #FFCCCC;
    --table-printed:  #CCFFCC;
    --kot-header:     #5C4D7D;
    --shadow:         0 2px 8px rgba(0,0,0,0.08);
    --radius:         6px;
    --font:           'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── LAYOUT ─────────────────────────────────────────────── */

.wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: var(--bg-soft);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo img { width: 36px; height: 36px; object-fit: contain; }
.sidebar-logo span { font-size: 16px; font-weight: 700; color: var(--primary); }

.sidebar-nav { padding: 8px 0; flex: 1; overflow-y: auto; }

.nav-group-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-light);
    padding: 10px 16px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    border-radius: 0;
    transition: background 0.15s;
    text-decoration: none;
}

.nav-item:hover { background: var(--primary-light); color: var(--primary-dark); text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-item .nav-icon { width: 16px; text-align: center; flex-shrink: 0; }

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: 52px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    flex-shrink: 0;
}

.topbar-title { font-size: 15px; font-weight: 600; flex: 1; }

.topbar-user {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-body {
    flex: 1;
    padding: 14px 16px;
    overflow-y: auto;
}

/* ─── CARDS ──────────────────────────────────────────────── */

.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}

.card-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-soft);
    border-radius: var(--radius) var(--radius) 0 0;
}

.card-header h5, .card-header h6 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.card-body { padding: 14px; }

/* ─── BUTTONS ────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    text-decoration: none;
    white-space: nowrap;
    height: 34px;
}

.btn:disabled, .btn.disabled { opacity: 0.6; cursor: not-allowed; pointer-events: none; }

.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-secondary { background: #6C757D; color: #fff; border-color: #6C757D; }
.btn-secondary:hover { background: #5a6268; }

.btn-success   { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #218838; }

.btn-danger    { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #c82333; }

.btn-warning   { background: var(--warning); color: #222; border-color: var(--warning); }
.btn-outline-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary-light); }

.btn-sm { height: 28px; padding: 3px 10px; font-size: 12px; }
.btn-lg { height: 42px; padding: 8px 20px; font-size: 15px; }

/* ─── FORMS ──────────────────────────────────────────────── */

.form-group { margin-bottom: 12px; }
.form-label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 500; color: var(--text); }
.form-label .required { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    height: 34px;
    transition: border-color 0.15s;
    outline: none;
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(255,140,66,0.15); }
.form-control.is-invalid { border-color: var(--danger); }
textarea.form-control { height: auto; min-height: 70px; resize: vertical; }
select.form-control { cursor: pointer; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-col { flex: 1; min-width: 150px; }

.form-check { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.form-check input[type=checkbox], .form-check input[type=radio] { cursor: pointer; width: 15px; height: 15px; }

/* ─── TABLES ─────────────────────────────────────────────── */

.table-wrapper { overflow-x: auto; }

table.ztable {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.ztable thead th {
    background: var(--bg-soft);
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

table.ztable tbody td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

table.ztable tbody tr:hover { background: var(--bg-soft); }

/* DataTables column filter row — now rendered inside <thead>, directly under
   the column titles, instead of the old <tfoot> row (which always rendered
   after the table body no matter where the markup sat in the page HTML). */
table.ztable thead tr.dt-filter-row th {
    padding: 5px 6px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    font-weight: 400;
    white-space: normal;
}
table.ztable thead tr.dt-filter-row input {
    width: 100%;
    padding: 3px 6px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
    font-weight: 400;
}
table.ztable thead tr.dt-filter-row input:focus { border-color: var(--primary); }

/* ─── BADGES ─────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    line-height: 1.6;
}

.badge-success  { background: #D4EDDA; color: #155724; }
.badge-danger   { background: #F8D7DA; color: #721C24; }
.badge-warning  { background: #FFF3CD; color: #856404; }
.badge-info     { background: #D1ECF1; color: #0C5460; }
.badge-primary  { background: var(--primary-light); color: var(--primary-dark); }
.badge-muted    { background: #E9ECEF; color: #6C757D; }

/* ─── TOAST ──────────────────────────────────────────────── */

#toast-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast-msg {
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: auto;
    text-align: center;
    min-width: 220px;
    max-width: 380px;
}

.toast-msg.show { opacity: 1; }
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--info); }
.toast-warning { background: #e6a817; }

/* ─── MODAL ──────────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal-box {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-soft);
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-header h5 { font-size: 15px; font-weight: 600; margin: 0; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); line-height: 1; padding: 2px 6px; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 16px; }
.modal-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ─── POS SCREEN ─────────────────────────────────────────── */

.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    height: calc(100vh - 52px);
    overflow: hidden;
}

.pos-left {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.pos-right {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-soft);
}

.pos-order-type-bar {
    display: flex;
    gap: 4px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.order-type-btn {
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    background: var(--bg);
    color: var(--text-muted);
    transition: all 0.15s;
}

.order-type-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.order-type-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Table grid */
.table-grid {
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    overflow-y: auto;
    flex: 1;
}

.table-area-title {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 4px 0 2px;
    border-bottom: 1px solid var(--border-light);
}

.table-cell {
    height: 70px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.1s, box-shadow 0.1s;
    background: var(--table-empty);
}

.table-cell:hover { transform: scale(1.04); box-shadow: var(--shadow); }
.table-cell.running { background: var(--table-running); border-color: #e8a0a0; }
.table-cell.billprinted { background: var(--table-printed); border-color: #80c080; }
.table-cell .table-pax { font-size: 10px; color: var(--text-muted); font-weight: 400; }

/* Category/item buttons */
.cat-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    max-height: 90px;
    overflow-y: auto;
}

.cat-btn {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid var(--border);
    cursor: pointer;
    background: var(--bg);
    transition: all 0.12s;
    white-space: nowrap;
}

.cat-btn:hover { border-color: var(--primary); color: var(--primary); }
.cat-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 7px;
    padding: 10px;
    overflow-y: auto;
    flex: 1;
}

.item-btn {
    height: 62px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.12s;
    word-break: break-word;
    line-height: 1.3;
}

.item-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.item-btn .item-price { font-size: 11px; color: var(--primary-dark); font-weight: 600; }

/* KOT panel (right side) */
.bill-header {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--bg);
    font-size: 12px;
}

.bill-header-field {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.kot-list { flex: 1; overflow-y: auto; }

.kot-block { margin-bottom: 4px; }

.kot-header {
    background: var(--kot-header);
    color: #fff;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kot-item-row {
    display: grid;
    grid-template-columns: 1fr 60px 30px 30px 70px 20px;
    align-items: center;
    padding: 5px 10px;
    border-bottom: 1px solid var(--border-light);
    font-size: 12px;
    background: var(--bg);
}

.kot-item-row:hover { background: var(--bg-soft); }

.bill-total-bar {
    padding: 8px 12px;
    border-top: 2px solid var(--border);
    background: var(--bg);
    font-size: 13px;
}

.bill-total-bar .total-label { color: var(--text-muted); }
.bill-total-bar .total-amount { font-size: 22px; font-weight: 700; color: var(--primary-dark); }

.bill-actions {
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    background: var(--bg-soft);
}

/* ─── SEARCH BAR ─────────────────────────────────────────── */

.search-bar {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    gap: 6px;
    align-items: center;
}

.search-bar input {
    flex: 1;
    padding: 5px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    height: 32px;
}

.search-bar input:focus { border-color: var(--primary); }

/* ─── DASHBOARD STAT CARDS ───────────────────────────────── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-card .stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-card .stat-value { font-size: 22px; font-weight: 700; color: var(--primary-dark); }
.stat-card .stat-sub   { font-size: 11px; color: var(--text-light); }

/* ─── HAMBURGER (mobile) ─────────────────────────────────── */

.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 6px; }
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    margin: 4px 0;
    transition: all 0.3s;
}

/* ─── RESPONSIVE ─────────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -220px;
        top: 0;
        bottom: 0;
        z-index: 500;
        transition: left 0.3s;
        box-shadow: 2px 0 12px rgba(0,0,0,0.1);
    }

    .sidebar.open { left: 0; }
    .hamburger { display: block; }

    .pos-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }

    .pos-right {
        max-height: 45vh;
        border-top: 2px solid var(--border);
    }

    .item-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
    .table-grid { grid-template-columns: repeat(auto-fill, minmax(75px, 1fr)); }

    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── PRINT ──────────────────────────────────────────────── */

@media print {
    .sidebar, .topbar, .bill-actions, .btn { display: none !important; }
    .page-body { padding: 0; }
}

/* ─── UTILITY ────────────────────────────────────────────── */

.text-primary { color: var(--primary); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted   { color: var(--text-muted); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.fw-bold      { font-weight: 700; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; }
.d-flex { display: flex; } .align-center { align-items: center; } .gap-1 { gap: 6px; } .gap-2 { gap: 12px; }
.flex-1 { flex: 1; }
.w-100 { width: 100%; }
.hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.small { font-size: 11px; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #ccc; border-radius: 22px; transition: .3s;
}
.toggle-slider:before {
    position: absolute; content: "";
    height: 16px; width: 16px; left: 3px; bottom: 3px;
    background: white; border-radius: 50%; transition: .3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }

/* Qty controls */
.qty-ctrl { display: flex; align-items: center; gap: 4px; }
.qty-btn {
    width: 24px; height: 24px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    cursor: pointer;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.12s;
}
.qty-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.qty-val { min-width: 24px; text-align: center; font-weight: 600; font-size: 13px; }
