* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    font-size: 14px; /* 减小基础字体大小 */
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px; /* 减小内边距 */
}

header {
    text-align: center;
    margin-bottom: 25px; /* 减小下边距 */
}

header h1 {
    color: white;
    font-size: 2rem; /* 从2.5rem减小到2rem */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px; /* 减小间距 */
    margin-bottom: 25px;
}

.form-section {
    background: white;
    border-radius: 12px; /* 减小圆角 */
    padding: 20px; /* 减小内边距 */
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    height: fit-content;
}

.form-section h2 {
    color: #4a5568;
    margin-bottom: 15px; /* 减小下边距 */
    font-size: 1.3rem; /* 从1.5rem减小到1.3rem */
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px; /* 减小下内边距 */
}

.form-group {
    margin-bottom: 15px; /* 减小下边距 */
}

.form-group label {
    display: block;
    margin-bottom: 6px; /* 减小下边距 */
    font-weight: 600;
    color: #4a5568;
    font-size: 13px; /* 减小标签字体大小 */
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px; /* 减小内边距 */
    border: 2px solid #e2e8f0;
    border-radius: 6px; /* 减小圆角 */
    font-size: 14px; /* 从16px减小到14px */
    transition: border-color 0.3s ease;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    padding: 10px 20px; /* 减小内边距 */
    border: none;
    border-radius: 6px; /* 减小圆角 */
    font-size: 14px; /* 从16px减小到14px */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #718096;
    color: white;
    padding: 6px 12px; /* 减小内边距 */
    font-size: 12px; /* 从14px减小到12px */
    margin: 4px; /* 减小外边距 */
}

.btn-secondary:hover {
    background: #4a5568;
    transform: translateY(-1px);
}

.btn-danger {
    background: #e53e3e;
    color: white;
    padding: 4px 8px; /* 从5px 10px减小到4px 8px */
    font-size: 11px; /* 从12px减小到11px */
}

.btn-danger:hover {
    background: #c53030;
}

.btn-edit {
    background: #3182ce;
    color: white;
    padding: 4px 8px; /* 从5px 10px减小到4px 8px */
    font-size: 11px; /* 从12px减小到11px */
    margin-right: 3px; /* 从4px减小到3px */
}

.btn-edit:hover {
    background: #2c5aa0;
}

/* 加减号按钮样式 */
.btn-quantity {
    background: #38a169;
    color: white;
    padding: 4px 8px; /* 从6px 10px减小到4px 8px */
    font-size: 12px; /* 从14px减小到12px */
    font-weight: bold;
    border-radius: 50%;
    width: 26px; /* 从30px减小到26px */
    height: 26px; /* 从30px减小到26px */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 2px;
    transition: all 0.3s ease;
}

.btn-quantity:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(56, 161, 105, 0.3);
}

.btn-quantity.minus {
    background: #e53e3e;
}

.btn-quantity.minus:hover {
    box-shadow: 0 3px 8px rgba(229, 62, 62, 0.3);
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 6px; /* 从8px减小到6px */
}

.quantity-display {
    font-weight: 600;
    min-width: 30px; /* 从35px减小到30px */
    text-align: center;
    font-size: 12px; /* 从13px减小到12px */
}

/* 数据管理样式 */
.data-management {
    margin-top: 25px; /* 减小上边距 */
    padding-top: 15px; /* 减小上内边距 */
    border-top: 2px solid #e2e8f0;
}

.data-management h3 {
    color: #4a5568;
    margin-bottom: 12px; /* 减小下边距 */
    font-size: 1.1rem; /* 从1.2rem减小到1.1rem */
}

.data-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px; /* 减小间距 */
}

.data-buttons .btn {
    text-align: center;
}

/* 历史记录样式 */
.history-section {
    margin-top: 25px; /* 减小上边距 */
    padding-top: 15px; /* 减小上内边距 */
    border-top: 2px solid #e2e8f0;
}

.history-section h3 {
    color: #4a5568;
    margin-bottom: 12px; /* 减小下边距 */
    font-size: 1.1rem; /* 从1.2rem减小到1.1rem */
}

.history-list {
    max-height: 180px; /* 减小最大高度 */
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px; /* 减小圆角 */
    background: #f7fafc;
}

.history-item {
    padding: 8px 12px; /* 减小内边距 */
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px; /* 从14px减小到12px */
    color: #4a5568;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item .time {
    color: #718096;
    font-size: 11px; /* 从12px减小到11px */
    margin-top: 2px; /* 减小上边距 */
}

.history-item .action {
    font-weight: 600;
    color: #2d3748;
}

.history-item .details {
    margin-top: 2px;
    color: #4a5568;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* 减小最小宽度 */
    gap: 15px; /* 减小间距 */
}

.stat-card {
    text-align: center;
    padding: 15px; /* 减小内边距 */
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 8px; /* 减小圆角 */
    border: 1px solid #e2e8f0;
}

.stat-card h3 {
    font-size: 0.85rem; /* 从0.9rem减小到0.85rem */
    color: #718096;
    margin-bottom: 8px; /* 减小下边距 */
}

.stat-card p {
    font-size: 1.8rem; /* 从2rem减小到1.8rem */
    font-weight: bold;
    color: #4a5568;
}

.list-section {
    background: white;
    border-radius: 12px; /* 减小圆角 */
    padding: 20px; /* 减小内边距 */
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.list-section h2 {
    color: #4a5568;
    margin-bottom: 15px; /* 减小下边距 */
    font-size: 1.3rem; /* 从1.5rem减小到1.3rem */
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px; /* 减小下内边距 */
}

.list-controls {
    display: flex;
    gap: 12px; /* 减小间距 */
    margin-bottom: 15px; /* 减小下边距 */
    flex-wrap: wrap;
}

.search-input, .filter-select {
    padding: 8px 12px; /* 减小内边距 */
    border: 2px solid #e2e8f0;
    border-radius: 6px; /* 减小圆角 */
    font-size: 14px; /* 从16px减小到14px */
    flex: 1;
    min-width: 180px; /* 减小最小宽度 */
}

.search-input:focus, .filter-select:focus {
    outline: none;
    border-color: #667eea;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px; /* 减小上边距 */
}

th, td {
    padding: 10px; /* 从12px减小到10px */
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px; /* 添加表格字体大小 */
}

th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
    font-size: 12px; /* 表头字体稍小 */
}

tr:hover {
    background: #f7fafc;
}

.low-stock {
    color: #e53e3e;
    font-weight: bold;
}

.quantity-cell {
    font-weight: 600;
}

/* 统计信息全宽样式 */
.stats-section-full {
    background: white;
    border-radius: 12px; /* 减小圆角 */
    padding: 20px; /* 减小内边距 */
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    margin-bottom: 25px; /* 减小下边距 */
}

.stats-section-full h2 {
    color: #4a5568;
    margin-bottom: 15px; /* 减小下边距 */
    font-size: 1.3rem; /* 从1.5rem减小到1.3rem */
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px; /* 减小下内边距 */
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); /* 减小最小宽度 */
    }
}

@media (max-width: 768px) {
    body {
        font-size: 13px; /* 手机端进一步减小基础字体 */
    }
    
    .container {
        padding: 10px; /* 手机端减小内边距 */
    }
    
    header h1 {
        font-size: 1.6rem; /* 从2rem减小到1.6rem */
    }
    
    .form-section, .list-section, .stats-section-full {
        padding: 15px; /* 手机端减小内边距 */
    }
    
    .form-section h2, .list-section h2, .stats-section-full h2 {
        font-size: 1.2rem; /* 手机端减小标题字体 */
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px; /* 减小间距 */
    }
    
    .stat-card {
        padding: 12px; /* 减小内边距 */
    }
    
    .stat-card h3 {
        font-size: 0.8rem; /* 减小统计卡片标题字体 */
    }
    
    .stat-card p {
        font-size: 1.5rem; /* 减小统计数字字体 */
    }
    
    .list-controls {
        flex-direction: column;
        gap: 8px; /* 减小间距 */
    }
    
    .search-input, .filter-select {
        min-width: auto;
        font-size: 13px; /* 减小输入框字体 */
    }
    
    th, td {
        padding: 8px; /* 手机端减小表格内边距 */
        font-size: 12px; /* 手机端减小表格字体 */
    }
    
    th {
        font-size: 11px; /* 手机端减小表头字体 */
    }
    
    .quantity-controls {
        flex-direction: column;
        gap: 3px; /* 从4px减小到3px */
    }
    
    .btn-quantity {
        width: 24px; /* 从28px减小到24px */
        height: 24px; /* 从28px减小到24px */
        font-size: 11px; /* 从12px减小到11px */
        padding: 3px 6px; /* 进一步减小内边距 */
    }
    
    .quantity-display {
        min-width: 25px; /* 手机端减小最小宽度 */
        font-size: 11px; /* 手机端减小字体 */
    }
    
    .btn-edit, .btn-danger {
        padding: 3px 6px; /* 手机端减小内边距 */
        font-size: 10px; /* 手机端减小字体 */
        margin-right: 2px; /* 减小右边距 */
    }
    
    .data-buttons {
        flex-direction: column;
        gap: 5px; /* 减小间距 */
    }
    
    .data-buttons .btn {
        min-width: auto;
        font-size: 11px; /* 手机端减小按钮字体 */
        padding: 5px 10px;
    }
    
    .history-item {
        font-size: 11px; /* 手机端减小历史记录字体 */
        padding: 6px 10px;
    }
    
    .history-item .time {
        font-size: 10px; /* 手机端减小时间字体 */
    }
    
    .form-group label {
        font-size: 12px; /* 手机端减小标签字体 */
    }
    
    .form-group input, .form-group select {
        font-size: 13px; /* 手机端减小输入框字体 */
        padding: 8px; /* 减小内边距 */
    }
    
    .btn {
        font-size: 13px; /* 手机端减小按钮字体 */
        padding: 8px 16px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-section, .list-section, .stats-section-full {
    animation: fadeIn 0.6s ease-out;
} 