*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Be Vietnam Pro', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    padding-bottom: 120px;
}
input, button, textarea, select { font: inherit; }
button { cursor: pointer; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(1rem); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.page-header {
    background-color: #000;
}

.header-logo-wrapper {
    padding: 0.75rem 0;
}

.header-logo-wrapper img {
    width: 140px;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.top-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    gap: 1rem;
}

.menu-type-switcher {
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
    flex-shrink: 0;
}
.menu-type-switcher button {
    flex-grow: 0;
    padding: 0.6rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}
.menu-type-switcher button.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-heading);
}

.language-switcher {
    display: flex;
    gap: 0.25rem;
    background: var(--surface-color);
    padding: 0.25rem;
    border-radius: 1.25rem;
    border: 1px solid var(--border-color);
}
.language-switcher button {
    background-color: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.375rem 0.875rem;
    border-radius: 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}
.language-switcher button.active {
    background-color: var(--primary-color);
    color: var(--text-heading);
}

.sticky-controls {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--background-color) 85%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.search-and-actions-area {
    position: relative;
    height: 70px;
}

.search-bar-wrapper,
.scrolled-actions-container {
    position: absolute;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.scrolled-actions-container {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

body.is-scrolled .search-bar-wrapper {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

body.is-scrolled .scrolled-actions-container {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.scrolled-actions-container button {
    height: 44px;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-heading);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    gap: 0.5rem;
}

#scrolled-search-btn svg {
    flex-shrink: 0;
}
#scrolled-search-btn.is-text-only svg {
    display: none;
}

.search-box {
    position: relative;
    color: var(--text-muted);
}
.search-box .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
.search-box input {
    width: 100%;
    padding: 0.875rem 3rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--surface-color);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    color: var(--text-color);
}
.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 25%, transparent);
}
.search-box input::placeholder { color: var(--text-muted); }

.clear-search-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, visibility 0.2s;
}

.search-box:has(:focus) .clear-search-btn,
.sticky-controls.search-active .clear-search-btn {
    opacity: 1;
    pointer-events: auto;
}

.category-nav-wrapper {
    padding-bottom: 0.5rem;
    transition: all 0.3s ease;
    max-height: 200px;
    overflow: hidden;
    margin: 0 -1rem;
}

#sticky-controls.search-active .category-nav-wrapper {
    max-height: 0;
    opacity: 0;
    padding-bottom: 0;
    pointer-events: none;
}

#sticky-controls.search-active .search-bar-wrapper {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#sticky-controls.search-active .scrolled-actions-container {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.category-nav-scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 1rem;
}
.category-nav-scroll::-webkit-scrollbar { display: none; }

.category-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    transition: color 0.2s ease;
    flex-shrink: 0;
    padding: 0.75rem 0;
    width: 80px;
    position: relative;
}
.category-button::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 80%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px;
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.category-button.active { color: var(--text-heading); }
.category-button.active::after { transform: translateX(-50%) scaleX(1); }

.category-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 1.25rem;
    background: var(--surface-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    font-size: 1.75rem;
    line-height: 1;
}
.category-button.active .category-icon-wrapper {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.category-button span {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
}

#menu-container {
    padding-top: 0;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

#ongoing-order-banner {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 1.25rem;
    display: none;
    text-align: center;
    animation: fadeInUp 0.5s ease;
    border: 1px solid;
}
#ongoing-order-banner h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.25rem; }
#ongoing-order-banner p { font-size: 0.9rem; }
.status-pending { background-color: #33230b; color: #ffca28; border-color: #ffca28; }
.status-preparing { background-color: #1c2e4a; color: #6ea8ff; border-color: #6ea8ff; }
.status-ready { background-color: #163c22; color: #68d391; border-color: #68d391; }
.status-completed { background-color: #2d3748; color: #a0aec0; border-color: #a0aec0; }

.menu-category-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.menu-category:first-child .menu-category-title {
    margin-top: 1rem;
}

.menu-category-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.menu-item {
    background: var(--surface-color);
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
    border: 1px solid var(--border-color);
}
.menu-item:hover { transform: translateY(-4px) scale(1.02); box-shadow: var(--shadow-lg); }
.menu-item:active { transform: translateY(-2px) scale(1.01); }

.item-thumbnail {
    width: 90px;
    height: 90px;
    border-radius: 1rem;
    background-color: #333;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}
.item-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.item-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-heading);
    line-height: 1.4;
}
.item-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.item-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 0.5rem;
}

.button-reorder {
    background: var(--primary-color);
    color: var(--text-heading);
    border: none;
    padding: 0.5rem 1rem;
    margin-top: 0.75rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-content {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    border-radius: 1.5rem 1.5rem 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.2);
    animation: slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1rem 1rem 1.5rem;
    flex-shrink: 0;
}
.modal-header h2 {
    font-size: 1.5rem;
}
.modal-close-button {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.modal-close-button:hover {
    background: var(--border-color);
    color: var(--text-heading);
}

#item-detail-body {
    overflow-y: auto;
    padding: 0 1rem 1rem 1.5rem;
}
.item-detail-image {
    width: calc(100% + 0.5rem);
    padding-bottom: 56.25%;
    height: 0;
    border-radius: 1rem;
    background-size: cover;
    background-position: center;
    margin-bottom: 1.5rem;
}
.item-detail-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-right: 0.5rem;
}
.item-detail-content h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.2;
}
.item-detail-description { color: var(--text-muted); line-height: 1.5; margin: -0.75rem 0 0 0; }

.options-section h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; }
.options-list { display: flex; flex-direction: column; gap: 0.5rem; }
.option-item { display: flex; align-items: center; }
.option-item input { display: none; }
.option-item label { flex-grow: 1; display: flex; justify-content: space-between; align-items: center; padding: 0.875rem; background: var(--background-color); border: 1px solid var(--border-color); border-radius: 0.75rem; transition: all 0.2s ease; cursor: pointer; }
.option-item input:checked + label { border-color: var(--primary-color); background-color: color-mix(in srgb, var(--primary-color) 10%, var(--background-color)); }
.option-item .option-name { color: var(--text-color); }
.option-item .option-price { font-weight: 600; color: var(--text-muted); }
.item-note-textarea { width: 100%; min-height: 80px; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 0.75rem; background: var(--background-color); resize: vertical; color: var(--text-color); }
.item-note-textarea:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 25%, transparent); }

.item-detail-footer { padding: 1rem 1.5rem; background: var(--surface-color); border-top: 1px solid var(--border-color); position: sticky; bottom: 0; }
.item-action-row { display: flex; gap: 0.75rem; width: 100%; align-items: center; }
.item-detail-footer .button-primary { flex-grow: 1; display: flex; justify-content: space-between; align-items: center; padding: 0 1.5rem; height: 52px; }
.item-detail-footer .quantity-control { flex-shrink: 0; height: 52px; }
.item-detail-footer .quantity-btn { height: 100%; }

.button-primary { padding: 0.875rem; background: var(--primary-color); color: white; border: none; border-radius: 0.75rem; font-size: 1rem; font-weight: 600; transition: all 0.2s ease; }
.button-primary:hover { background: var(--primary-color-hover); }
.button-primary:active { transform: scale(0.98); }
.button-primary:disabled { background: #555; cursor: not-allowed; opacity: 0.7; }

.bottom-cart-bar { position: fixed; bottom: 0; left: 0; width: 100%; background-color: var(--surface-color); box-shadow: 0 -2px 15px rgba(0,0,0,0.2); display: flex; justify-content: space-between; align-items: center; padding: 1rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 1000; transform: translateY(120%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); border-top: 1px solid var(--border-color); }
.bottom-cart-bar.show { transform: translateY(0); }
.cart-info { display: flex; flex-direction: column; }
#cart-bar-count { font-size: 0.9rem; color: var(--text-muted); }
#cart-bar-total { font-size: 1.25rem; font-weight: 700; color: var(--text-heading); }

#cart-modal .modal-content, #submit-modal .modal-content { padding: 0 1.5rem 1.5rem; }
#cart-items-container { max-height: 50vh; overflow-y: auto; margin: 0 -1.5rem; padding: 0 1.5rem 1rem; }
.cart-empty-message { padding: 2rem; text-align: center; color: var(--text-muted); }
.cart-item { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--border-color); }
.cart-item:last-child { border-bottom: none; }
.cart-item-thumbnail { width: 64px; height: 64px; border-radius: 0.75rem; background-size: cover; background-position: center; }
.cart-item-details { display: flex; flex-direction: column; gap: 0.25rem; }
.cart-item-name { font-weight: 600; line-height: 1.3; }
.cart-item-addons { font-size: 0.8rem; color: var(--text-muted); }
.cart-item-note { font-size: 0.8rem; font-style: italic; color: var(--primary-color); }

.quantity-control { display: flex; align-items: center; background: var(--background-color); border: 1px solid var(--border-color); padding: 0; border-radius: 0.75rem; overflow: hidden; }
.quantity-btn { background-color: transparent; border: none; width: 44px; height: 44px; font-size: 1.25rem; font-weight: 400; color: var(--text-color); transition: all 0.2s ease; border-radius: 0; }
.quantity-btn:hover { background-color: color-mix(in srgb, var(--background-color) 80%, white); }
.quantity-control span { font-size: 1.1rem; font-weight: 600; min-width: 2.5rem; text-align: center; }

.cart-summary { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.2rem; font-weight: 600; padding: 1rem 0; border-top: 1px solid var(--border-color); margin-top: 1rem; }
#cart-modal .button-primary, #submit-modal .button-primary { width: 100%; }

.order-meta { display: flex; flex-direction: column; gap: 0.75rem; margin: 1rem 0; }
.order-meta input, .order-meta textarea { width: 100%; padding: 0.75rem; border: 1px solid var(--border-color); background-color: var(--background-color); border-radius: 0.75rem; font-size: 1rem; color: var(--text-color); transition: box-shadow 0.2s ease; }
.order-meta input:focus, .order-meta textarea:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 25%, transparent); }
.order-meta textarea { resize: vertical; min-height: 60px; }

.skeleton-wrapper { width: 100%; }
.skeleton { position: relative; overflow: hidden; background-color: var(--surface-color); border-radius: 0.75rem; }
.skeleton::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; transform: translateX(-100%); background-image: linear-gradient(90deg, transparent 0, rgba(255,255,255,0.03) 20%, rgba(255,255,255,0.06) 60%, transparent); animation: shimmer 1.5s infinite; }
.skeleton-title { height: 2.25rem; width: 40%; margin-bottom: 1rem; }
.skeleton-card { height: 114px; margin-bottom: 1rem; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-heading);
    color: var(--background-color);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
    transition: opacity 0.5s ease;
}