/* 通用样式 */
body {
    font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    background-color: #f8f9fc;
    overflow-x: hidden;
}

.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* 侧边栏样式 */
.sidebar {
    min-width: 250px;
    max-width: 250px;
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    color: #fff;
    transition: all 0.3s;
    z-index: 999;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.sidebar.active {
    margin-left: -250px;
}

.sidebar .sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
}

.sidebar-logo h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.sidebar-logo i {
    color: #ffc107;
}

.user-profile {
    padding: 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
    margin-right: 15px;
    color: #fff;
}

.user-info h6 {
    margin: 0;
    font-weight: 600;
}

.user-info .badge {
    font-size: 0.7rem;
    text-transform: uppercase;
}

.sidebar ul.components {
    padding: 20px 0;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar ul p {
    color: #fff;
    padding: 10px;
}

.sidebar ul li a {
    padding: 12px 20px;
    font-size: 1rem;
    display: block;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

.sidebar ul li a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-left-color: #ffc107;
}

.sidebar ul li.active > a {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-left-color: #ffc107;
}

.sidebar ul li.nav-item {
    margin-bottom: 5px;
}

.nav-divider {
    height: 1px;
    margin: 15px 0;
    background: rgba(255, 255, 255, 0.1);
}

.logout-link {
    color: #ff6b6b !important;
}

.sidebar-footer {
    padding: 15px 20px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
    display: flex;
    flex-direction: column;
}

/* 主要内容样式 */
#content {
    width: 100%;
    min-height: 100vh;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fc;
    position: relative;
    padding-top: 0 !important; /* 覆盖所有其他padding-top设置 */
}

#content.content-expanded {
    margin-left: -250px;
    width: calc(100% + 250px);
}

/* 顶部导航栏 */
.top-navbar {
    background: #fff !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    height: 60px;
    padding: 0 15px;
}

.page-title h4 {
    color: #2c3e50;
    font-weight: 600;
}

#sidebarCollapseMain {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: #2c3e50;
    padding: 0.5rem;
}

#sidebarCollapseMain:hover {
    color: #3498db;
}

.notification-btn, .profile-dropdown-btn {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    color: #2c3e50;
    padding: 0.5rem;
    transition: all 0.2s;
}

.notification-btn:hover, .profile-dropdown-btn:hover {
    color: #3498db;
}

.notification-dropdown {
    min-width: 300px;
    padding: 0;
    border: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.notification-dropdown .dropdown-header {
    background-color: #f8f9fa;
    padding: 15px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    font-weight: 600;
}

.notification-dropdown .dropdown-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f8f9fa;
}

.notification-dropdown .dropdown-item:hover {
    background-color: #f8f9fa;
}

/* 卡片样式增强 */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    margin-bottom: 20px;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e3e6f0;
}

.border-left-primary {
    border-left: 0.25rem solid #4e73df !important;
}

.border-left-success {
    border-left: 0.25rem solid #1cc88a !important;
}

.border-left-info {
    border-left: 0.25rem solid #36b9cc !important;
}

.border-left-warning {
    border-left: 0.25rem solid #f6c23e !important;
}

.border-left-danger {
    border-left: 0.25rem solid #e74a3b !important;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .sidebar {
        margin-left: -250px;
        position: fixed;
        top: 0;
        height: 100%;
        z-index: 1050;
        transition: margin-left 0.3s ease;
        box-shadow: 0 0 15px rgba(0,0,0,0.2);
        pointer-events: auto; /* 确保侧边栏可点击 */
    }
    
    /* 激活时显示侧边栏 */
    .sidebar:not(.active) {
        margin-left: 0;
    }
    
    /* 默认隐藏侧边栏 */
    .sidebar.active {
        margin-left: -250px;
    }
    
    /* 仅当body有sidebar-visible类时才显示侧边栏 */
    body.sidebar-visible .sidebar.active {
        margin-left: 0;
    }
    
    /* 遮罩层 */
    body.sidebar-visible::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    body.sidebar-visible::before {
        opacity: 1;
        visibility: visible;
    }
    /* 当侧边栏展开时，为内容添加左边距 */
    body.sidebar-visible #content {
        margin-left: 250px;
        transition: margin-left 0.3s;
    }
    /* 侧边栏收起时内容恢复正常 */
    body:not(.sidebar-visible) #content {
        margin-left: 0;
        transition: margin-left 0.3s;
    }
    #content {
        width: 100%;
        margin-left: 0 !important; /* 确保移动端内容区域不受侧边栏影响 */
    }
    #content.content-expanded {
        margin-left: 0 !important; /* 移动端下内容区域始终保持全宽 */
        width: 100% !important;
    }
    .btn-block {
        display: block;
        width: 100%;
    }
    .card-body {
        padding: .75rem;
    }
    .table-responsive {
        font-size: 0.9rem;
    }
    .top-navbar {
        padding: 0 10px;
    }
    .page-title h4 {
        font-size: 1.1rem;
    }
    
    /* 增强移动端点单系统 */
    .order-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1030;
        background: white;
        box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
        max-height: 50vh;
        overflow-y: auto;
        border-top-left-radius: 15px;
        border-top-right-radius: 15px;
        transition: all 0.3s ease;
        padding-top: 15px;
    }
    
    .products-container {
        margin-bottom: 50vh; /* 为底部购物车留出空间 */
        padding-bottom: 15px;
    }
    
    /* 优化移动端商品卡片 */
    .product-card {
        margin-bottom: 15px;
    }
    
    .product-card .card-body {
        padding: 0.6rem;
    }
    
    .product-card .card-title {
        font-size: 0.9rem;
    }
    
    /* 移动端固定操作栏 */
    .mobile-action-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        padding: 10px 15px;
        z-index: 1040;
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
    
    /* 移动端底部导航栏 */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1040;
    }
    
    .mobile-nav-item {
        flex: 1;
        text-align: center;
        padding: 10px 0;
        color: #6c757d;
        text-decoration: none;
        font-size: 0.8rem;
    }
    
    .mobile-nav-item.active {
        color: #0d6efd;
    }
    
    .mobile-nav-item i {
        display: block;
        font-size: 1.2rem;
        margin-bottom: 3px;
    }
    
    /* 移动端搜索框优化 */
    .mobile-search-container {
        position: sticky;
        top: 0;
        z-index: 1020;
        background: white;
        padding: 10px 15px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    }
    
    /* 移动端增强手势操作 */
    .swipe-container {
        overflow-x: hidden;
        position: relative;
    }
    
    .swipe-actions {
        position: absolute;
        right: 0;
        top: 0;
        height: 100%;
        display: flex;
        transform: translateX(100%);
        transition: transform 0.3s;
    }
    
    .swipe-item {
        transform: translateX(0);
        transition: transform 0.3s;
    }
    
    .swipe-item.swiped {
        transform: translateX(-100px);
    }
    
    /* 移动端优化表单元素 */
    .form-control {
        font-size: 16px; /* 防止iOS自动缩放 */
    }
    
    /* 点击区域扩大 */
    .btn, .nav-link, .form-control {
        min-height: 44px; /* 符合苹果触摸指南 */
    }
    
    /* 移动端优化表格 */
    .mobile-list-item {
        border-bottom: 1px solid #f0f0f0;
        padding: 15px 0;
    }
    
    .mobile-list-actions {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
    }

    /* 增强移动端侧边栏按钮的可见性 */
    #sidebarCollapseMain {
        background-color: rgba(255, 255, 255, 0.9);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        margin-right: 10px;
        padding: 0;
    }
    
    #sidebarCollapseMain:active {
        background-color: rgba(230, 230, 230, 0.9);
        transform: scale(0.95);
    }
    
    /* 移动端菜单标签样式 */
    #sidebarCollapseMain .menu-label {
        position: absolute;
        bottom: -20px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.7rem;
        color: #666;
        white-space: nowrap;
        opacity: 0;
        transition: opacity 0.3s;
    }
    
    /* 显示菜单标签 - 需要JavaScript激活 */
    #sidebarCollapseMain.show-label .menu-label {
        opacity: 1;
    }
}

/* 针对超小屏幕的增强 */
@media (max-width: 576px) {
    .table th, .table td {
        padding: 0.5rem;
    }
    .card-header {
        padding: 0.75rem 1rem;
    }
    .card-body {
        padding: 0.75rem;
    }
    h1, .h1 {
        font-size: 1.8rem;
    }
    h2, .h2 {
        font-size: 1.6rem;
    }
    h3, .h3 {
        font-size: 1.4rem;
    }
    .btn {
        padding: 0.5rem 0.75rem;
    }
    .btn-lg {
        padding: 0.75rem 1rem;
    }
    .form-control-lg {
        font-size: 1.1rem;
    }
    
    /* 超小屏幕进一步优化 */
    .container, .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .row {
        margin-left: -5px;
        margin-right: -5px;
    }
    
    .col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, 
    .col-7, .col-8, .col-9, .col-10, .col-11, .col-12,
    .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6,
    .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
        padding-left: 5px;
        padding-right: 5px;
    }
}

/* 增强深色模式支持 */
@media (prefers-color-scheme: dark) {
    .dark-mode-supported {
        /* 深色模式样式，如果需要 */
    }
}

/* 大按钮样式适合触屏 */
.btn-lg {
    padding: 0.75rem 1.25rem;
    font-size: 1.25rem;
    border-radius: 0.5rem;
}

/* 表格增强 */
.table th, .table td {
    padding: 1rem;
    vertical-align: middle;
}

/* 点单页面样式 */
.product-card {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e3e6f0;
    transition: all 0.2s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* 登录页特殊样式 */
.login-page {
    background-color: #4e73df;
    background-image: linear-gradient(180deg, #4e73df 10%, #224abe 100%);
    background-size: cover;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 会员卡片样式 */
.member-card {
    background: linear-gradient(120deg, #2196F3, #0D47A1);
    color: white;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.member-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: url('/static/images/card-pattern.svg');
    opacity: 0.1;
}

/* 手机适配增强 */
@media (max-width: 576px) {
    .table th, .table td {
        padding: 0.5rem;
    }
    .card-header {
        padding: 0.75rem 1rem;
    }
    .card-body {
        padding: 0.75rem;
    }
    h1, .h1 {
        font-size: 1.8rem;
    }
    h2, .h2 {
        font-size: 1.6rem;
    }
    h3, .h3 {
        font-size: 1.4rem;
    }
    .btn {
        padding: 0.5rem 0.75rem;
    }
    .btn-lg {
        padding: 0.75rem 1rem;
    }
    .form-control-lg {
        font-size: 1.1rem;
    }
}

/* 桌台状态指示器 */
.table-status {
    width: 100%;
    height: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.status-free {
    background-color: #1cc88a;
}

.status-occupied {
    background-color: #e74a3b;
}

.status-reserved {
    background-color: #f6c23e;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* DeepseekAI功能区样式 */
.ai-chat-container {
    height: 70vh;
    display: flex;
    flex-direction: column;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    border: 1px solid #e3e6f0;
    border-radius: 10px;
    background-color: #f8f9fc;
    margin-bottom: 15px;
}

.ai-message {
    margin-bottom: 15px;
    max-width: 80%;
}

.ai-message.user {
    margin-left: auto;
    background-color: #4e73df;
    color: white;
    border-radius: 15px 15px 0 15px;
    padding: 10px 15px;
}

.ai-message.assistant {
    margin-right: auto;
    background-color: #e9ecef;
    color: #333;
    border-radius: 15px 15px 15px 0;
    padding: 10px 15px;
}

/* 侧边栏展开按钮 */
.sidebar-expand-btn {
    position: fixed;
    left: 15px;
    top: 15px;
    z-index: 990;
    background-color: #2c3e50;
    color: #fff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    border: none;
}

.sidebar-expand-btn:hover {
    background-color: #3498db;
    color: #fff;
}

/* 桌面端响应式断点
 * xs: < 576px (已有移动端样式)
 * sm: 576px - 767px (已有移动端样式)
 * md: 768px - 991px (中等屏幕)
 * lg: 992px - 1199px (大屏)
 * xl: 1200px - 1399px (超大屏)
 * xxl: >= 1400px (超宽屏)
 */

/* 中等屏幕桌面端 (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .sidebar {
        min-width: 200px;
        max-width: 200px;
    }
    
    .sidebar-logo h3 {
        font-size: 1.2rem;
    }
    
    .sidebar ul li a {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .user-profile {
        padding: 15px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .product-card .card-title {
        font-size: 0.9rem;
    }
    
    .notification-dropdown {
        min-width: 250px;
    }
    
    /* 调整内容区域 */
    #content.content-expanded {
        margin-left: -200px;
        width: calc(100% + 200px);
    }
    
    /* 调整栅格系统 */
    .col-md-8 {
        flex: 0 0 auto;
        width: 60%;
    }
    
    .col-md-4 {
        flex: 0 0 auto;
        width: 40%;
    }
}

/* 大屏桌面端 (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .sidebar {
        min-width: 220px;
        max-width: 220px;
    }
    
    #content.content-expanded {
        margin-left: -220px;
        width: calc(100% + 220px);
    }
    
    /* 调整栅格系统 - 产品布局 */
    .product-item {
        width: 25%;
        max-width: 25%;
    }
    
    /* 调整表格和卡片 */
    .table th, .table td {
        padding: 0.8rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    /* 优化点单页面布局 */
    .products-container {
        padding-right: 15px;
    }
    
    .order-container {
        padding-left: 15px;
    }
}

/* 超大屏桌面端 (1200px - 1399px) */
@media (min-width: 1200px) and (max-width: 1399px) {
    .sidebar {
        min-width: 240px;
        max-width: 240px;
    }
    
    #content.content-expanded {
        margin-left: -240px;
        width: calc(100% + 240px);
    }
    
    /* 点单页面商品项目布局优化 */
    .product-item {
        width: 20%;
        max-width: 20%;
    }
    
    /* 提高卡片高度 */
    .product-card {
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    
    /* 增大字体 */
    body {
        font-size: 1rem;
    }
    
    .card-title {
        font-size: 1.2rem;
    }
}

/* 超宽屏桌面端 (>=1400px) */
@media (min-width: 1400px) {
    .container-fluid {
        max-width: 1800px;
        margin: 0 auto;
    }
    
    .sidebar {
        min-width: 280px;
        max-width: 280px;
    }
    
    #content.content-expanded {
        margin-left: -280px;
        width: calc(100% + 280px);
    }
    
    /* 调整产品卡片布局 */
    .product-item {
        width: 16.666%;
        max-width: 16.666%;
    }
    
    /* 提高卡片高度和阴影效果 */
    .product-card {
        box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    }
    
    .product-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 12px 25px rgba(0,0,0,0.15);
    }
    
    /* 增大字体和间距 */
    body {
        font-size: 1.05rem;
    }
    
    .card-title {
        font-size: 1.25rem;
    }
    
    .table th, .table td {
        padding: 1.2rem;
    }
    
    /* 提高导航栏高度 */
    .top-navbar {
        height: 70px;
    }
    
    /* 调整内容区域上边距 */
    #content {
        padding-top: 70px;
    }
}

/* 超大屏幕产品布局优化 */
@media (min-width: 1200px) {
    .products-container {
        padding-right: 15px;
    }
    
    /* 超大屏幕显示更多列 */
    .product-item.col-xxl-2 {
        width: 16.666%;
        max-width: 16.666%;
    }
    
    /* 调整产品卡片间距 */
    .products-container .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .product-item {
        padding-left: 10px;
        padding-right: 10px;
        margin-bottom: 20px;
    }
}

/* 确保整个界面在任何窗口大小下都能完整显示 */
.container-fluid {
    width: 100%;
    overflow-x: hidden;
}

/* 优化表格响应式布局 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 购物车列表项优化 */
#orderItems tr td {
    vertical-align: middle;
    word-break: break-word;
}

/* 确保输入框不会溢出容器 */
.form-control {
    max-width: 100%;
}

/* 按钮文本省略 */
@media (max-width: 1000px) {
    .btn {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* 类别导航优化 */
.category-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 5px 0;
    flex-wrap: nowrap; /* 防止按钮换行 */
    margin-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
}

.category-scroll::-webkit-scrollbar {
    display: none;
}

.category-btn {
    white-space: nowrap;
    margin-right: 10px;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    flex-shrink: 0; /* 防止按钮压缩 */
}

/* 修复桌面端响应式问题 */
@media (min-width: 768px) {
    /* 优化搜索框 */
    #productSearch {
        max-width: 100%;
    }
    
    /* 优化商品排列 */
    .product-item {
        transition: all 0.3s ease;
    }
    
    /* 确保内容适应窗口大小 */
    .container-fluid {
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* 调整行间距 */
    .row.g-3 {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    /* 优化类别导航滚动 */
    .category-scroll {
        max-width: 100%;
        overflow-x: auto;
        padding-bottom: 10px;
    }
    
    /* 确保购物车正确显示 */
    .order-container {
        min-width: 300px; /* 购物车最小宽度 */
    }
    
    /* 确保商品列表自适应 */
    .products-container {
        width: auto;
        overflow-x: hidden;
    }
}

/* 中小屏幕优化 */
@media (min-width: 768px) and (max-width: 991px) {
    /* 调整列宽比例 */
    .col-md-8.products-container {
        width: 65%;
        flex: 0 0 65%;
    }
    
    .col-md-4.order-container {
        width: 35%;
        flex: 0 0 35%;
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* 减小购物车内边距 */
    .order-container .card-body {
        padding: 0.75rem;
    }
    
    /* 调整购物车中的表格 */
    .order-container table {
        font-size: 0.9rem;
    }
    
    .order-container table th,
    .order-container table td {
        padding: 0.5rem;
    }
}

/* 小屏幕桌面 */
@media (min-width: 992px) and (max-width: 1199px) {
    /* 调整产品卡片大小 */
    .product-item {
        width: 25%;
        max-width: 25%;
        padding: 0 10px;
    }
    
    /* 确保购物车显示正常 */
    .col-lg-4.order-container {
        padding-left: 10px;
    }
}

/* 特小屏幕桌面 */
@media (max-width: 1100px) {
    /* 调整商品布局 */
    .col-sm-4 {
        width: 50%;
        flex: 0 0 50%;
    }
    
    /* 减小商品卡片内边距 */
    .product-card .card-body {
        padding: 0.5rem;
    }
    
    /* 减小购物车表格内边距 */
    .order-container table th,
    .order-container table td {
        padding: 0.4rem 0.5rem;
    }
    
    /* 调整按钮大小 */
    .add-to-cart-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* 确保极小屏幕自适应 */
@media (max-width: 900px) {
    /* 调整列宽比例，确保更多空间给购物车 */
    .col-md-8.products-container {
        width: 60%;
        flex: 0 0 60%;
    }
    
    .col-md-4.order-container {
        width: 40%;
        flex: 0 0 40%;
    }
}

/* 优化数量控制器 */
.qty-control {
    max-width: 120px;
    margin: 0 auto;
}

.qty-control .form-control {
    text-align: center;
    padding-left: 2px;
    padding-right: 2px;
    min-width: 40px;
}

.qty-control .btn {
    padding: 0.25rem 0.5rem;
}

/* 表格样式优化 */
@media (max-width: 992px) {
    /* 调整表格字体和间距 */
    #orderItems {
        font-size: 0.85rem;
    }
    
    /* 减小表格列宽 */
    #orderItems th, #orderItems td {
        padding: 0.4rem 0.5rem;
    }
    
    /* 优化数量控制器 */
    .qty-control {
        max-width: 110px;
    }
    
    .qty-control .form-control {
        min-width: 30px;
        padding: 0.25rem;
    }
}

/* 超小屏幕优化 */
@media (max-width: 880px) {
    /* 减小底部订单控制区域的内边距 */
    .order-controls {
        padding: 0.75rem;
    }
    
    /* 缩小表头 */
    .table thead th {
        font-size: 0.8rem;
    }
    
    /* 优化订单列表滚动 */
    .order-list {
        max-height: calc(100vh - 300px);
    }
}

/* 调整订单容器最小宽度 */
@media (min-width: 768px) and (max-width: 992px) {
    .order-container {
        min-width: 280px;
    }
}

/* 在极窄屏幕上调整布局 */
@media (min-width: 768px) and (max-width: 850px) {
    /* 更改布局比例 */
    .col-md-8.col-lg-8.products-container {
        width: 55%;
        flex: 0 0 55%;
    }
    
    .col-md-4.col-lg-4.order-container {
        width: 45%;
        flex: 0 0 45%;
    }
    
    /* 缩小商品卡片 */
    .product-card .card-title {
        font-size: 0.9rem;
    }
    
    /* 确保表格完全响应 */
    .table-responsive {
        overflow-x: auto;
    }
}

/* 修复响应式布局，确保购物车始终在右侧 */
.flex-container {
    display: flex !important;
    flex-wrap: wrap;
}

.product-container {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.order-container {
    width: 350px;
    min-width: 350px;
    margin-left: 20px;
}

.product-item {
    padding: 8px;
    transition: all 0.3s ease;
}

/* 确保行内元素均匀分布 */
#productList {
    display: flex;
    flex-wrap: wrap;
    margin-right: -8px;
    margin-left: -8px;
    justify-content: space-evenly;
}

/* 响应式布局断点 - 根据实际屏幕宽度调整卡片数量 */
/* 默认情况：大屏幕 */
.product-item {
    width: 20%;
    max-width: 20%;
    flex: 0 0 20%;
}

/* 手动定义更多断点以实现平滑过渡 */
@media (max-width: 1400px) {
    .product-item {
        width: 25%;
        max-width: 25%;
        flex: 0 0 25%;
    }
}

@media (max-width: 1200px) {
    .product-item {
        width: 25%;
        max-width: 25%;
        flex: 0 0 25%;
    }
}

@media (max-width: 992px) {
    .product-item {
        width: 33.333%;
        max-width: 33.333%;
        flex: 0 0 33.333%;
    }
}

@media (max-width: 850px) {
    .product-item {
        width: 50%;
        max-width: 50%;
        flex: 0 0 50%;
    }
}

@media (max-width: 576px) {
    .product-item {
        width: 50%;
        max-width: 50%;
        flex: 0 0 50%;
    }
    
    .product-card .card-title {
        font-size: 0.85rem;
    }
}

/* 优化产品卡片样式，确保不变形 */
.product-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.product-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.75rem;
}

/* 调整卡片内内容的位置 */
.product-card .card-title {
    margin-bottom: 1.5rem;
}

/* 确保图片部分高度一致 */
.product-card .card-img-top, 
.product-card .bg-light {
    height: 120px;
    object-fit: cover;
}

/* 覆盖导致布局垂直排列的样式 */
@media (max-width: 992px) {
    .flex-container {
        flex-direction: row !important; /* 强制横向排列 */
    }
    
    .product-container {
        flex: 1;
        width: calc(100% - 370px) !important;
        max-width: calc(100% - 370px) !important;
    }
    
    .order-container {
        width: 350px !important;
        min-width: 350px !important;
        max-width: 350px !important;
    }
}

/* 超小屏幕上允许垂直排列 */
@media (max-width: 768px) {
    .flex-container {
        flex-direction: column-reverse !important;
    }
    
    .product-container, 
    .order-container {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-left: 0;
    }
    
    .order-container {
        margin-bottom: 1.5rem;
    }
}

/* 订单项表格样式 */
.qty-control {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 120px;
    margin: 0 auto;
}

.qty-control .btn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
}

.qty-control .form-control {
    width: 40px;
    text-align: center;
    padding: 0.25rem;
    font-weight: bold;
    border-width: 1px;
}

/* 调整表格样式 */
#orderItems td {
    vertical-align: middle;
    padding: 0.5rem 0.5rem;
}

/* 响应式调整 */
@media (max-width: 992px) {
    .qty-control {
        max-width: 100px;
    }
    
    .qty-control .btn {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    .qty-control .form-control {
        width: 35px;
        font-size: 0.9rem;
    }
    
    #orderItems td {
        padding: 0.4rem 0.4rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 880px) {
    .qty-control {
        max-width: 90px;
    }
    
    .qty-control .btn {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }
    
    .qty-control .form-control {
        width: 32px;
        font-size: 0.85rem;
    }
    
    #orderItems td {
        padding: 0.35rem 0.35rem;
        font-size: 0.9rem;
    }
    
    .order-container {
        min-width: 100%;
    }
}

@media (max-width: 768px) {
    .order-card {
        margin-bottom: 1rem;
    }
    
    #orderItems .form-control-sm {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .qty-control {
        max-width: 80px;
    }
    
    .qty-control .btn {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
    
    .qty-control .form-control {
        width: 30px;
        font-size: 0.8rem;
    }
    
    #orderItems td {
        padding: 0.3rem 0.3rem;
        font-size: 0.85rem;
    }
}

/* 确保在所有屏幕上有适当的内边距 */
.order-card .card-body {
    padding: 0.75rem;
}

@media (max-width: 992px) {
    .order-card .card-body {
        padding: 0.5rem;
    }
}

/* 购物车样式优化 */
.order-card {
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

.order-card .card-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.order-list {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 10px;
}

/* 确保移动端也有合适的高度 */
@media (max-width: 768px) {
    .order-card {
        height: auto;
        max-height: 400px;
        position: relative;
        top: 0;
    }
}

/* DeepseekAI流式输出样式 */
.ai-message.assistant p {
    white-space: pre-wrap;
    line-height: 1.5;
    animation: fadeIn 0.3s ease-in-out;
}

.ai-thinking {
    font-style: italic;
    color: #666;
    padding-left: 10px;
    border-left: 3px solid #4e73df;
    margin-top: 8px;
    background-color: rgba(78, 115, 223, 0.05);
    padding: 8px 12px;
    border-radius: 0 8px 8px 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 打字动画效果 */
.typing-cursor {
    display: inline-block;
    width: 6px;
    height: 15px;
    background-color: #333;
    animation: blink 0.7s infinite;
    margin-left: 2px;
    vertical-align: middle;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
} 