/* Mobile bottom navigation + bottom sheets */

:root {
    --bottom-bar-height: 56px;
}

.bottom-bar {
    background: #fff;
    box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.08);
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 10050;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation: bottomBarIn 0.35s ease-out forwards;
    transform: translateY(100%);
    opacity: 0;
}

@keyframes bottomBarIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.bottom-bar .bar-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
    min-height: var(--bottom-bar-height);
    padding: 6px 0 4px;
}

.bottom-bar .nav-item {
    flex: 1;
    text-align: center;
    font-size: 13px;
    color: #666;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    border: none;
    background: none;
    padding: 4px 0;
}

.bottom-bar .nav-item i {
    font-size: 20px;
    display: block;
    margin-bottom: 2px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.bottom-bar .nav-item span {
    display: block;
    font-size: 10px;
    margin-top: 1px;
    font-weight: 500;
}

.bottom-bar .nav-item.is-active,
.bottom-bar .nav-item.is-active i,
.bottom-bar .nav-item.is-active span {
    color: var(--am-primary, #E8663D);
}

.bottom-bar .nav-item .badge {
    position: absolute;
    top: 0;
    right: calc(50% - 22px);
    background: #dc3545;
    color: #fff;
    font-size: 9px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    z-index: 1;
}

/* Backdrop */
.bottom-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.bottom-sheet-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Bottom sheet panels */
.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-height: min(78vh, 520px);
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
    z-index: 10045;
    display: flex;
    flex-direction: column;
    transform: translateY(calc(100% + var(--bottom-bar-height)));
    opacity: 0;
    visibility: hidden;
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease, visibility 0.25s ease;
    overflow: hidden;
}

.bottom-sheet.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 999px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 10px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.bottom-sheet-header h6 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #282828;
}

.bottom-sheet-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    color: #555;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.bottom-sheet-close:hover {
    background: #eee;
    color: #282828;
}

.bottom-sheet-body {
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.bottom-sheet-welcome {
    font-size: 14px;
    color: #555;
    margin: 0 0 12px;
    padding: 10px 12px;
    background: #fafafa;
    border-radius: 8px;
}

.bottom-sheet-welcome strong {
    color: #282828;
}

.bottom-sheet-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bottom-sheet-menu li {
    border-bottom: 1px solid #f0f0f0;
}

.bottom-sheet-menu li:last-child {
    border-bottom: none;
}

.bottom-sheet-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 4px;
    color: #282828;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.bottom-sheet-menu a i {
    width: 20px;
    text-align: center;
    color: #888;
    font-size: 16px;
}

.bottom-sheet-menu a:hover,
.bottom-sheet-menu a:focus {
    color: var(--am-primary, #E8663D);
}

.bottom-sheet-menu a.is-logout {
    color: #c0392b;
}

.bottom-sheet-menu a.is-logout i {
    color: #c0392b;
}

.bottom-sheet .form-control {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 15px;
}

.bottom-sheet .form-control:focus {
    border-color: #ccc;
    box-shadow: none;
}

.bottom-sheet .btn-primary {
    background: var(--am-primary, #E8663D);
    border-color: var(--am-primary, #E8663D);
    border-radius: 8px;
    padding: 12px;
    font-weight: 600;
    width: 100%;
}

.bottom-sheet-cart-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.bottom-sheet-cart-item:last-of-type {
    border-bottom: none;
}

.bottom-sheet-cart-item img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
    flex-shrink: 0;
}

.bottom-sheet-cart-item .name {
    font-size: 13px;
    font-weight: 600;
    color: #282828;
    margin-bottom: 4px;
    line-height: 1.3;
}

.bottom-sheet-cart-item .meta {
    font-size: 12px;
    color: #888;
}

.bottom-sheet-cart-total {
    font-size: 15px;
    font-weight: 700;
    color: #282828;
    margin: 12px 0;
}

.bottom-sheet-empty {
    text-align: center;
    color: #888;
    padding: 12px 0 8px;
    font-size: 14px;
}

body.bottom-sheet-open {
    overflow: hidden;
}

@media (min-width: 768px) {
    .bottom-bar,
    .bottom-sheet,
    .bottom-sheet-backdrop {
        display: none !important;
    }
}
