/* =========================================
   RESTAURANT POS - COMPLETE STYLESHEET
   ========================================= */

/* ---------- CSS VARIABLES ---------- */
:root {
    --primary: #ff6b35;
    --primary-dark: #e95420;
    --primary-light: #fff1eb;
    --dark: #17202a;
    --dark-light: #263341;
    --muted: #7b8794;
    --text: #333;
    --bg: #f5f6f8;
    --card: #ffffff;
    --border: #e6e8ec;
    --border-light: #f0f1f3;
    --green: #20a464;
    --green-bg: #e8f7ef;
    --red: #e74c3c;
    --red-bg: #ffe8e4;
    --yellow: #f4b400;
    --yellow-bg: #fff8e1;
    --blue: #1976d2;
    --blue-bg: #e3f2fd;
    --purple: #8b5cf6;
    --purple-bg: #f3e8ff;
}

/* ---------- RESET ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Inter, Arial, sans-serif;
    background: var(--bg);
    color: var(--dark);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; background: transparent; }
input, select, textarea { outline: none; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ---------- LAYOUT ---------- */
.app { display: grid; grid-template-columns: 78px 1fr 390px; height: 100vh; }
.app.no-cart { grid-template-columns: 78px 1fr; }

/* ---------- SIDEBAR ---------- */
.sidebar {
    background: var(--dark);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 10px;
    gap: 8px;
    overflow-y: auto;
}
.logo {
    width: 48px; height: 48px;
    background: var(--primary);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 23px; font-weight: bold;
    margin-bottom: 12px; flex-shrink: 0;
}
.nav-btn {
    width: 56px; height: 56px;
    border-radius: 14px;
    color: #aeb7c2;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px; transition: .2s; flex-shrink: 0;
}
.nav-btn:hover { background: var(--dark-light); color: white; }
.nav-btn.active { background: var(--dark-light); color: var(--primary); }
.nav-icon { font-size: 18px; }
.nav-label { font-size: 9px; }

/* ---------- MAIN CONTENT ---------- */
.main { padding: 24px; overflow-y: auto; }

/* ---------- TOPBAR ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.title h1 { font-size: 24px; margin-bottom: 4px; }
.title p { color: var(--muted); font-size: 13px; }
.user-area { display: flex; align-items: center; gap: 12px; }
.status {
    background: var(--green-bg); color: var(--green);
    padding: 8px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: #ffe1d5; color: var(--primary-dark);
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 13px;
}

/* ---------- BUTTONS ---------- */
.btn-primary {
    background: var(--primary); color: white;
    border-radius: 12px; padding: 10px 18px;
    font-size: 13px; font-weight: 700; transition: .2s;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
    background: #f1f2f4; color: #59636e;
    border-radius: 8px; padding: 8px 14px;
    font-size: 12px; font-weight: 700; transition: .2s;
}
.btn-secondary:hover { background: #e6e8ec; }
.btn-danger {
    background: var(--red); color: white;
    border-radius: 8px; padding: 8px 14px;
    font-size: 12px; font-weight: 700; transition: .2s;
}
.btn-danger:hover { background: #c0392b; }
.btn-outline {
    background: white; color: #59636e;
    border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 14px;
    font-size: 12px; font-weight: 700; transition: .2s;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- CARDS ---------- */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 16px;
}
.stat-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}
.stat-card .label { font-size: 11px; color: var(--muted); }
.stat-card .value { font-size: 22px; font-weight: 800; margin-top: 4px; }

/* ---------- BADGES ---------- */
.badge {
    font-size: 10px; font-weight: 600;
    padding: 4px 8px; border-radius: 20px;
    display: inline-block;
}

/* ---------- SEARCH ---------- */
.search-box {
    background: white;
    border: 1px solid var(--border);
    height: 44px; border-radius: 12px;
    display: flex; align-items: center;
    padding: 0 15px;
}
.search-box input { border: 0; outline: 0; width: 100%; font-size: 14px; background: transparent; }

/* ---------- TABS ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
    padding: 10px 20px; border-radius: 12px;
    font-size: 13px; font-weight: 700;
    background: white; border: 1px solid var(--border);
    color: #59636e; transition: .2s;
}
.tab.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ---------- CATEGORY PILLS ---------- */
.categories { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; }
.cat-btn {
    padding: 9px 16px; background: white;
    border: 1px solid var(--border); border-radius: 10px;
    white-space: nowrap; color: #59636e;
    font-size: 12px; font-weight: 600; transition: .2s;
}
.cat-btn:hover { border-color: var(--primary); }
.cat-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ---------- MODAL ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    display: none; align-items: center; justify-content: center;
    z-index: 100; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
    width: 520px; max-height: 90vh; overflow-y: auto;
    background: white; border-radius: 18px;
    padding: 24px; box-shadow: 0 20px 70px rgba(0,0,0,.2);
}
.modal h2 { font-size: 20px; margin-bottom: 4px; }
.modal-sub { color: var(--muted); font-size: 12px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; }
.modal-actions button { flex: 1; height: 44px; border-radius: 10px; font-weight: 700; font-size: 13px; }

/* ---------- FORMS ---------- */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block; font-size: 11px;
    color: var(--muted); margin-bottom: 5px; font-weight: 600;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px; padding: 10px 12px; font-size: 13px;
    transition: .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- EMOJI PICKER ---------- */
.emoji-picker {
    display: flex; gap: 6px; flex-wrap: wrap;
    padding: 8px; background: #f8f9fa;
    border-radius: 8px; max-height: 120px; overflow-y: auto;
}
.emoji-opt {
    width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; background: white;
    cursor: pointer; transition: .15s;
}
.emoji-opt:hover { background: #e6e8ec; }
.emoji-opt.selected { background: var(--primary); transform: scale(1.1); }

/* ---------- TOAST ---------- */
.toast {
    position: fixed; bottom: 25px; left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--dark); color: white;
    padding: 12px 20px; border-radius: 10px;
    font-size: 12px; opacity: 0; transition: .3s;
    z-index: 200; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---------- POS PRODUCTS ---------- */
.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}
.product {
    background: white; border: 1px solid var(--border);
    border-radius: 14px; padding: 10px;
    transition: .2s; cursor: pointer;
}
.product:hover { transform: translateY(-2px); box-shadow: 0 7px 20px rgba(0,0,0,.07); }
.product-img {
    height: 110px; border-radius: 10px;
    background: linear-gradient(135deg, #f8f9fa, #eee);
    display: flex; align-items: center; justify-content: center;
    font-size: 48px; margin-bottom: 8px;
}
.product-name { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.product-desc { font-size: 11px; color: var(--muted); height: 26px; overflow: hidden; }
.product-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.price { font-weight: 800; color: var(--primary); font-size: 14px; }
.add-btn {
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--primary); color: white;
    font-size: 18px; display: flex;
    align-items: center; justify-content: center;
}
.add-btn:hover { background: var(--primary-dark); }

/* ---------- CART ---------- */
.cart {
    background: white;
    border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
    height: 100vh; overflow: hidden;
}
.cart-header { padding: 18px; border-bottom: 1px solid var(--border); }
.order-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }
.order-type {
    border: 1px solid var(--border); background: #fafafa;
    border-radius: 8px; padding: 8px 4px;
    font-size: 11px; text-align: center;
    color: #66717d; transition: .2s;
}
.order-type.active {
    border-color: var(--primary); background: var(--primary-light);
    color: var(--primary-dark); font-weight: 700;
}
.cart-items { flex: 1; overflow-y: auto; padding: 10px 16px; }
.cart-item {
    display: grid; grid-template-columns: 40px 1fr auto;
    gap: 8px; padding: 10px 4px;
    border-bottom: 1px solid var(--border-light);
}
.cart-item-img {
    width: 40px; height: 40px; border-radius: 8px;
    background: #f5f5f5; display: flex;
    align-items: center; justify-content: center; font-size: 20px;
}
.cart-item-name { font-size: 12px; font-weight: 700; }
.cart-item-price { font-size: 10px; color: var(--muted); margin-top: 2px; }
.qty-controls { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.qty-btn {
    width: 20px; height: 20px; border-radius: 5px;
    background: #f0f1f3; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
}
.cart-footer { padding: 14px 18px; border-top: 1px solid var(--border); }
.summary-row {
    display: flex; justify-content: space-between;
    margin: 6px 0; font-size: 13px; color: #66717d;
}
.summary-row.total {
    color: var(--dark); font-size: 18px; font-weight: 800;
    padding-top: 8px; margin-top: 10px;
    border-top: 1px dashed var(--border);
}
.pay-btn {
    width: 100%; height: 48px; border-radius: 11px;
    background: var(--primary); color: white;
    font-size: 14px; font-weight: 800; margin-top: 12px;
}
.pay-btn:hover { background: var(--primary-dark); }

/* ---------- TABLES ---------- */
.floor-plan {
    position: relative; width: 100%; height: 380px;
    background: #f8f9fa; border-radius: 12px;
    border: 1px solid var(--border); overflow: hidden;
}
.table-node {
    position: absolute; transform: translate(-50%, -50%);
    width: 80px; height: 80px; border-radius: 12px;
    border: 2px solid; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    cursor: pointer; transition: .2s;
}
.table-node:hover { transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.table-card {
    background: white; border: 1px solid var(--border);
    border-radius: 12px; padding: 14px;
    cursor: pointer; transition: .2s;
}
.table-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.table-list { background: white; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.table-list-header {
    display: grid; grid-template-columns: 1fr 80px 100px 120px 100px;
    gap: 12px; padding: 12px 18px;
    background: #f8f9fa; border-bottom: 1px solid var(--border);
    font-size: 11px; font-weight: 700; color: var(--muted);
    text-transform: uppercase;
}
.table-list-row {
    display: grid; grid-template-columns: 1fr 80px 100px 120px 100px;
    gap: 12px; padding: 12px 18px;
    border-bottom: 1px solid var(--border-light);
    align-items: center; font-size: 13px;
}
.table-list-row:hover { background: #fafafa; }

/* ---------- MENU GRID ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.menu-card {
    background: white; border: 1px solid var(--border);
    border-radius: 14px; padding: 16px; transition: .2s;
}
.menu-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.menu-card-actions { display: flex; gap: 4px; }
.icon-btn {
    width: 30px; height: 30px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; transition: .2s;
}
.icon-btn:hover { opacity: .8; }

/* ---------- ORDERS ---------- */
.order-card {
    background: white; border: 1px solid var(--border);
    border-radius: 12px; padding: 14px;
    margin-bottom: 10px; cursor: pointer; transition: .2s;
}
.order-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }

/* ---------- KITCHEN ---------- */
.kitchen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.kitchen-card {
    background: white; border: 2px solid var(--border);
    border-radius: 14px; overflow: hidden; transition: .2s;
}
.kitchen-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }

/* ---------- STAFF ---------- */
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.staff-card {
    background: white; border: 1px solid var(--border);
    border-radius: 14px; padding: 16px; transition: .2s;
}
.staff-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }

/* ---------- CHARTS ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; transition: .3s; }
.bar-label { font-size: 10px; color: var(--muted); }
.bar-value { font-size: 10px; font-weight: 600; color: var(--muted); }

.donut {
    width: 140px; height: 140px; border-radius: 50%;
    position: relative; flex-shrink: 0;
}
.donut-hole {
    width: 80px; height: 80px; border-radius: 50%;
    background: white; position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
}

.progress-bar {
    width: 100%; height: 6px;
    background: #f0f1f3; border-radius: 3px; overflow: hidden;
}
.progress-fill { height: 100%; background: var(--primary); border-radius: 3px; }

/* ---------- UTILITIES ---------- */
.text-muted { color: var(--muted); }
.text-primary { color: var(--primary); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-blue { color: var(--blue); }
.text-purple { color: var(--purple); }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.empty-state { text-align: center; padding: 40px; color: var(--muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 10px; }
.divider { border-top: 1px solid var(--border-light); margin: 8px 0; }
.warning-box {
    background: var(--red-bg); border: 1px solid var(--red);
    border-radius: 8px; padding: 10px;
    font-size: 12px; margin-top: 8px;
}
.info-box {
    background: var(--yellow-bg); border: 1px solid var(--yellow);
    border-radius: 8px; padding: 10px;
    font-size: 12px; margin-top: 8px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px) {
    .app { grid-template-columns: 65px 1fr 340px; }
    .products { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
    body { overflow: auto; }
    .app, .app.no-cart { display: block; height: auto; }
    .sidebar {
        height: 60px; width: 100%;
        flex-direction: row; position: sticky; top: 0;
        z-index: 20; padding: 8px; gap: 6px; overflow-x: auto;
    }
    .logo { margin: 0 8px 0 0; width: 40px; height: 40px; font-size: 18px; }
    .nav-btn { width: 42px; height: 42px; }
    .nav-label { display: none; }
    .main { padding: 14px; }
    .cart { height: auto; min-height: 400px; border-left: 0; border-top: 1px solid var(--border); }
    .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .table-list-header, .table-list-row { grid-template-columns: 1fr 60px 80px 80px; }
    .table-list-header > :nth-child(4), .table-list-row > :nth-child(4) { display: none; }
}
