/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #1a5fb4 0%, #2c80b9 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.update-time {
    font-size: 14px;
    opacity: 0.9;
}

.btn {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.btn-admin {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-admin:hover {
    background: rgba(255,255,255,0.3);
}

/* 标签切换 */
.tabs {
    display: flex;
    background: white;
    margin: 20px 0 0 0;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    /* 默认每行显示4个Tab，可通过 --tabs-per-row 覆盖（JS动态设置） */
    --tabs-per-row: 4;
}

.tab {
    flex: 1;
    padding: 18px 20px;
    cursor: pointer;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.tab:hover {
    background: #f8f9fa;
    color: #1a5fb4;
}

.tab.active {
    color: #1a5fb4;
    border-bottom-color: #1a5fb4;
    background: white;
}

.tab-icon {
    font-size: 20px;
}

.tab-count {
    background: #e74c3c;
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 5px;
}

/* 数据更新时间提示条 */
.data-timestamps {
    display: flex;
    justify-content: center;
    gap: 30px;
    background: linear-gradient(90deg, #f8f9fa 0%, #e8f4f8 50%, #f8f9fa 100%);
    padding: 12px 20px;
    border-top: 1px solid #e0e6ed;
    border-bottom: 1px solid #e0e6ed;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

/* 面板头部右侧区域 */
.panel-header .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* 数据时间标签 */
.data-time {
    font-size: 13px;
    color: #666;
    background: #f0f7ff;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #d0e4ff;
}

/* 内容面板 */
.content-panel {
    display: none;
    background: white;
    padding: 25px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.content-panel.active {
    display: block;
    flex: 1;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.panel-header h2 {
    font-size: 20px;
    color: #333;
    font-weight: 600;
}

/* 子标签 */
.sub-tabs {
    display: flex;
    gap: 10px;
}

.sub-tab {
    padding: 8px 20px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.sub-tab:hover {
    background: #f0f2f5;
}

.sub-tab.active {
    background: #1a5fb4;
    color: white;
    border-color: #1a5fb4;
}

.sub-content {
    display: none;
}

.sub-content.active {
    display: block;
}

/* 搜索框 */
.search-box {
    display: flex;
    gap: 10px;
}

.search-box input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 280px;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #1a5fb4;
}

.search-box button {
    padding: 10px 20px;
    background: #1a5fb4;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

.search-box button:hover {
    background: #154a8c;
}

/* 表格容器 */
.table-container {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid #e8e8e8;
}

/* 数据表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: #f5f7fa;
}

.data-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.data-table tbody tr:nth-child(even):hover {
    background: #f0f2f5;
}

.data-table td {
    vertical-align: top;
}

/* 产品名称样式 */
.product-name {
    font-weight: 600;
    color: #1a5fb4;
}

/* 库存状态 */
.stock-normal {
    color: #666;
    font-weight: 600;
}

.stock-low {
    color: #e74c3c;
    font-weight: 600;
}

.stock-high {
    color: #27ae60;
    font-weight: 600;
}

/* 保质期 */
.expiry-normal {
    color: #27ae60;
    font-weight: 600;
}

.expiry-warning {
    color: #e67e22;
    font-weight: 600;
}

.expiry-danger {
    color: #e74c3c;
    font-weight: 600;
}

.expiry-expired {
    color: #999;
    font-weight: 600;
    text-decoration: line-through;
}

/* 价格单元格样式 */
.price-cell {
    color: #d32f2f;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.price-cell-green {
    color: #2e7d32;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 50px;
    color: #999;
}

.empty-data {
    text-align: center;
    padding: 50px;
    color: #999;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 30px;
    color: #666;
    font-size: 14px;
    background: #f5f7fa;
    border-top: 1px solid #e0e6ed;
    margin-top: auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .tabs {
        flex-direction: row;
        flex-wrap: wrap;
        margin: 20px 0 0 0;
        --tabs-per-row: 2;
    }

    .tab {
        flex: 0 0 calc(100% / var(--tabs-per-row, 4) - 4px);
        min-width: 0;
        padding: 10px 6px;
        font-size: 13px;
        border-bottom: 3px solid transparent;
        border-left: none;
        justify-content: center;
        overflow: hidden;
        white-space: nowrap;
    }

    .tab .tab-text {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
    }
    
    .tab.active {
        border-bottom-color: #1a5fb4;
        border-left: none;
    }
    
    .tab-text {
        white-space: nowrap;
    }
    
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-box {
        width: 100%;
    }
    
    .search-box input {
        flex: 1;
        width: auto;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
    
    /* 招商地图移动端全屏 */
    #mapContent .panel-header {
        display: none;
    }
    #mapFrontIframe {
        height: calc(100vh - 120px) !important;
        min-height: 400px !important;
    }
    #mapContent > div:nth-child(2) {
        border: none !important;
        border-radius: 0 !important;
        min-height: 400px !important;
    }
}

/* 打印样式 */
@media print {
    .header-actions,
    .tabs,
    .search-box,
    .footer {
        display: none;
    }
    
    .content-panel {
        display: block !important;
        box-shadow: none;
    }
    
    .data-table {
        font-size: 12px;
    }
}
