/* 家庭进销存 - 响应式样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 15px;
}

/* 头部 */
.header {
    text-align: center;
    padding: 20px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin: -15px -15px 20px -15px;
    border-radius: 0 0 20px 20px;
}

.header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.header .subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 导航 */
.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    justify-content: center;
}

.nav-item {
    padding: 8px 16px;
    background: white;
    border-radius: 20px;
    text-decoration: none;
    color: #666;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.nav-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.nav-item.active {
    background: #667eea;
    color: white;
}

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

.stat-card {
    background: white;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-card.warning {
    background: #fff3cd;
}

.stat-num {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: #667eea;
}

.stat-card.warning .stat-num {
    color: #e74c3c;
}

.stat-label {
    font-size: 0.8rem;
    color: #888;
}

/* 区块 */
.section {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.section h2 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* 预警 */
.warning-section {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.warning-list .warning-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.warning-item:last-child {
    border-bottom: none;
}

.warning-item .goods-name {
    font-weight: 500;
}

.warning-item .stock-info {
    color: #e74c3c;
    font-size: 0.9rem;
}

/* 表格 */
.stock-table {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 1fr 80px 80px;
    background: #f8f9fa;
    padding: 10px 15px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #666;
}

.table-row {
    display: grid;
    grid-template-columns: 1fr 80px 80px;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.table-row:last-child {
    border-bottom: none;
}

.table-row.clickable {
    cursor: pointer;
    transition: background 0.2s;
}

.table-row.clickable:hover {
    background: #f8f9fa;
}

.table-row .goods-name {
    display: flex;
    flex-direction: column;
}

.table-row .goods-name small {
    font-size: 0.75rem;
    color: #999;
}

.table-row .quantity {
    font-weight: 600;
    text-align: right;
}

.table-row .quantity.low {
    color: #e74c3c;
}

.table-row .location {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

/* 表单 */
.form {
    padding: 5px 0;
}

.form-row {
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #666;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd6;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.btn:hover {
    opacity: 0.9;
}

/* 列表 */
.goods-list,
.location-list {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.goods-item,
.location-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.goods-item:last-child,
.location-item:last-child {
    border-bottom: none;
}

.goods-info,
.location-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.goods-name,
.location-name {
    font-weight: 500;
}

.goods-meta,
.location-remark {
    font-size: 0.8rem;
    color: #888;
}

.goods-stock {
    margin-right: 10px;
    font-size: 0.9rem;
    color: #666;
}

.goods-stock.low {
    color: #e74c3c;
    font-weight: 600;
}

.goods-action,
.location-action {
    margin-left: 10px;
}

/* 记录列表 */
.records-list {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.record-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    gap: 5px;
}

.record-item:last-child {
    border-bottom: none;
}

.record-item .rec-goods {
    flex: 1;
    min-width: 100px;
}

.record-item .rec-qty {
    color: #27ae60;
    font-weight: 600;
    min-width: 60px;
}

.record-item .rec-location {
    color: #666;
    font-size: 0.9rem;
}

.record-item .rec-time {
    color: #999;
    font-size: 0.8rem;
}

/* 消息 */
.msg {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

.msg.success {
    background: #d4edda;
    color: #155724;
}

.msg.error {
    background: #f8d7da;
    color: #721c24;
}

/* 空状态 */
.empty {
    text-align: center;
    color: #999;
    padding: 30px;
}

/* 说明框 */
.info-box {
    background: #e7f3ff;
    border-left: 4px solid #2196F3;
}

.info-box p {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 20px 0;
    color: #999;
    font-size: 0.85rem;
}

/* 手机适配 */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header {
        margin: -10px -10px 15px -10px;
        padding: 15px 0;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .nav {
        gap: 5px;
    }
    
    .nav-item {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .stat-card {
        padding: 10px;
    }
    
    .stat-num {
        font-size: 1.4rem;
    }
    
    .section {
        padding: 12px;
    }
    
    .section h2 {
        font-size: 1rem;
    }
    
    .table-header,
    .table-row {
        grid-template-columns: 1fr 70px 60px;
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 8px 10px;
    }
    
    .goods-item,
    .location-item {
        flex-wrap: wrap;
    }
    
    .goods-action,
    .location-action {
        width: 100%;
        margin: 10px 0 0 0;
    }
    
    .btn-danger,
    .btn-sm {
        width: 100%;
    }
}
