* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    overflow-x: hidden;
    padding-bottom: 60px;
}

/* 顶部导航 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    max-width: 100%;
}

.logo {
    font-size: 20px;
    font-weight: 600;
}

.cart-icon {
    position: relative;
    width: 32px;
    height: 32px;
    cursor: pointer;
}

.cart-icon svg {
    width: 100%;
    height: 100%;
}

.admin-link {
    color: white;
    font-size: 20px;
    text-decoration: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.admin-link:active {
    background: rgba(255,255,255,0.2);
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff4757;
    color: white;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    padding: 0 4px;
}

/* 分类导航 */
.category-nav {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: white;
    z-index: 90;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.category-list {
    display: flex;
    padding: 0 8px;
    white-space: nowrap;
}

.category-item {
    padding: 12px 20px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    position: relative;
    transition: color 0.3s;
    flex-shrink: 0;
}

.category-item.active {
    color: #667eea;
    font-weight: 600;
}

.category-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 2px;
    background: #667eea;
    border-radius: 1px;
}

/* 主内容区 */
.main-content {
    margin-top: 104px;
    padding: 16px;
}

.menu-section {
    max-width: 100%;
}

.category-title {
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 16px;
    color: #333;
    padding-left: 8px;
    border-left: 3px solid #667eea;
}

.menu-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.menu-item:active {
    transform: scale(0.98);
}

.menu-item-image {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f0f0f0;
}

.menu-item-info {
    flex: 1;
    margin-left: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.menu-item-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.menu-item-desc {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.menu-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-item-price {
    font-size: 18px;
    font-weight: 600;
    color: #ff4757;
}

.menu-item-price::before {
    content: '¥';
    font-size: 14px;
}

.add-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.add-btn:active {
    transform: scale(0.9);
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.quantity-btn:active {
    background: #e0e0e0;
}

.quantity {
    font-size: 16px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

/* 购物车侧边栏 */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    background: white;
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
}

.cart-sidebar.open {
    right: 0;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.cart-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-btn:active {
    background: #f0f0f0;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.empty-cart {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-cart p {
    margin-bottom: 8px;
}

.empty-tip {
    font-size: 12px;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
    margin-left: 12px;
}

.cart-item-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.cart-item-price {
    font-size: 14px;
    color: #ff4757;
    font-weight: 600;
}

.cart-item-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.cart-footer {
    padding: 16px;
    border-top: 1px solid #f0f0f0;
    background: white;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.total-label {
    font-size: 16px;
    font-weight: 600;
}

.total-price {
    font-size: 20px;
    font-weight: 600;
    color: #ff4757;
}

.checkout-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.checkout-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.checkout-btn:active:not(:disabled) {
    opacity: 0.8;
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 订单确认弹窗 */
.order-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.order-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.order-modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.order-item-info {
    flex: 1;
}

.order-item-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.order-item-detail {
    font-size: 12px;
    color: #999;
}

.order-item-price {
    font-size: 16px;
    font-weight: 600;
    color: #ff4757;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #f0f0f0;
}

.modal-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
}

.modal-price {
    font-size: 20px;
    color: #ff4757;
}

.confirm-order-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.confirm-order-btn:active {
    opacity: 0.8;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.toast.show {
    opacity: 1;
    visibility: visible;
}

/* 响应式优化 */
@media (max-width: 375px) {
    .menu-item-image {
        width: 80px;
        height: 80px;
    }
    
    .menu-item-name {
        font-size: 15px;
    }
    
    .menu-item-price {
        font-size: 16px;
    }
}

