﻿:root {
    --bg: #fbf8f2;
    --ink: #2d2a26;
    --accent: #f0542f;
    --accent-2: #7a39e6;
    --muted: #6b6b6b;
    --card: #ffffff;
    --radius: 16px;
    --pad: .9rem;
    --text-2: #777;
}

/* Reset & Base */
* {
    box-sizing: border-box;
}

html {
    font-family: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,Helvetica,Arial,'Apple Color Emoji','Segoe UI Emoji';
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
}

a {
    color: var(--accent);
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 14px;
}

/* ===================================================== */
/* HEADER + LOGO                                         */
/* ===================================================== */
.header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(251,248,242,.9);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid #eee;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .5rem 0;
}

/* Logo link reset */
.logo-link,
.logo-link:link,
.logo-link:visited,
.logo-link:hover,
.logo-link:active,
.logo-link:focus,
.logo-link:focus-visible {
    display: inline-flex;
    align-items: center;
    background: transparent !important;
    padding: 0 !important;
    margin: 0;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    filter: none !important;
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

    /* Accessible focus ring */
    .logo-link:focus-visible {
        outline: 2px solid var(--accent-2) !important;
        outline-offset: 2px;
    }

/* Logo image */
.logo-img {
    height: 64px;
    width: auto;
    border-radius: 12px;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    background: transparent !important;
    box-shadow: none !important;
    filter: none !important;
}

@media (max-width:900px) {
    .logo-img {
        height: 54px;
    }
}

/* ===================================================== */
/* BUTTONS                                               */
/* ===================================================== */
.btn {
    display: inline-block;
    padding: .6rem .9rem;
    border-radius: 999px;
    border: 1px solid var(--accent);
    color: #fff;
    background: var(--accent);
    font-weight: 600;
    cursor: pointer;
    transition: transform .05s ease, box-shadow .2s ease;
}

    .btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 18px rgba(240,84,47,.18);
    }

    .btn.alt {
        background: #fff;
        color: var(--accent);
        border-color: var(--accent);
    }

    .btn.purple {
        background: var(--accent-2);
        border-color: var(--accent-2);
    }

        .btn.purple:hover {
            box-shadow: 0 6px 18px rgba(122,57,230,.18);
        }

/* ===================================================== */
/* LAYOUT, CARDS, TEXT                                   */
/* ===================================================== */
.hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1.2rem 0 0;
}

.card {
    background: var(--card);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,.06);
    padding: var(--pad);
}

.grid {
    display: grid;
    gap: .75rem;
    align-items: stretch;
}

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

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

.equal-cards > .card {
    display: flex;
    flex-direction: column;
    min-height: 320px;
}

.equal-center {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

@media (max-width:900px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .equal-cards > .card {
        min-height: auto;
    }
}

/* ===================================================== */
/* MENU, FORM, TABLES                                    */
/* ===================================================== */
.menu-card h3 {
    margin: .2rem 0 .2rem;
    font-size: 1rem;
}

.menu-price {
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
}

.section {
    padding: 1rem 0;
}

    .section h2 {
        font-size: 1.2rem;
        margin: .2rem 0 .6rem;
        color: var(--accent);
    }

.input, select, textarea {
    width: 100%;
    border: 1px solid #e7e3dc;
    border-radius: 12px;
    padding: .6rem .7rem;
    background: #fff;
    font: inherit;
}

label {
    font-size: .9rem;
    color: var(--muted);
}

.footer {
    padding: 1rem 0;
    border-top: 1px solid #eee;
    color: #666;
    font-size: .9rem;
}

    .footer a {
        color: var(--accent-2);
    }

.notice {
    border-left: 4px solid var(--accent-2);
    padding: .6rem .7rem;
    background: #faf5ff;
    border-radius: 12px;
}

.kpis {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.kpi {
    flex: 1;
    min-width: 150px;
    background: #fff;
    border-radius: 12px;
    padding: .6rem;
    text-align: center;
}

    .kpi strong {
        display: block;
        font-size: 1.2rem;
        color: var(--accent);
    }

/* Menu grid */
.menu-grid {
    display: grid;
    gap: .9rem;
    grid-template-columns: repeat(3,1fr);
}

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

.menu-card {
    padding: var(--pad);
}

.menu-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .25rem;
}

.menu-title {
    font-size: 1.05rem;
}

/* Helpers */
.tiny {
    font-size: .85rem;
    color: #6b6b6b;
    margin: .2rem 0 0;
}

.info-lines {
    margin: .55rem 0 .2rem;
    font-size: 1rem;
    color: #4a4640;
    display: grid;
    gap: .15rem;
}

    .info-lines strong {
        color: #2d2a26;
    }

@media (max-width:600px) {
    .info-lines {
        font-size: .98rem;
        gap: .1rem;
    }
}

/* Form grids */
.form-grid-3 {
    display: grid;
    gap: .75rem;
    grid-template-columns: 1fr;
}

@media (min-width:820px) {
    .form-grid-3 {
        grid-template-columns: 1fr 160px 180px;
        align-items: end;
    }
}

/* Validation visuals */
.input:invalid, select:invalid, textarea:invalid,
.input.invalid, select.invalid, textarea.invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,.10);
}

.field-error {
    margin-top: .25rem;
    color: #b91c1c;
    font-size: .85rem;
    line-height: 1.2;
}

    .field-error.checkbox {
        margin-left: .4rem;
    }

/* ===================================================== */
/* ADMIN TABLE STYLES                                    */
/* ===================================================== */
.admin-title {
    margin: .2rem 0 1rem;
}

.admin-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    min-width: 1050px;
    border-collapse: collapse;
    font-size: .95rem;
    table-layout: fixed;
}

    .admin-table thead th {
        text-align: left;
        font-weight: 700;
        color: #3a3732;
        border-bottom: 2px solid #eee6da;
        padding: .6rem .7rem;
        white-space: nowrap;
        background-color: #fafafa;
        position: sticky;
        top: 0;
        z-index: 1;
    }

        .admin-table thead th.sortable {
            cursor: pointer;
        }

            .admin-table thead th.sortable::after {
                content: ' ↕';
                color: #b8b1a6;
                font-weight: 400;
            }

            .admin-table thead th.sortable[data-dir="asc"]::after {
                content: ' ↑';
                color: var(--accent-2);
            }

            .admin-table thead th.sortable[data-dir="desc"]::after {
                content: ' ↓';
                color: var(--accent-2);
            }

    .admin-table tbody td {
        padding: .55rem .7rem;
        border-bottom: 1px solid #f1ece4;
        vertical-align: top;
        word-wrap: break-word;
    }

    .admin-table tbody tr:hover {
        background-color: #faf8f3;
    }

    .admin-table .num {
        text-align: right;
        white-space: nowrap;
    }

.tag {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: .82rem;
    border: 1px solid #e0e7ff;
}

.empty {
    text-align: center;
    color: #7b766e;
    padding: 1rem;
}

@media (max-width:900px) {
    .admin-table {
        font-size: .9rem;
    }
}

/* Inline hero banner under the H1 (no other layout changes) */
.hero-head-media {
    margin: .35rem 0 .6rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 22px rgba(0,0,0,.08);
}

    .hero-head-media img {
        display: block;
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        object-fit: cover;
        object-position: center 62%;
    }

@media (max-width: 520px) {
    .hero-head-media img {
        object-position: center 58%;
    }
}

/* --- Admin table alignment & pills (additions) --- */
.admin-table thead th,
.admin-table tbody td {
    vertical-align: middle;
}

/* Dim canceled rows a bit */
.admin-table tbody tr.canceled {
    opacity: .65;
}

/* keep address readable but not too wide */
.admin-table td.wrap {
    max-width: 340px;
}

/* time slot pill consistent look */
.slot-pill {
    display: inline-block;
    padding: .35rem .55rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    border: 1px solid #e0e7ff;
    white-space: nowrap;
    line-height: 1;
}

/* generic badge styles reused */
.tag {
    line-height: 1;
    padding: .35rem .55rem;
    border-radius: 999px;
    white-space: nowrap;
    border: 1px solid transparent;
}

    .tag.ok {
        background: #ecfdf5;
        color: #065f46;
        border-color: #a7f3d0;
    }

    .tag.danger {
        background: #fee2e2;
        color: #991b1b;
        border-color: #fecaca;
    }

/* status column wraps neatly and aligns left */
.status-cell {
    min-width: 150px;
}

.status-wrap {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    align-items: flex-start;
}

    .status-wrap .reason {
        max-width: 260px;
    }

/* action column aligns to the right and keeps controls in one line */
.actions-cell {
    min-width: 220px;
    white-space: nowrap;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: .5rem;
}

    .actions-cell form {
        display: inline-flex;
        align-items: center;
        gap: .4rem;
    }

    .actions-cell .reason-input {
        height: 34px;
        padding: .35rem .55rem;
        max-width: 200px;
    }

    .actions-cell .btn {
        padding: .35rem .6rem;
    }

    .actions-cell .danger-btn {
        background: #dc2626;
        border-color: #dc2626;
    }

/* ---------- Admin table alignment & pills ---------- */
.admin-table {
    table-layout: fixed;
}

    .admin-table thead th,
    .admin-table tbody td {
        vertical-align: middle;
        padding: .55rem .7rem;
    }

    .admin-table tbody tr.canceled {
        opacity: .75;
    }

    .admin-table td.addr {
        word-wrap: break-word;
        white-space: normal;
        max-width: 520px;
    }

    .admin-table .mono {
        font-variant-numeric: tabular-nums;
    }

/* status cell layout */
.status-cell {
    min-width: 12ch;
}

.status-wrap {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    align-items: flex-start;
}

    .status-wrap .reason {
        max-width: 24ch;
    }

/* action column — right aligned, single row on wide screens */
.actions-cell {
    min-width: 22ch;
    white-space: nowrap;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: .5rem;
}

    .actions-cell form {
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        margin: 0;
    }

    .actions-cell .reason-input {
        height: 34px;
        padding: .35rem .55rem;
        max-width: 20ch;
    }

    .actions-cell .btn {
        padding: .35rem .6rem;
    }

    .actions-cell .danger-btn {
        background: #dc2626;
        border-color: #dc2626;
    }

@media (max-width: 900px) {
    .actions-cell {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

        .actions-cell .reason-input {
            max-width: 100%;
            flex: 1 1 140px;
        }
}

/* ---------- Admin table alignment & protection against narrow columns ---------- */
.admin-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    table-layout: fixed;
    min-width: 1150px;
}

    .admin-table thead th, .admin-table tbody td {
        vertical-align: middle;
        padding: .55rem .7rem;
    }

    .admin-table td.addr {
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
        min-width: 320px;
    }

    .admin-table .mono {
        font-variant-numeric: tabular-nums;
    }

    .admin-table tbody tr.canceled {
        opacity: .75;
    }

/* Small screens: allow wrapping of Action inline controls */
@media (max-width: 900px) {
    .actions-cell {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

        .actions-cell .reason-input {
            max-width: 100%;
            flex: 1 1 140px;
        }
}

/* Make invalid checkboxes visibly outlined like other fields */
input[type="checkbox"].invalid {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Ensure the checkbox error message sits nicely under the label */
label .field-error.checkbox {
    display: block;
    margin-top: .35rem;
}

/* ===================================================== */
/* CART (multi-order) LAYOUT — item | qty | line total | X */
/* ===================================================== */
#cart-lines .cart-line {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto; /* item, qty, line total, remove */
    gap: .6rem;
    align-items: end;
}

    #cart-lines .cart-line > .btn.cart-remove {
        height: 38px; /* match input height */
        padding: .35rem .8rem;
        align-self: end;
    }

    #cart-lines .cart-line > div {
        margin: 0;
    }

/* Responsive stacking on small screens */
@media (max-width: 560px) {
    #cart-lines .cart-line {
        grid-template-columns: 1fr 1fr; /* row1: item + qty; row2: line + X */
    }

        #cart-lines .cart-line > :nth-child(3) { /* line total */
            grid-column: 1 / 2;
        }

        #cart-lines .cart-line > .btn.cart-remove {
            grid-column: 2 / 3;
            justify-self: end;
        }
}
/* Inline grand total aligned under the Line column */
.cart-totals-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto; /* Item | Qty | Line | X */
    gap: .6rem;
    align-items: end;
    margin-top: .35rem;
}

.cart-total-cell {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    align-items: flex-start;
    padding: .35rem .6rem;
    border: 1px solid #e7e3dc;
    border-radius: 12px;
    background: #fff;
}

    .cart-total-cell .mono {
        font-variant-numeric: tabular-nums;
        font-weight: 600;
    }

/* Stack nicely on small screens (same break as cart lines) */
@media (max-width: 560px) {
    .cart-totals-row {
        grid-template-columns: 1fr 1fr;
    }

        .cart-totals-row > :nth-child(3) {
            grid-column: 1 / 2; /* keep Total on left under “Line” */
        }
}
/* Compact Total Price row */
.total-inline {
    display: flex;
    align-items: center;
    gap: .6rem; /* reduce space between label and box */
    margin: .25rem 0 .4rem;
}

    .total-inline label {
        margin: 0;
        white-space: nowrap;
    }

    .total-inline .input {
        width: 180px; /* keeps the total box tidy; tweak if you like */
    }
/* Align Total Price row with Qty and Price columns */
.total-price-row {
    grid-template-columns: 1fr 1fr 1fr; /* same as item lines */
    margin-top: 0.3rem;
}

    .total-price-row label#total_price_label {
        display: block;
        text-align: left;
        margin-bottom: 0.3rem;
        font-weight: 600;
    }

.total-price-input {
    width: 100%;
    height: 38px; /* match input height */
    box-sizing: border-box;
}
/* Align the Total Price row directly under Qty and Price columns */
.cart-totals-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto; /* Item | Qty | Price | X */
    gap: .6rem;
    align-items: end;
    margin: .25rem 0 .35rem;
}

.total-label {
    display: flex;
    align-items: flex-end; /* keep label baseline aligned like other labels */
}

    .total-label label {
        margin: 0 0 .3rem 0;
        font-weight: 600;
    }

/* Make the total box exactly like the Price box */
#total_price {
    width: 100%;
    height: 38px; /* matches input height you use elsewhere */
    box-sizing: border-box;
}
/* Keep the same 4-column grid: Item | Qty | Price | X */
.cart-totals-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: .6rem;
    align-items: end;
    margin: .25rem 0 .35rem;
}

/* Stack label + input inside the Price column */
.total-under-price {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

    .total-under-price label {
        margin: 0;
        font-weight: 600;
    }

/* ----- Total Price under Price column (exact sizing) ----- */
.cart-total-under-price {
    align-items: end;
    gap: .6rem;
    margin-top: .4rem;
}

.total-under-price {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

    .total-under-price label {
        margin: 0;
        font-weight: 600;
    }

#total_price {
    width: 100%;
    height: 38px; /* match the Price input box */
    box-sizing: border-box;
}
/* --- Total Price split row: label under Qty, value under Price --- */
.cart-total-split {
  align-items: end;
  gap: .6rem;
}

.total-label-under-qty label {
  margin: 0 0 .25rem 0;    /* same visual spacing as field labels */
  font-weight: 600;
  display: block;
  text-align: left;
}

.total-value-under-price #total_price {
  width: 100%;
  height: 38px;            /* match the Price input height */
  box-sizing: border-box;
}
/* Inline "Total Price: [box]" under the Price column */
.cart-total-inline {
    align-items: end;
    gap: .6rem;
    margin: .2rem 0 .3rem; /* trims the gap above/below */
}

.total-inline-under-price {
    display: flex;
    align-items: center;
    gap: .5rem; /* label ↔ box spacing */
}

    .total-inline-under-price label {
        margin: 0;
    }

    .total-inline-under-price input {
        height: 38px; /* match Price input */
        flex: 1; /* same width as the Price box */
        min-width: 0;
        box-sizing: border-box;
    }
/* --- Total Price: label under Qty, box under Price (perfect alignment) --- */
.cart-total-aligned {
    align-items: end;
    gap: .6rem;
    margin-top: .35rem;
}

.total-label-under-qty {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
}

    .total-label-under-qty label {
        margin: 0 0 .25rem 0;
        font-weight: 600;
    }

.total-box-under-price input {
    width: 100%;
    height: 38px; /* exact match to Price box */
    box-sizing: border-box;
}
/* === Perfect inline Total Price under Qty & Price === */
.total-price-inline {
    align-items: center;
    gap: .6rem;
    margin-top: .2rem;
}

.total-price-label {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: .3rem; /* brings label closer to box */
}

    .total-price-label label {
        margin: 0;
        font-weight: 600;
        white-space: nowrap;
    }

.total-price-box {
    display: flex;
    align-items: center;
}

    .total-price-box input {
        height: 38px; /* exact match with Price input */
        width: 100%;
        box-sizing: border-box;
        margin: 0;
    }
