﻿@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    --main-cream: #fff4dd;
    --logo-green: #2e7d32;
    --logo-red: #c62828;
    --gold: #d4af37;
    --green: var(--logo-green);
    --green-dark: #4e342e;
    --cream: var(--main-cream);
    --page-bg: var(--main-cream);
    --mint: rgba(46, 125, 50, 0.14);
    --text: #4e342e;
    --muted: #8a735f;
    --card: #ffffff;
    --border: rgba(78, 52, 46, 0.14);
    --shadow: 0 20px 60px rgba(78, 52, 46, 0.12);
    --floating-safe-bottom: env(safe-area-inset-bottom, 0px);
    --floating-safe-left: env(safe-area-inset-left, 0px);
    --floating-safe-right: env(safe-area-inset-right, 0px);
    --floating-viewport-offset: 0px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Poppins', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(46, 125, 50, 0.16), transparent 28%),
        linear-gradient(180deg, #ffffff 0%, var(--main-cream) 55%, var(--cream) 100%);
    min-height: 100vh;
}

.admin-layout {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(198, 40, 40, 0.08), transparent 26%),
        radial-gradient(circle at bottom left, rgba(46, 125, 50, 0.12), transparent 30%),
        var(--page-bg);
}

.navbar-brand .brand-mark,
.brand-mark {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, var(--green), var(--gold));
    box-shadow: 0 10px 24px rgba(78, 52, 46, 0.22);
}

.brand-mark-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.surface-card {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(78, 52, 46, 0.12);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.sidebar {
    width: 280px;
    min-width: 280px;
    flex: 0 0 280px;
    min-height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
    background: var(--green);
    color: #fff;
}
.sidebar::-webkit-scrollbar,
main::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    width: 0;
    height: 0;
}

main {
    min-width: 0;
    max-height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
}

.admin-main {
    background: transparent;
}

.admin-brand-row {
    min-width: 0;
}

.admin-brand-text {
    min-width: 0;
}

.admin-brand-text .fw-semibold,
.admin-brand-text .small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-menu-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 244, 221, 0.34);
    border-radius: 14px;
    color: #fff;
    background: rgba(255, 244, 221, 0.14);
    display: inline-grid;
    place-items: center;
    transition: all 0.2s ease;
}

.admin-menu-toggle:hover,
.admin-menu-toggle:focus {
    color: #fff;
    background: rgba(255, 244, 221, 0.22);
    outline: none;
}

.admin-menu-toggle[aria-expanded="true"] {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--text);
}

.admin-nav {
    gap: 0.45rem;
}

.admin-user {
    color: rgba(255,255,255,0.72) !important;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.84);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
    background: rgba(255, 244, 221, 0.18);
    border-color: rgba(212, 175, 55, 0.28);
}

.sidebar .nav-link.active {
    box-shadow: inset 4px 0 0 var(--gold);
}

.btn-green {
    background: linear-gradient(135deg, var(--green), var(--gold));
    color: #fff;
    border: none;
    box-shadow: 0 14px 30px rgba(78, 52, 46, 0.18);
}
.btn-green:hover { color: #fff; transform: translateY(-1px); }
.btn-outline-green {
    border: 1px solid rgba(78, 52, 46, 0.18);
    color: var(--green);
    background: #fff;
}
.btn-outline-green:hover { background: var(--mint); color: var(--green-dark); }
.btn-outline-green.active {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}

.stat-card {
    border-radius: 22px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #fff, #fcfcf8);
    box-shadow: 0 14px 40px rgba(10, 47, 20, 0.06);
}
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(46, 125, 50, .16), rgba(212, 175, 55, .12));
    color: var(--green);
}

.table > :not(caption) > * > * {
    padding: 1rem 0.9rem;
    vertical-align: middle;
}
.table thead th {
    color: #527060;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge-soft {
    background: var(--mint);
    color: var(--green-dark);
    border: 1px solid rgba(78, 52, 46, 0.12);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
}
.login-card {
    width: min(100%, 460px);
}
.hero-panel {
    background: linear-gradient(135deg, var(--green-dark), var(--green));
    color: #fff;
    border-radius: 28px;
    position: relative;
    overflow: hidden;
}
.hero-panel::after {
    content: '';
    position: absolute;
    inset: auto -40px -60px auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
}

.customer-shell {
    max-width: 1100px;
    margin: 0 auto;
}
.customer-hero {
    background: linear-gradient(135deg, var(--green-dark), var(--green));
    color: #fff;
    border-radius: 32px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.category-pill {
    border: 1px solid rgba(78, 52, 46, 0.12);
    border-radius: 999px;
    padding: 0.7rem 1rem;
    white-space: nowrap;
    background: #fff;
}
.product-card {
    border: 1px solid rgba(78, 52, 46, 0.12);
    border-radius: 24px;
    overflow: hidden;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 12px 30px rgba(12, 44, 21, 0.06);
    transition: transform .2s ease, box-shadow .2s ease;
}
.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(12, 44, 21, 0.1);
}
.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--cream);
}

.qr-preview {
    width: 100%;
    max-width: 384px;
    aspect-ratio: 1;
    background: #fff;
    border-radius: 24px;
    display: grid;
    place-items: center;
    margin-inline: auto;
    padding: 28px;
    box-shadow: 0 18px 40px rgba(78, 52, 46, 0.14);
}

.variant-edit-row {
    display: grid;
    grid-template-columns: 1.2fr .8fr .8fr .8fr auto auto;
    gap: 8px;
    align-items: center;
}

.qr-preview canvas,
.qr-preview img {
    width: 100% !important;
    height: auto !important;
    display: block;
}

.animate-rise {
    animation: rise .6s ease both;
}
@keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 991px) {
    .admin-layout {
        min-height: 100vh;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
        flex-basis: auto;
        min-height: auto;
        max-height: none;
        position: sticky;
        top: 0;
        z-index: 1020;
        padding: 0.85rem !important;
        gap: 0.75rem !important;
        border-bottom: 1px solid rgba(212, 175, 55, 0.28);
        box-shadow: 0 12px 28px rgba(78, 52, 46, 0.14);
    }

    .admin-brand-row {
        justify-content: space-between;
    }

    .sidebar .brand-mark {
        width: 40px;
        height: 40px;
        border-radius: 14px;
    }

    .admin-nav {
        flex-direction: column !important;
        gap: 0.4rem;
        margin-top: 0.25rem;
        max-height: calc(100vh - 92px);
        overflow-y: auto;
        scrollbar-width: none;
    }

    .sidebar .nav-link {
        width: 100%;
        white-space: nowrap;
        padding: 0.78rem 0.95rem;
        border-radius: 14px;
        font-size: 0.92rem;
    }

    .sidebar .nav-link.active {
        box-shadow: inset 4px 0 0 var(--gold);
    }

    .admin-user {
        display: none;
    }

    main {
        max-height: none;
        overflow: visible;
        width: 100%;
    }
}

@media (max-width: 576px) {
    body {
        background: var(--page-bg);
    }

    .admin-main {
        padding: 1rem !important;
    }

    .surface-card {
        border-radius: 18px;
    }

    .stat-card,
    .analysis-metric-card,
    .payment-status-card {
        border-radius: 18px;
    }

    .table > :not(caption) > * > * {
        padding: 0.75rem 0.7rem;
    }

    .btn,
    .form-control,
    .form-select {
        max-width: 100%;
    }
}

.customer-menu-body {
    background: var(--page-bg, #fff4dd);
    color: var(--text);
}

.customer-menu {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--page-bg, #fff4dd);
    padding-bottom: calc(140px + var(--floating-safe-bottom) + var(--floating-viewport-offset));
}

.customer-topbar {
    background: var(--green);
    color: #fff;
    padding: 18px 16px 22px;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.brand-badge {
    width: 44px;
    height: 44px;
    background: #fff;
    border-radius: 12px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-initial {
    color: var(--green);
    font-weight: 700;
    font-size: 1.1rem;
}

.brand-meta {
    flex: 1;
    min-width: 0;
}

.brand-title {
    font-weight: 600;
    font-size: 1rem;
}

.brand-sub {
    font-size: 0.8rem;
    opacity: 0.7;
}

.customer-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    color: var(--green);
    border-radius: 12px;
    padding: 10px 12px;
}

.customer-search input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.95rem;
    color: #3a2b2b;
}

.customer-body {
    padding: 16px;
}

.category-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 8px 0 14px;
}

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.menu-item-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f0e8e8;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}

.menu-item-card.has-qty {
    border-color: rgba(78, 52, 46, 0.25);
}

.menu-item-card.is-unavailable {
    opacity: 0.65;
}

.menu-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.veg-dot {
    width: 12px;
    height: 12px;
    border: 2px solid #1d9a36;
    border-radius: 2px;
}

.menu-item-name {
    font-size: 1rem;
    font-weight: 600;
}

.menu-item-price {
    font-weight: 600;
    color: #3a2b2b;
}

.menu-item-desc {
    font-size: 0.85rem;
    color: #6c5d5d;
}

.menu-item-category {
    font-size: 0.75rem;
    color: #9b8a8a;
}

.menu-item-media {
    width: 120px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.menu-item-image,
.menu-item-placeholder {
    width: 120px;
    height: 92px;
    border-radius: 12px;
    background: #f1eaea;
    object-fit: cover;
    display: grid;
    place-items: center;
    color: #a08e8e;
    font-size: 1.4rem;
}

.qty-control {
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    padding: 6px 8px;
    border-radius: 999px;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.15);
}

.qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: var(--green);
    color: #fff;
    font-weight: 700;
    display: grid;
    place-items: center;
    line-height: 1;
}

.qty-btn:disabled {
    background: #c6d7cc;
    color: #fff;
}

.qty-value {
    min-width: 18px;
    text-align: center;
    font-weight: 600;
    color: #2f2f2f;
}

.menu-empty {
    display: none;
    text-align: center;
    color: #8b7b7b;
    margin-top: 18px;
}

.menu-fab {
    position: fixed;
    right: calc(18px + var(--floating-safe-right));
    bottom: calc(90px + var(--floating-safe-bottom) + var(--floating-viewport-offset));
    background: var(--green);
    color: #fff;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: none;
    box-shadow: 0 14px 28px rgba(78, 52, 46, 0.25);
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    z-index: 1040;
}

.menu-item-variant {
    display: grid;
    gap: 4px;
    margin-top: 8px;
    max-width: 210px;
}

.menu-item-variant span {
    font-size: .75rem;
    color: #777;
}

.menu-fab:hover { color: #fff; }

.cart-bar {
    position: fixed;
    left: calc(16px + var(--floating-safe-left));
    right: calc(16px + var(--floating-safe-right));
    bottom: calc(18px + var(--floating-safe-bottom) + var(--floating-viewport-offset));
    background: var(--green);
    color: #fff;
    border-radius: 16px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 18px 32px rgba(78, 52, 46, 0.25);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 1035;
}

/* Ensure the cart leaves room on the right for the floating FAB on small screens */
@media (max-width: 576px) {
    .cart-bar {
        left: calc(12px + var(--floating-safe-left));
        right: calc(12px + var(--floating-safe-right));
        padding-right: 110px; /* space for the FAB */
    }
    .menu-fab {
        bottom: calc(24px + var(--floating-safe-bottom) + var(--floating-viewport-offset)); /* sit above the cart area visually */
        right: calc(20px + var(--floating-safe-right));
    }
}

.cart-bar.is-active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.cart-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.cart-summary {
    font-size: 0.8rem;
    opacity: 0.85;
}

.cart-checkout {
    border-radius: 12px;
    font-weight: 600;
    padding: 6px 14px;
}

.cash-note {
    background: #f2f8f4;
    border: 1px solid #dbece2;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.85rem;
    color: var(--green-dark);
}

.palette-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.palette-preview-swatch {
    min-height: 92px;
    border: 1px solid rgba(78, 52, 46, 0.14);
    border-radius: 16px;
    padding: 12px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,255,255,0.92)),
        var(--swatch);
    box-shadow: 0 10px 24px rgba(78, 52, 46, 0.08);
    display: flex;
    flex-direction: column;
    justify-content: end;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.palette-preview-swatch::before {
    content: '';
    position: absolute;
    inset: 0;
    height: 34px;
    background: var(--swatch);
}

.palette-preview-swatch span,
.palette-preview-swatch strong {
    position: relative;
}

.palette-preview-swatch span {
    color: var(--muted);
    font-size: 0.78rem;
}

.palette-preview-swatch strong {
    color: var(--text);
    font-size: 0.95rem;
}

.logo-preview-box {
    min-height: 56px;
    border: 1px solid #dee6e0;
    border-radius: 16px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    background: #fff;
}

.logo-preview-box img {
    max-width: 120px;
    max-height: 52px;
    object-fit: contain;
}

.store-status-card {
    min-height: 56px;
    border-radius: 16px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(78, 52, 46, 0.14);
    background: #f8fbf8;
}

.store-status-card.is-open {
    color: var(--green-dark);
    background: var(--mint);
}

.store-status-card.is-closed,
.store-closed-banner {
    color: #8a4b00;
    background: #fff5df;
    border-color: #f0d39b;
}

.store-hours-table td,
.store-hours-table th {
    white-space: nowrap;
}

.store-closed-banner {
    margin: 14px 16px 0;
    border: 1px solid #f0d39b;
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 0.86rem;
}

.customer-token-card {
    margin: 14px 16px 0;
    border: 1px solid rgba(78, 52, 46, 0.18);
    border-radius: 16px;
    padding: 14px;
    text-align: center;
    background: #fff;
    box-shadow: 0 12px 26px rgba(78, 52, 46, 0.1);
}

.customer-token-number {
    color: var(--green-dark);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
}

.order-edit-items {
    display: grid;
    gap: 12px;
}

.order-edit-row {
    display: grid;
    grid-template-columns:
        minmax(200px, 1fr)
        minmax(200px, 1fr)
        100px
        auto;
    gap: 12px;
    align-items: center;
}

.order-edit-row .edit-remove {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .order-edit-row {
        grid-template-columns: 1fr;
    }
}

.order-edit-row .edit-variant {
    min-width: 180px;
}

@media (max-width: 576px) {
    .order-edit-row {
        grid-template-columns: 1fr;
    }
}

.customer-menu-body.modal-open .customer-menu,
.customer-menu-body.modal-open .cart-bar {
    filter: blur(4px);
}

.customer-menu-body .modal-backdrop.show {
    backdrop-filter: blur(5px);
}

.chart-box {
    min-height: 260px;
    position: relative;
}

.analysis-list {
    display: grid;
    gap: 10px;
}

.analysis-item {
    border: 1px solid rgba(78, 52, 46, 0.1);
    border-radius: 14px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.74);
}

.analysis-metric-card {
    height: 100%;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #fff, #fcfcf8);
    box-shadow: 0 14px 40px rgba(10, 47, 20, 0.06);
    padding: 20px;
}

.analysis-metric-value {
    color: var(--text);
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 800;
    line-height: 1.15;
}

.analysis-rank-row,
.analysis-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid rgba(78, 52, 46, 0.1);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.74);
}

.analysis-suggestion {
    justify-content: flex-start;
}

.analysis-suggestion i {
    color: var(--green);
}

.payment-status-card {
    border-radius: 16px;
    border: 1px solid rgba(78, 52, 46, 0.12);
    background: #fff;
    padding: 14px;
}

.checkout-modal {
    border-radius: 16px;
}

.success-token {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 8px;
}

.category-modal {
    border-radius: 16px;
}

.category-list {
    display: grid;
    gap: 10px;
}

.category-link {
    display: block;
    width: 100%;
    text-align: left;
    text-decoration: none;
    color: #2f2f2f;
    border: 1px solid #e7ece9;
    border-radius: 12px;
    padding: 10px 12px;
    background: #f9fbf9;
}

.category-link:hover,
.category-link.is-active {
    color: var(--green-dark);
    border-color: #cfe4d5;
    background: #eef8f1;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
    color: #1b2e21;
    font-size: 0.75rem;
    font-weight: 700;
}

.calendar-cell {
    background: #f8fbf8;
    border: 1px solid #e5efe8;
    border-radius: 10px;
    padding: 8px;
    min-height: 64px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: left;
    color: #2f2f2f;
    cursor: pointer;
    width: 100%;
}

.calendar-cell.is-empty {
    background: transparent;
    border: none;
    pointer-events: none;
}

.calendar-cell.is-active {
    border-color: rgba(212, 175, 55, 0.65);
    box-shadow: 0 10px 20px rgba(78, 52, 46, 0.14);
}

.calendar-grid-month .calendar-cell {
    min-height: 108px;
    gap: 6px;
    justify-content: flex-start;
}

.calendar-cell.is-closed {
    background: #fff5df;
    border-color: #f0d39b;
}

.calendar-day {
    font-weight: 600;
    font-size: 0.85rem;
}

.calendar-count {
    font-size: 0.75rem;
    color: var(--green-dark);
    font-weight: 600;
}

.calendar-event,
.calendar-more {
    display: block;
    width: 100%;
    border-radius: 8px;
    padding: 3px 6px;
    background: #e9edff;
    color: #1246c4;
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-more {
    background: var(--mint);
    color: var(--green-dark);
}

.day-order-card {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid rgba(78, 52, 46, 0.12);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #fff;
}

@media (max-width: 576px) {
    .customer-menu {
        max-width: 100%;
    }

    .calendar-grid,
    .calendar-weekdays {
        min-width: 780px;
    }

    .menu-item-card {
        padding-bottom: 18px;
    }

    .variant-edit-row,
    .order-edit-row {
        grid-template-columns: 1fr;
    }
}
