/* style.css - 仓库管理系统主样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    padding: 10px;
    max-width: 100%;
    overflow-x: hidden;
}

/* 移动端优化 */
@media (max-width: 768px) {
    body {
        padding: 8px;
        font-size: 16px; /* 移动端基础字号稍大 */
    }
}

/* 通用容器 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 卡片式设计，用于信息块 */
.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaeaea;
}

/* 标题样式 */
h1, h2, h3, h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-weight: 600;
}
h1 { font-size: 1.8rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

/* 按钮基础样式 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.btn:active {
    transform: translateY(0);
}

/* 按钮颜色变体 */
.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}
.btn-success {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
}
.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}
.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}
.btn-secondary {
    background: #95a5a6;
    color: white;
}

/* 表单控件 */
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}
.form-control {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}
.form-control:focus {
    border-color: #3498db;
    outline: none;
}
/* 针对移动端，优化输入框避免放大 */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important; /* 防止iOS自动缩放 */
    }
}

/* 表格样式 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* 移动端平滑滚动 */
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}
tr:hover {
    background-color: #f9f9f9;
}

/* 导航与页头 */
.navbar {
    background: white;
    padding: 15px 20px;
    border-bottom: 1px solid #eaeaea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-radius: 0 0 12px 12px;
}
.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
    text-decoration: none;
}
.user-info {
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* 响应式网格 */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}
.col {
    flex: 1;
    padding: 0 10px;
    min-width: 250px; /* 确保在小屏幕上不会过窄 */
}

/* 工具类 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none; }

/* 扫描按钮特殊样式 */
.scan-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 18px;
    padding: 15px;
}
/* 自动补全样式 */
.autocomplete-results {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
    display: none;
}

.autocomplete-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.autocomplete-item:hover {
    background-color: #f5f9ff;
}

.autocomplete-item.selected {
    background-color: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.autocomplete-item .sku {
    font-weight: bold;
    color: #2196f3;
    font-size: 16px;
}

.autocomplete-item .name {
    color: #333;
    margin: 2px 0;
}

.autocomplete-item .spec {
    color: #666;
    font-size: 14px;
    margin: 2px 0;
}

.autocomplete-item .stock {
    color: #4caf50;
    font-size: 13px;
    font-weight: 500;
}

.autocomplete-no-results,
.autocomplete-error {
    padding: 15px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* 针对移动端优化 */
@media (max-width: 768px) {
    .autocomplete-results {
        max-height: 250px;
        font-size: 16px; /* 防止iOS自动缩放 */
    }
    
    .autocomplete-item {
        padding: 15px;
    }
}