/* 全局样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    background-color: #f5f5f5;
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
header {
    background-color: #333;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.data-source {
    font-size: 0.8rem;
    color: #ccc;
    margin-left: 1rem;
    font-weight: normal;
}

.tab-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
}

.tab-btn:hover {
    background-color: #45a049;
}

/* 分栏容器 */
.split-container {
    max-width: 1400px;
    margin: 0.5rem auto;
    padding: 0 1rem;
    display: flex;
    gap: 1rem;
    width: 100%;
    height: calc(100vh - 100px);
    align-items: stretch;
}

/* 左侧面板 */
.left-panel {
    flex: 1;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 6px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* 右侧容器 */
.right-container {
    width: auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 星期标签容器 */
.week-tabs-container {
    padding: 5px 0.5rem;
    border-bottom: 1px solid #eee;
    background-color: #fafafa;
    overflow-x: auto;
    min-width: 0;
}

/* 右侧标题 */
.right-header {
    padding: 5px 1rem;
    border-bottom: 1px solid #eee;
    background-color: #f9f9f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.right-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.right-header h2 {
    font-size: 1.2rem;
    margin: 0;
    color: #333;
    font-weight: 600;
}

/* 保存按钮样式 */
.save-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.save-btn:hover {
    background-color: #45a049;
}

.save-btn:active {
    background-color: #3d8b40;
}

.export-btn {
    background-color: #2f6fbe;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.export-btn:hover {
    background-color: #2a63aa;
}

.export-btn:active {
    background-color: #255895;
}

.export-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.export-modal-content {
    width: min(720px, 92vw);
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.export-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #e6e6e6;
}

.export-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #222;
    font-weight: 600;
}

.export-modal-close {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 22px;
    cursor: pointer;
    color: #999;
}

.export-modal-close:hover {
    color: #666;
}

.export-modal-body {
    padding: 14px 16px;
}

#exportText {
    width: 100%;
    height: 240px;
    resize: none;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.6;
    color: #333;
    outline: none;
}

.export-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px 16px;
}

.copy-export-btn {
    background-color: #4CAF50;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.copy-export-btn:hover {
    background-color: #45a049;
}

.close-export-btn {
    background-color: #f3f3f3;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.close-export-btn:hover {
    background-color: #e9e9e9;
}

/* 星期标签容器 */
.week-tabs-container {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    background-color: #fafafa;
    overflow-x: auto;
}

/* 星期标签栏 */
.week-tabs {
    display: flex;
    gap: 0.1rem;
    min-width: max-content;
    white-space: nowrap;
}

/* 星期标签样式 */
.week-tab {
    padding: 0.1rem 0.15rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    color: #666;
    width: 35px;
    height: 60px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    line-height: 1.1;
    writing-mode: vertical-rl;
    text-orientation: upright;
    overflow: hidden;
}

/* 隐藏滚动条 */
.week-tabs-container::-webkit-scrollbar {
    height: 6px;
}

.week-tabs-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.week-tabs-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.week-tabs-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.week-tab:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

.week-tab.active {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.week-tab.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f9f9f9;
    color: #999;
}

/* 分类容器样式 */
.categories-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* 分类区块样式 */
.category-section {
    margin-bottom: 0.1rem; /* 最小化分类区块之间的间距 */
    border: 1px solid #eee;
    border-radius: 4px;
    background-color: #fafafa;
    overflow: hidden;
}

/* 分类标题样式 */
.category-title {
    padding: 0.2rem 0.5rem; /* 最小化分类标题的内边距 */
    background-color: #f0f0f0;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #ddd;
    font-size: 0.9rem;
    line-height: 1.2;
    margin: 0;
}

/* 分类内容容器样式 */
.category-items {
    padding: 0.2rem 0.5rem; /* 最小化分类内容的内边距 */
    min-height: 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem; /* 最小化分类项之间的间距 */
    background-color: white;
    margin: 0;
}

/* 分类菜品项样式 */
.category-item {
    padding: 0.3rem 0.6rem;
    background-color: #e8f5e8;
    border: 1px solid #c8e6c9;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #2e7d32;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    width: 100%;
}

.category-item:hover {
    background-color: #c8e6c9;
    border-color: #a5d6a7;
}

/* 菜品名称样式 */
.dish-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.5rem;
}

/* 菜品项操作按钮容器 */
.item-actions {
    display: flex;
    gap: 0.2rem;
    align-items: center;
}

/* 菜品行悬停效果 */
.menu-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-table tbody tr:hover {
    background-color: #e8f5e8;
}

/* 已选择菜品样式 */
.menu-table tbody tr.selected {
    background-color: #c8e6c9;
    border-left: 3px solid #4caf50;
}

/* 菜品项操作按钮样式 */
.category-item .remove-btn,
.category-item .up-btn,
.category-item .down-btn {
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    font-weight: 600;
}

.category-item .up-btn,
.category-item .down-btn {
    display: none;
}

.category-item .remove-btn {
    background-color: #ffcdd2;
    color: #c62828;
    border-color: #ffcdd2;
}

.category-item .remove-btn:hover {
    background-color: #ef9a9a;
    color: #b71c1c;
    border-color: #ef9a9a;
}

.category-item .up-btn,
.category-item .down-btn {
    background-color: #bbdefb;
    color: #1565c0;
    border-color: #bbdefb;
}

.category-item .up-btn:hover,
.category-item .down-btn:hover {
    background-color: #90caf9;
    color: #0d47a1;
    border-color: #90caf9;
}

.category-item .up-btn:disabled,
.category-item .down-btn:disabled {
    background-color: #e0e0e0;
    color: #9e9e9e;
    border-color: #e0e0e0;
    cursor: not-allowed;
}

.week-tab.disabled:hover {
    background-color: #f9f9f9;
    border-color: #ddd;
}

/* 列表头部 */
.list-header {
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
}

/* 隐藏空的h2标签带来的空白 */
.list-header h2 {
    font-size: 1.2rem;
    margin: 0;
    padding: 0;
    height: 0;
    visibility: hidden;
    overflow: hidden;
}

/* 标签容器 - 带滚动箭头 */
.tabs-container {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    position: relative;
    height: 40px;
    overflow: hidden;
}

/* 滚动按钮样式 */
.tab-scroll-btn {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    width: 30px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
    color: #666;
}

.tab-scroll-btn:hover {
    background: #f5f5f5;
    border-color: #999;
    color: #333;
}

.tab-scroll-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9f9f9;
}

/* 标签栏 - 横向滚动 */
.tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 0 10px;
    scroll-behavior: smooth;
    flex: 1;
    white-space: nowrap;
    /* 隐藏滚动条 */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* 隐藏滚动条 - Chrome, Safari */
.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 8px 16px;
    background: #f0f0f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
}

.tab.active {
    background: #4CAF50;
    color: white;
}

.tab:hover {
    background: #e0e0e0;
}

.tab.active:hover {
    background: #45a049;
}

/* 搜索栏 */
.search-bar {
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.search-input-group input {
    flex: 1;
    padding: 0.4rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    height: 32px;
}

.search-input-group button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-input-group button:hover {
    background-color: #45a049;
}

/* 列表和分页容器 */
.list-pagination-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: auto;
    min-height: 0;
    overflow: hidden;
    border: 1px solid #eee;
    border-radius: 8px;
}

/* 表格样式 */
.menu-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    position: relative;
    display: block;
    flex: 1;
    overflow-y: auto;
    border: none;
    table-layout: fixed;
}

/* 固定表头 */
.menu-table thead {
    position: sticky;
    top: 0;
    background-color: #f9f9f9;
    z-index: 10;
}

/* 表格行和单元格设置为块级，支持滚动 */
.menu-table thead,
.menu-table tbody {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.menu-table th,
.menu-table td {
    padding: 0.35rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
    height: 40px;
    vertical-align: middle;
}

.menu-table th {
    background-color: #f9f9fa;
    font-weight: 600;
    color: #333;
    padding: 0.5rem 0.75rem;
    height: 44px;
    vertical-align: middle;
    font-size: 0.9rem;
}

/* 设置列宽 */
.menu-table th:nth-child(1),
.menu-table td:nth-child(1) {
    width: 80px;
    text-align: center;
    padding: 0.35rem 0.25rem;
}

.menu-table th:nth-child(2),
.menu-table td:nth-child(2) {
    /* 菜名：自动宽度，占据剩余空间 */
    width: auto;
    min-width: 200px;
    max-width: 250px;
    padding: 0.35rem 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-table th:nth-child(3),
.menu-table td:nth-child(3) {
    width: 100px;
    text-align: center;
    padding: 0.35rem 0.25rem;
}

.menu-table th:nth-child(4),
.menu-table td:nth-child(4) {
    width: 100px;
    text-align: center;
    padding: 0.35rem 0.25rem;
}

.menu-table th:nth-child(5),
.menu-table td:nth-child(5) {
    width: 80px;
    text-align: center;
    padding: 0.35rem 0.25rem;
}

/* 操作按钮样式 */
.action-btn {
    padding: 0.2rem 0.5rem;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    margin: 0 0.1rem;
    width: 30px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background-color: #45a049;
}

.action-btn.remove-btn {
    background-color: #f44336;
}

.action-btn.remove-btn:hover {
    background-color: #da190b;
}

.action-btn.up-btn,
.action-btn.down-btn {
    background-color: #2196F3;
    padding: 0.2rem;
    width: 24px;
}

.action-btn.up-btn:hover,
.action-btn.down-btn:hover {
    background-color: #0b7dda;
}

.menu-table tr:hover {
    background-color: #f5f5f5;
}

/* 排序相关样式 */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.sortable:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.sort-arrow {
    margin-left: 5px;
    font-size: 12px;
    vertical-align: middle;
    display: inline-block;
    width: 10px;
    text-align: center;
}

/* 双向箭头 */
.sort-arrow.both::after {
    content: "↕";
}

/* 向上箭头 */
.sort-arrow.up::after {
    content: "↑";
    color: #2196F3;
}

/* 向下箭头 */
.sort-arrow.down::after {
    content: "↓";
    color: #2196F3;
}

/* 分页样式 */
.pagination {
    margin-top: 1rem;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pagination button {
    padding: 6px 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button:hover {
    background: #e0e0e0;
}

.pagination button:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.pagination button.active {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.pagination span {
    color: #666;
}

.pagination select {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.pagination select:hover {
    border-color: #999;
}

/* 状态提示 */
#status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem;
    border-radius: 4px;
    z-index: 1000;
    display: none;
}

#status.error {
    background-color: #f44336;
    color: white;
}

#status.success {
    background-color: #4CAF50;
    color: white;
}

#status.info {
    background-color: #2196F3;
    color: white;
}

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
