:root {
    --bg: #b9cc6a;
    --bg2: #a9bf56;
    --card: #d9e8a6;
    --card2: #e8f2c4;
    --border: #7f9a2e;
    --text: #2f3a12;
    --shadow: 0 18px 50px rgba(37, 48, 10, .25);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(900px 520px at 20% 12%, rgba(255, 255, 255, .35), transparent 60%),
        radial-gradient(900px 520px at 75% 55%, rgba(255, 255, 255, .22), transparent 60%),
        linear-gradient(180deg, var(--bg), var(--bg2));
    /* Without this, the gradient is sized to the full scrollable page (tall on the
       menu page with many items) instead of the viewport — the radial highlights and
       the top-to-bottom fade end up compressed near the top, and the rest of a long
       page looks like it "cuts off" into flat color. Pin it to the viewport instead. */
    background-attachment: fixed;
}

.page {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px 18px;
}

@media (max-width: 640px) {
    /* The menu page's content can run much taller than a phone viewport (photos +
       multiple items), unlike the short under-construction/login/not-found cards that
       .page is otherwise centered for — start it at the top instead. */
    .page-menu {
        align-items: flex-start;
    }
}

.page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .22;
    background-image: url("../img/background-pattern.png");
    background-repeat: repeat;
    background-size: 220px 220px;
    mix-blend-mode: multiply;
}

.card {
    width: min(900px, 100%);
    background: linear-gradient(180deg, var(--card2), var(--card));
    border: 2px solid rgba(127, 154, 46, .55);
    border-radius: 22px;
    padding: 26px 22px 22px;
    box-shadow: var(--shadow);
    position: relative;
}

.topline {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.pill {
    display: inline-flex;
    align-items: center;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(47, 58, 18, .80);
    background: rgba(255, 255, 255, .35);
    border: 1px solid rgba(127, 154, 46, .45);
    padding: 8px 14px;
    border-radius: 999px;
}

.logo {
    display: block;
    width: min(520px, 92%);
    height: auto;
    margin: 6px auto 12px;
    filter: drop-shadow(0 16px 26px rgba(25, 35, 8, .22));
}

.lead {
    margin: 0 0 10px;
    color: rgba(47, 58, 18, .80);
    font-size: 15px;
    line-height: 1.55;
    text-align: center;
}

.headline {
    margin: 10px auto;
    max-width: 44ch;
    text-align: center;
    font-size: clamp(18px, 2.2vw, 22px);
    line-height: 1.35;
    font-weight: 700;
    color: rgba(47, 58, 18, .92);
}

.sub {
    margin: 0 auto 14px;
    max-width: 54ch;
    text-align: center;
    color: rgba(47, 58, 18, .80);
    font-size: 16px;
    line-height: 1.55;
}

.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px dashed rgba(127, 154, 46, .55);
    color: rgba(47, 58, 18, .75);
    font-weight: 700;
    letter-spacing: .02em;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(111, 141, 31, .9);
}

.intro-text {
    margin: 4px auto 18px;
    max-width: 640px;
    text-align: left;
    color: rgba(47, 58, 18, .88);
    font-size: 16px;
    line-height: 1.65;
}

.intro-text p {
    margin: 0 0 12px;
}

.intro-text h2,
.intro-text h3 {
    margin: 16px 0 8px;
    color: rgba(47, 58, 18, .95);
}

.intro-text ul,
.intro-text ol {
    margin: 0 0 12px;
    padding-left: 22px;
}

.menu-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 28px 0 16px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: rgba(47, 58, 18, .80);
}

.menu-list {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    display: grid;
    gap: 10px;
}

.menu-list-item {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .40);
    border: 1px solid rgba(127, 154, 46, .30);
}

.menu-list-photo {
    width: 68px;
    height: 68px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(127, 154, 46, .35);
    background: rgba(255, 255, 255, .35);
    flex-shrink: 0;
}

.menu-list-photo-empty {
    display: block;
    border-style: dashed;
}

.menu-list-content {
    flex: 1;
    min-width: 0;
}

.menu-list-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.menu-list-name {
    font-weight: 700;
    color: rgba(47, 58, 18, .95);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-list-leader {
    flex: 1;
    min-width: 12px;
    border-bottom: 2px dotted rgba(127, 154, 46, .55);
    margin-bottom: 5px;
}

.menu-list-price {
    font-weight: 800;
    color: rgba(111, 141, 31, 1);
    white-space: nowrap;
}

.menu-list-allergens {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.menu-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px dashed rgba(127, 154, 46, .55);
    font-weight: 700;
}

.menu-pagination a {
    color: rgba(111, 141, 31, 1);
    text-decoration: underline;
}

.menu-pagination-disabled {
    color: rgba(47, 58, 18, .35);
}

.menu-pagination-info {
    color: rgba(47, 58, 18, .70);
    font-size: 14px;
}

.menu-list-link {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    text-decoration: none;
    color: inherit;
}

.menu-list-link:hover .menu-list-name {
    text-decoration: underline;
}

.detail-back {
    display: inline-block;
    margin-bottom: 16px;
    color: rgba(111, 141, 31, 1);
    font-weight: 700;
    text-decoration: none;
}

.detail-back:hover {
    text-decoration: underline;
}

.detail-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.detail-gallery-item {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    border-radius: 16px;
    cursor: zoom-in;
}

.detail-gallery-item:focus-visible {
    outline: 3px solid rgba(111, 141, 31, .6);
    outline-offset: 2px;
}

.detail-gallery-photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid rgba(127, 154, 46, .35);
    box-shadow: 0 8px 18px rgba(47, 58, 18, .12);
    pointer-events: none;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 24, 8, .90);
    padding: 24px;
}

.lightbox[hidden] {
    display: none;
}

.lightbox-image {
    max-width: min(90vw, 900px);
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    line-height: 1;
    cursor: pointer;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, .28);
}

.lightbox-close {
    top: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    font-size: 24px;
}

.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    font-size: 28px;
}

.lightbox-prev {
    left: 16px;
}

.lightbox-next {
    right: 16px;
}

.detail-name {
    margin: 4px 0 10px;
    font-size: clamp(24px, 3.5vw, 32px);
}

.detail-price {
    margin: 4px 0 16px;
    font-size: 22px;
    font-weight: 800;
    color: rgba(111, 141, 31, 1);
}

.detail-allergens {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.detail-allergen {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .40);
    border: 1px solid rgba(127, 154, 46, .30);
    font-size: 13px;
    font-weight: 600;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.form {
    max-width: 420px;
    margin: 18px auto 0;
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    gap: 6px;
}

.field-label {
    font-weight: 700;
    font-size: 13px;
    color: rgba(47, 58, 18, .85);
}

.field-input {
    appearance: none;
    border-radius: 14px;
    border: 1px solid rgba(127, 154, 46, .55);
    padding: 12px;
    background: rgba(255, 255, 255, .55);
    color: rgba(47, 58, 18, .95);
    font-size: 15px;
    font-family: inherit;
    outline: none;
}

.field-input:focus {
    border-color: rgba(111, 141, 31, .9);
    box-shadow: 0 0 0 4px rgba(127, 154, 46, .18);
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 14px;
    padding: 12px 16px;
    font-weight: 800;
    letter-spacing: .02em;
    font-size: 15px;
    font-family: inherit;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(180deg, rgba(111, 141, 31, 1), rgba(98, 124, 27, 1));
    box-shadow: 0 12px 22px rgba(47, 58, 18, .18);
    cursor: pointer;
}

.button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.button:hover {
    filter: brightness(1.03);
}

.button-sm {
    padding: 9px 16px;
    font-size: 14px;
}

.button-secondary {
    color: rgba(47, 58, 18, .90);
    background: rgba(255, 255, 255, .55);
    border: 1px solid rgba(127, 154, 46, .45);
    box-shadow: none;
}

.button-secondary:hover {
    background: rgba(255, 255, 255, .85);
    filter: none;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.alert {
    max-width: 420px;
    margin: 0 auto 4px;
    border-radius: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(120, 15, 15, .55);
    background: rgba(178, 30, 30, .95);
    color: #fff;
    font-weight: 700;
    text-align: center;
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(180deg, rgba(111, 141, 31, 1), rgba(98, 124, 27, 1));
    box-shadow: var(--shadow);
    transition: opacity .3s ease, transform .3s ease;
}

.toast svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast-hide {
    opacity: 0;
    transform: translateX(-50%) translateY(-12px);
}

/* Admin shell (header + content), used by every page behind the login. */

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-areas:
        "userbar userbar"
        "header  main";
    gap: 16px;
    padding: 20px;
    align-items: start;
    align-content: start;
}

@media (max-width: 860px) {
    .admin-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "userbar"
            "header"
            "main";
        padding: 12px;
        gap: 4px;
    }
}

.admin-header {
    grid-area: header;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .50), rgba(255, 255, 255, .30));
    border: 1px solid rgba(127, 154, 46, .45);
    box-shadow: var(--shadow);
    padding: 16px;
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

@media (max-width: 860px) {
    /* No more card/block around the logo + hamburger on mobile — just a plain,
       position:relative anchor for the floating toggle. */
    .admin-header {
        position: relative;
        background: none;
        border: none;
        box-shadow: none;
        border-radius: 0;
        padding: 8px 0 20px;
    }
}

.admin-logo-link {
    display: block;
}

.admin-logo {
    display: block;
    width: 100%;
    max-width: 170px;
    height: auto;
    margin: 0 auto;
}

@media (max-width: 860px) {
    .admin-logo {
        max-width: 260px;
    }
}

.admin-nav {
    width: 100%;
}

@media (max-width: 860px) {
    .admin-nav {
        width: auto;
        position: absolute;
        top: 0;
        right: 0;
    }
}

.admin-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 40px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(127, 154, 46, .45);
    border-radius: 10px;
    background: rgba(255, 255, 255, .45);
    cursor: pointer;
}

.admin-nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: rgba(47, 58, 18, .85);
    border-radius: 2px;
}

@media (max-width: 860px) {
    .admin-nav-toggle {
        display: flex;
    }
}

.admin-nav-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (max-width: 860px) {
    .admin-nav-panel {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        min-width: 180px;
        background: linear-gradient(180deg, var(--card2), var(--card));
        border: 1px solid rgba(127, 154, 46, .45);
        border-radius: 14px;
        box-shadow: var(--shadow);
        padding: 10px;
        z-index: 30;
    }

    .admin-nav-panel.is-open {
        display: flex;
    }
}

.admin-nav-link {
    display: block;
    width: 100%;
    text-align: left;
    text-decoration: none;
    font-weight: 800;
    font-size: 15px;
    font-family: inherit;
    color: rgba(47, 58, 18, .90);
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(127, 154, 46, .35);
    background: rgba(255, 255, 255, .35);
    cursor: pointer;
    white-space: nowrap;
}

.admin-nav-link.is-active {
    background: rgba(111, 141, 31, .16);
    border-color: rgba(111, 141, 31, .55);
}

.admin-main {
    grid-area: main;
    min-width: 0;
}

.admin-user-bar {
    grid-area: userbar;
    text-align: right;
    font-size: 14px;
    font-weight: 600;
    color: rgba(47, 58, 18, .80);
    white-space: nowrap;
}

.admin-logout-inline {
    display: inline;
}

.link-button {
    display: inline;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-weight: 700;
    color: rgba(47, 58, 18, .90);
    text-decoration: underline;
    cursor: pointer;
}

.link-button:hover {
    color: rgba(111, 141, 31, 1);
}

.admin-card {
    width: 100%;
    border-radius: 22px;
    background: linear-gradient(180deg, var(--card2), var(--card));
    border: 2px solid rgba(127, 154, 46, .55);
    box-shadow: var(--shadow);
    padding: 20px;
}

@media (max-width: 480px) {
    .admin-card {
        padding: 16px 14px;
        border-radius: 18px;
    }
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.admin-title {
    margin: 0;
    font-size: 22px;
}

.admin-lead {
    margin: 4px 0 0;
    color: rgba(47, 58, 18, .80);
}

.admin-table-wrap {
    overflow-x: auto;
}

/* DataTables' own header/footer controls float left/right at every width by default
   and overflow on a phone screen — stack them instead below the admin-shell breakpoint. */
@media (max-width: 640px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        width: 100%;
        text-align: left;
        margin-bottom: 8px;
    }

    .dataTables_wrapper .dataTables_filter input {
        margin-left: 0;
        width: 100%;
        box-sizing: border-box;
    }
}

.table-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(127, 154, 46, .35);
    background: rgba(255, 255, 255, .35);
    display: block;
}

.table-thumb-empty {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px dashed rgba(127, 154, 46, .35);
    background: rgba(255, 255, 255, .25);
    display: block;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid rgba(127, 154, 46, .40);
    background: rgba(255, 255, 255, .50);
    color: rgba(47, 58, 18, .85);
    text-decoration: none;
}

@media (max-width: 480px) {
    .icon-btn {
        width: 40px;
        height: 40px;
    }
}

.icon-btn:hover {
    background: rgba(255, 255, 255, .80);
}

.icon-btn svg {
    width: 16px;
    height: 16px;
}

.inline-form {
    display: inline-block;
}

.icon-btn-danger {
    margin-left: 6px;
    border-color: rgba(140, 40, 40, .35);
    color: rgba(140, 30, 30, .90);
}

.icon-btn-danger:hover {
    background: rgba(178, 30, 30, .12);
}

/* Food form */

.form-wide {
    max-width: 720px;
    margin: 0;
}

.field-textarea {
    min-height: 160px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .55);
}

.field-hint {
    font-size: 12px;
    font-weight: 600;
    color: rgba(47, 58, 18, .65);
}

.field-row {
    display: flex;
    gap: 12px;
}

.field-row .field {
    flex: 1;
    min-width: 0;
}

@media (max-width: 480px) {
    .field-row {
        flex-direction: column;
    }
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.checkbox-field {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    flex-shrink: 0;
}

.info-btn svg {
    width: 100%;
    height: 100%;
}

.info-btn:hover svg circle {
    fill: #1d4ed8;
}

.info-popout {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    width: 220px;
    max-width: 70vw;
    background: linear-gradient(180deg, var(--card2), var(--card));
    border: 1px solid rgba(127, 154, 46, .45);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    color: rgba(47, 58, 18, .90);
}

.info-popout.is-open {
    display: block;
}

.allergen-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    flex-shrink: 0;
}

.allergen-icon svg {
    width: 62%;
    height: 62%;
}

.photo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.photo-item {
    width: 120px;
    display: grid;
    gap: 6px;
    text-align: center;
}

.photo-item img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(127, 154, 46, .35);
    background: rgba(255, 255, 255, .35);
}

.photo-item label {
    font-size: 12px;
    font-weight: 700;
    color: rgba(80, 18, 18, .95);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

label.photo-item-cover-label {
    color: rgba(47, 58, 18, .80);
}
