/* ============================================================
   Till Counter System (TCS) - Main Stylesheet
   Mobile-first, simple, clean, white background.
   ============================================================ */

* {
    box-sizing: border-box;
}

:root {
    --navy: #1B2A4A;
    --blue: #2E6BE6;
    --bg: #FFFFFF;
    --bg-soft: #F6F8FB;
    --text: #1B2330;
    --text-muted: #6B7280;
    --danger: #E5484D;
    --success: #2FAE6E;
    --border: #E7EAF0;
    --radius: 16px;
    --radius-lg: 22px;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 520px;
    margin: 0 auto;
    padding: 20px 16px 100px;
}

/* ---------- Auth pages ---------- */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-soft);
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 36px 28px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 10px 40px rgba(20, 30, 60, 0.08);
    text-align: center;
}

.auth-card h1 {
    font-size: 22px;
    margin: 0 0 6px;
    color: var(--navy);
}

.auth-card p {
    color: var(--text-muted);
    margin: 0 0 24px;
    font-size: 14px;
}

.auth-card input[type="text"],
.auth-card input[type="password"] {
    width: 100%;
    padding: 16px;
    font-size: 20px;
    letter-spacing: 2px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    outline: none;
    transition: border-color .15s;
}

.auth-card input:focus {
    border-color: var(--blue);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform .08s, opacity .15s;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--blue);
    color: #fff;
}

.btn-navy {
    background: var(--navy);
    color: #fff;
}

.btn-outline {
    background: #fff;
    color: var(--navy);
    border: 2px solid var(--border);
}

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

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

.btn-sm {
    padding: 10px 14px;
    font-size: 14px;
    width: auto;
}

.error-msg {
    background: #FDEDED;
    color: var(--danger);
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 16px;
}

.success-msg {
    background: #E9F9F0;
    color: var(--success);
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 16px;
}

.landing-links {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---------- Top bar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--navy);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar h1 {
    font-size: 17px;
    margin: 0;
    font-weight: 600;
}

.topbar-subtitle {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
}

.topbar .logout-link {
    font-size: 13px;
    opacity: 0.85;
    background: rgba(255,255,255,0.12);
    padding: 8px 12px;
    border-radius: 10px;
}

/* ---------- Cards ---------- */
.stat-card {
    background: var(--bg-soft);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
}

.stat-card .label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px;
}

.stat-card .value {
    font-size: 26px;
    font-weight: 700;
    color: var(--navy);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.shift-banner {
    background: linear-gradient(135deg, var(--navy), #2A3E68);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.shift-banner .shift-label {
    font-size: 13px;
    opacity: 0.75;
}

.shift-banner .shift-value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 4px;
}

.mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

.mode-btn {
    padding: 22px 10px;
    border-radius: var(--radius);
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
}

.mode-btn.sales { background: var(--blue); }
.mode-btn.eod { background: var(--navy); }

.mode-btn .mode-icon {
    font-size: 26px;
    display: block;
    margin-bottom: 8px;
}

/* ---------- Category / Product Cards ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.tap-card {
    border-radius: 12px;
    padding: 10px 6px;
    text-align: center;
    font-weight: 700;
    font-size: 12.5px;
    line-height: 1.25;
    color: var(--navy);
    border: 1px solid rgba(0,0,0,0.04);
    cursor: pointer;
    user-select: none;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    word-break: break-word;
}

.tap-card .pc-name {
    display: block;
}

.tap-card .pc-price {
    display: block;
    font-size: 11px;
    font-weight: 700;
    opacity: 0.75;
}

.tap-card:active {
    transform: scale(0.96);
}

.product-qty-badge {
    position: relative;
}

.product-card {
    position: relative;
}

/* ---------- Breadcrumb / back ---------- */
.back-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-weight: 600;
    color: var(--navy);
}

.back-row .back-btn {
    background: var(--bg-soft);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 14px;
}

/* ---------- Sales Mode: fixed split-screen layout ---------- */
.sales-split {
    display: flex;
    align-items: stretch;
    height: calc(100vh - 57px); /* 57px ~= topbar height */
    overflow: hidden;
}

.sales-split.with-tabs {
    height: calc(100vh - 102px); /* topbar + tab-row */
}

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

.sale-panel-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 10px 8px;
    font-weight: 700;
    font-size: 13px;
    color: var(--navy);
    border-bottom: 1px solid var(--border);
}

.sale-panel-body {
    overflow-y: auto;
    padding: 6px 10px;
    flex: 1;
}

.sale-panel-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid var(--border);
    font-weight: 700;
    font-size: 13px;
    color: var(--navy);
}

.sale-panel-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--border);
}

.sale-panel-footer .btn {
    width: 100%;
}

.browse-panel {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    min-width: 0;
}

.sale-item-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.sale-item-row:last-child {
    border-bottom: none;
}

.sale-item-name {
    font-weight: 600;
    font-size: 12.5px;
    word-break: break-word;
}

.sale-item-line {
    font-size: 11.5px;
    color: var(--text-muted);
}

.sale-item-line strong {
    color: var(--navy);
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: none;
    background: #fff;
    color: var(--navy);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

.qty-btn.remove {
    background: #FDEDED;
    color: var(--danger);
    font-size: 11px;
    width: auto;
    padding: 0 8px;
    flex: 1;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 24px 8px;
}

@media (max-width: 380px) {
    .sale-panel { width: 46%; }
}

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

/* ---------- Table ---------- */
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.report-table th,
.report-table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
}

.report-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

/* ---------- Admin ---------- */
.admin-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 16px;
    background: var(--bg-soft);
    position: sticky;
    top: 56px;
    z-index: 15;
}

.admin-nav a {
    white-space: nowrap;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
    background: #fff;
    border: 1px solid var(--border);
}

.admin-nav a.active {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--bg-soft);
    margin-bottom: 10px;
}

.list-row .info strong {
    display: block;
    font-size: 15px;
    color: var(--navy);
}

.list-row .info span {
    font-size: 12px;
    color: var(--text-muted);
}

.badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

.badge.active { background: #E9F9F0; color: var(--success); }
.badge.inactive { background: #FDEDED; color: var(--danger); }
.badge.open { background: #E9F9F0; color: var(--success); }
.badge.closed { background: #EEF0F4; color: var(--text-muted); }
.badge.combo { background: #EAF2FF; color: var(--blue); margin-left: 6px; }

.row-actions {
    display: flex;
    gap: 6px;
}

.icon-btn {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--navy);
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 2px solid var(--border);
    font-size: 15px;
    outline: none;
}

.form-group input[type="color"] {
    width: 100%;
    height: 46px;
    border-radius: 12px;
    border: 2px solid var(--border);
    padding: 4px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 35, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 20px;
}

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

.modal-box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 400px;
    max-height: 88vh;
    overflow-y: auto;
}

.modal-box h2 {
    margin: 0 0 16px;
    font-size: 18px;
    color: var(--navy);
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 22px 0 10px;
}

.fab-add {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(46,107,230,0.4);
    border: none;
    cursor: pointer;
    z-index: 25;
}

.filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.filter-row select,
.filter-row input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 2px solid var(--border);
    font-size: 14px;
}

@media (min-width: 480px) {
    .container { padding-bottom: 40px; }
}

/* ---------- Receipts feed ---------- */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
}

.date-nav-label {
    font-weight: 700;
    font-size: 13px;
    color: var(--navy);
    text-align: center;
    flex: 1;
}

.btn.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.receipt-card {
    background: var(--bg-soft);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
}

.receipt-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.receipt-card-top strong {
    font-size: 14px;
    color: var(--navy);
}

.receipt-card-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.receipt-card-items {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
}

/* ---------- Combo recipe editor (Admin > Combos) ---------- */
.recipe-block {
    margin-bottom: 24px;
}

.recipe-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 14px;
    color: var(--navy);
    margin-bottom: 4px;
}

.recipe-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 10px;
}

.choice-group-card {
    background: var(--bg-soft);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
}

.choice-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 14px;
    color: var(--navy);
    margin-bottom: 8px;
}

.choice-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

.choice-option-row:first-of-type {
    border-top: none;
}

/* ---------- Combo picker (Sales Mode) ---------- */
.combo-picker-group {
    margin-bottom: 16px;
}

.combo-picker-fixed {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-soft);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 16px;
}

.combo-picker-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: 8px;
}

.combo-picker-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.combo-picker-option {
    padding: 12px 14px;
    border-radius: 12px;
    border: 2px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    color: var(--navy);
}

.combo-picker-option.selected {
    border-color: var(--blue);
    background: #EAF2FF;
}

/* ---------- Tab bar (e.g. Kitchen Production: Add Batch / Today's Stock) ---------- */
.tab-row {
    display: flex;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    text-align: center;
    padding: 12px 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: var(--navy);
    border-bottom-color: var(--blue);
}



/* ---------- V2: pricing UI additions ---------- */

.receipt-card-amount {
    margin-top: 6px;
    font-weight: 700;
    font-size: 13px;
    color: var(--navy);
    text-align: right;
}

/* ---------- Admin: Daily Total card ---------- */
.daily-total-card {
    background: var(--navy);
    color: #fff;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.daily-total-title {
    font-size: 12px;
    opacity: 0.75;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.daily-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 4px 0;
}

.daily-total-row.grand {
    border-top: 1px solid rgba(255,255,255,0.2);
    margin-top: 6px;
    padding-top: 8px;
    font-size: 16px;
    font-weight: 700;
}

/* ---------- EOD confirm modal summary ---------- */
.eod-confirm-summary {
    background: var(--bg-soft);
    border-radius: 12px;
    padding: 12px 14px;
    margin: 12px 0;
    text-align: left;
}

.eod-confirm-summary div {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 4px 0;
    color: var(--text-muted);
}

.eod-confirm-summary div strong {
    color: var(--navy);
}

/* ---------- Combo picker: multi-pick stepper rows ---------- */
.combo-picker-stepper-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
}

.combo-picker-stepper-row:last-child {
    border-bottom: none;
}

.stepper-count {
    min-width: 20px;
    text-align: center;
    font-weight: 700;
}

/* ---------- Receipt modal (Sales Mode - post-sale) ---------- */
.receipt-box {
    max-width: 320px;
    text-align: center;
}

.receipt-paper {
    background: var(--bg-soft);
    border-radius: 10px;
    padding: 18px 16px;
    font-family: 'Courier New', Courier, monospace;
    text-align: left;
}

.receipt-title {
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .06em;
    color: var(--navy);
    margin-bottom: 4px;
}

.receipt-txn {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.receipt-divider.dashed {
    border-top: 1px dashed #C7CDD8;
    margin: 10px 0;
}

.receipt-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.receipt-line div:first-child {
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
}

.receipt-line-calc {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.receipt-line-calc span {
    font-weight: 700;
    color: var(--navy);
}

.receipt-total-row {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 15px;
    color: var(--navy);
}

.receipt-meta {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ---------- Print: only the receipt paper is printed ---------- */
@media print {
    body * {
        visibility: hidden;
    }
    #receiptPaper, #receiptPaper * {
        visibility: visible;
    }
    #receiptPaper {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        background: #fff;
    }
}
