/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft Yahei", Arial, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    /* 防止body被弹窗滚动带动 */
    overflow: auto;
}

/* 容器样式 */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.admin-header {
    padding: 15px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #e6e6e6;
}

.admin-header h1 {
    font-size: 24px;
    color: #2f4050;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 标签切换样式 */
.tab-nav {
    display: flex;
    background-color: #fff;
    border-radius: 4px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.tab-item {
    padding: 12px 24px;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-item.active {
    color: #1ab394;
    border-bottom-color: #1ab394;
    font-weight: 600;
}

.tab-item:hover {
    color: #1ab394;
}

/* 操作栏样式 */
.operate-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.search-box {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.add-btn {
    background-color: #1ab394;
    color: #fff;
}

.add-btn:hover {
    background-color: #18a689;
}

.search-btn {
    background-color: #666;
    color: #fff;
}

.search-btn:hover {
    background-color: #555;
}

.cancel-btn {
    background-color: #eee;
    color: #666;
}

.cancel-btn:hover {
    background-color: #ddd;
}

.confirm-btn {
    background-color: #1ab394;
    color: #fff;
}

.confirm-btn:hover {
    background-color: #18a689;
}

/* 表格样式 */
.table-container {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e6e6e6;
}

.data-table th {
    background-color: #f8f8f8;
    font-weight: 600;
    color: #666;
}

.data-table tr:hover {
    background-color: #f9f9f9;
}

.data-table td img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

/* 操作按钮样式 */
.operate-btn {
    display: flex;
    gap: 8px;
}

.edit-btn {
    color: #1c84c6;
    cursor: pointer;
}

.delete-btn {
    color: #ed5565;
    cursor: pointer;
}

/* 弹窗样式 - 彻底修复版 */
.modal-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh; /* 强制占满视口高度 */
    background-color: rgba(0,0,0,0.5);
    display: none;
    z-index: 1000;
    overflow: hidden;
}

/* 核心修复：先设为none，显示时再改flex，避免布局冲突 */
.modal-container {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    top: 5vh; /* 顶部留5%间距，避免贴顶 */
    width: 900px; /* 进一步加宽，减少纵向压力 */
    max-width: 95vw;
    max-height: 90vh; /* 严格限制高度 */
    background-color: #fff;
    border-radius: 6px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: none; /* 初始隐藏，JS显示时改为flex */
    z-index: 1001;
    flex-direction: column; /* 纵向布局 */
}

/* 弹窗显示时的样式（JS控制添加此类） */
.modal-container.show {
    display: flex;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e6e6e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* 固定不收缩 */
    height: 60px; /* 固定高度 */
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #666;
    background-color: #f5f5f5;
    border-radius: 50%;
}

/* 核心：内容区强制滚动 */
.modal-body {
    padding: 20px;
    flex: 1; /* 占满剩余空间 */
    overflow-y: auto !important; /* 强制滚动 */
    height: calc(100% - 120px); /* 减去头部+底部高度 */
    min-height: 0; /* 修复Flex布局下min-height冲突 */
    /* 优化滚动体验 */
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #1ab394 #f5f5f5;
}

/* 全浏览器滚动条美化 */
.modal-body::-webkit-scrollbar {
    width: 8px;
}
.modal-body::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: #1ab394;
    border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
    background: #18a689;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e6e6e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0; /* 固定不收缩 */
    height: 60px; /* 固定高度 */
    background-color: #fafafa;
}

/* 表单样式优化 */
.form-item {
    margin-bottom: 12px; /* 减少间距 */
    display: flex;
    flex-direction: column;
}

.form-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-input, .form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    font-size: 14px;
    height: 40px; /* 固定高度 */
}

/* 进一步缩小textarea高度 */
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    font-size: 14px;
    min-height: 50px !important; /* 最小高度 */
    max-height: 150px; /* 限制最大高度 */
    resize: vertical;
    line-height: 1.4;
}

/* 聚焦样式优化 */
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #1ab394;
    box-shadow: 0 0 0 2px rgba(26, 179, 148, 0.1);
}

/* 隐藏面板 */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* 状态标签样式 */
.status-tag {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.status-enabled {
    background-color: #e8f5e9;
    color: #4caf50;
}

.status-disabled {
    background-color: #ffebee;
    color: #f44336;
}

/* 适配小屏幕 */
@media (max-width: 768px) {
    .modal-container {
        width: 95vw;
        top: 2vh;
        max-height: 96vh;
    }
    .modal-body {
        padding: 15px;
    }
    .form-textarea {
        min-height: 40px !important;
    }
}

/* 适配超小屏幕 */
@media (max-width: 480px) {
    .modal-header {
        padding: 10px 15px;
        height: 50px;
    }
    .modal-footer {
        padding: 10px 15px;
        height: 50px;
    }
    .modal-body {
        height: calc(100% - 100px);
    }
}