/* 矿区仓库管理系统 - 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f5f7fa;
    color: #303133;
    font-size: 14px;
    line-height: 1.5;
}

/* 顶部导航 */
.navbar {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar .logo {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.navbar .logo-icon {
    font-size: 22px;
}

.navbar .nav-menu {
    display: flex;
    gap: 2px;
    list-style: none;
}

.navbar .nav-menu a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.25s;
    white-space: nowrap;
}

.navbar .nav-menu a:hover,
.navbar .nav-menu a.active {
    background: rgba(255,255,255,0.18);
    color: white;
}

/* 主内容区 */
.main-container {
    margin-top: 56px;
    padding: 16px 20px;
    min-height: calc(100vh - 56px);
}

/* 页面标题 */
.page-header {
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e3c72;
}

/* 日期筛选栏 */
.date-filter-bar {
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-item label {
    font-size: 13px;
    color: #606266;
    white-space: nowrap;
}

.filter-item input[type="date"],
.filter-item input[type="month"],
.filter-item select,
.filter-item input[type="text"] {
    padding: 6px 10px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.25s;
    background: white;
}

.filter-item input[type="date"]:focus,
.filter-item input[type="month"]:focus,
.filter-item select:focus,
.filter-item input[type="text"]:focus {
    border-color: #2a5298;
}

/* 按钮 */
.btn {
    padding: 7px 16px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.25s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(42, 82, 152, 0.25);
}

.btn-success {
    background: #52c41a;
    color: white;
}

.btn-success:hover {
    background: #73d13d;
}

.btn-danger {
    background: #f56c6c;
    color: white;
}

.btn-danger:hover {
    background: #f78989;
}

.btn-default {
    background: white;
    color: #606266;
    border: 1px solid #dcdfe6;
}

.btn-default:hover {
    border-color: #2a5298;
    color: #2a5298;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* 统计卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.stat-card {
    background: white;
    padding: 16px 18px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-card .stat-label {
    font-size: 13px;
    color: #909399;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #1e3c72;
    line-height: 1.2;
}

.stat-card .stat-unit {
    font-size: 13px;
    color: #909399;
    margin-left: 3px;
    font-weight: normal;
}

.stat-card.inbound::before {
    background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%);
}

.stat-card.inbound .stat-value {
    color: #52c41a;
}

.stat-card.outbound::before {
    background: linear-gradient(135deg, #f56c6c 0%, #f78989 100%);
}

.stat-card.outbound .stat-value {
    color: #f56c6c;
}

/* 图表区域 */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.chart-card {
    background: white;
    padding: 16px 18px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.chart-title {
    font-size: 15px;
    font-weight: 600;
    color: #303133;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ebeef5;
}

.chart-container {
    height: 280px;
}

/* 表格 */
.table-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow: hidden;
}

.table-header {
    padding: 12px 16px;
    border-bottom: 1px solid #ebeef5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 15px;
    font-weight: 600;
    color: #303133;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #fafafa;
    padding: 10px 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #606266;
    border-bottom: 2px solid #ebeef5;
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 1px solid #f2f6fc;
    color: #303133;
}

.data-table tbody tr:hover {
    background: #f5f7fa;
}

.data-table .amount {
    font-weight: 600;
    color: #f56c6c;
}

.data-table .amount.in {
    color: #52c41a;
}

/* 积压物资行样式 */
.data-table tbody tr.overstock-row {
    background: #fff7e6;
}

.data-table tbody tr.overstock-row:hover {
    background: #ffefb3;
}

/* 表格容器 - 支持横向滚动 */
.table-card > div:not(.table-header) {
    overflow-x: auto;
}

/* 表格滚动容器 */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 部门标签 */
.dept-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    background: #ecf5ff;
    color: #409eff;
    font-weight: 500;
}

/* 弹窗表单 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    border-radius: 8px;
    width: 520px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid #ebeef5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #303133;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #909399;
    line-height: 1;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f5f7fa;
    color: #606266;
}

.modal-body {
    padding: 18px;
}

.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid #ebeef5;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: white;
}

/* 表单 */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #303133;
    font-weight: 500;
}

.form-group label .required {
    color: #f56c6c;
    margin-right: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.25s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #2a5298;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #909399;
}

.empty-state .empty-icon {
    font-size: 42px;
    margin-bottom: 8px;
    opacity: 0.6;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 70px;
    right: 20px;
    padding: 10px 18px;
    border-radius: 4px;
    color: white;
    font-size: 13px;
    z-index: 3000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast.success {
    background: #52c41a;
}

.toast.error {
    background: #f56c6c;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========== 日期分组样式 ========== */
.date-group {
    margin-bottom: 12px;
    border: 1px solid #e4e7ed;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.date-group-header {
    padding: 12px 18px;
    background: linear-gradient(135deg, #f5f7fa 0%, #ebeef5 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s;
    user-select: none;
    position: relative;
}

.date-group-header:hover {
    background: linear-gradient(135deg, #ebeef5 0%, #e4e7ed 100%);
}

.date-group-header:active {
    background: #e4e7ed;
}

.date-group-title {
    font-size: 15px;
    font-weight: 600;
    color: #303133;
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-group-title .date-icon {
    font-size: 18px;
}

.date-group-summary {
    display: flex;
    gap: 24px;
    font-size: 13px;
    color: #606266;
    flex: 1;
    justify-content: center;
}

.date-group-summary .summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-group-summary .summary-value {
    font-weight: 600;
    color: #303133;
}

.date-group-summary .summary-value.amount {
    color: #f56c6c;
}

.date-group-toggle {
    font-size: 14px;
    color: #909399;
    transition: transform 0.3s ease;
    font-weight: bold;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: rgba(255,255,255,0.5);
}

.date-group.collapsed .date-group-toggle {
    transform: rotate(-90deg);
}

.date-group.collapsed .date-group-body {
    display: none;
}

.date-group-body {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.date-group-body .data-table {
    border-radius: 0;
}

.date-group-body .data-table th {
    border-top: none;
}

/* ========== 物资名称输入框组样式 ========== */
.material-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.material-input-group input,
.material-input-group select {
    flex: 1;
    min-width: 0;
}

/* ========== 扫码功能样式 ========== */
.scan-btn {
    padding: 6px 12px;
    background: #409eff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    vertical-align: middle;
    white-space: nowrap;
    font-weight: 500;
    transition: all 0.25s;
}

.scan-btn:hover {
    background: #66b1ff;
}

.qrcode-btn {
    padding: 4px 10px;
    background: #52c41a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    font-weight: 500;
    transition: all 0.25s;
}

.qrcode-btn:hover {
    background: #73d13d;
}

#qr-reader {
    border: 2px solid #ebeef5;
    border-radius: 8px;
    overflow: hidden;
}

#qr-reader video {
    width: 100% !important;
    height: auto !important;
    border-radius: 6px;
}

#qr-reader__dashboard_section {
    padding: 10px;
}

/* 二维码显示区域 */
#qrcode-display {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#qrcode-display canvas {
    display: block;
}

/* ========== 响应式设计 ========== */

/* 大屏幕：>1200px - 默认样式 */

/* 中等屏幕：992px - 1200px */
@media (max-width: 1200px) {
    .stats-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .charts-row {
        grid-template-columns: 1fr;
    }
}

/* 平板：768px - 992px */
@media (max-width: 992px) {
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .navbar .logo {
        font-size: 16px;
    }
    
    .navbar .nav-menu a {
        padding: 7px 10px;
        font-size: 13px;
    }
}

/* 手机：< 768px */
@media (max-width: 768px) {
    .main-container {
        padding: 12px;
    }
    
    .navbar {
        padding: 0 12px;
        height: 52px;
    }
    
    .navbar .logo {
        font-size: 15px;
        gap: 6px;
    }
    
    .navbar .logo-icon {
        font-size: 18px;
    }
    
    .navbar .nav-menu {
        gap: 0;
    }
    
    .navbar .nav-menu a {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .main-container {
        margin-top: 52px;
    }
    
    .page-header {
        margin-bottom: 12px;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .date-filter-bar {
        padding: 10px 12px;
        margin-bottom: 12px;
        gap: 10px;
    }
    
    .filter-item {
        flex: 1 1 100%;
    }
    
    .filter-item label {
        min-width: 60px;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 12px;
    }
    
    .stat-card {
        padding: 12px 14px;
    }
    
    .stat-card .stat-value {
        font-size: 22px;
    }
    
    .charts-row {
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .chart-card {
        padding: 12px 14px;
    }
    
    .chart-container {
        height: 240px;
    }
    
    .table-header {
        padding: 10px 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .modal {
        width: 100%;
        margin: 10px;
    }
    
    .modal-body {
        padding: 14px;
    }
    
    /* 物资名称输入框组移动端优化 */
    .material-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .material-input-group .scan-btn {
        margin-left: 0;
        margin-top: 0;
        width: 100%;
    }
    
    .scan-btn {
        margin-left: 0;
        margin-top: 8px;
        display: block;
        width: 100%;
    }
    
    #qr-reader {
        max-width: 100%;
    }
    
    /* 日期分组移动端优化 */
    .date-group-header {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .date-group-summary {
        gap: 12px;
        font-size: 12px;
        width: 100%;
    }
    
    .toast {
        top: 60px;
        right: 12px;
        left: 12px;
        text-align: center;
    }
}

/* 小屏幕手机：< 480px */
@media (max-width: 480px) {
    .navbar .nav-menu a {
        padding: 5px 6px;
        font-size: 11px;
    }
    
    .navbar .logo span:not(.logo-icon) {
        display: none;
    }
    
    .navbar .logo {
        font-size: 20px;
    }
}
