:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #f3f4f6;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* 顶部栏 */
.top-bar {
    background: var(--white);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.logo i {
    font-size: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* 主导航 */
.main-nav {
    display: flex;
    background: var(--white);
    padding: 0.5rem;
    gap: 0.5rem;
    overflow-x: auto;
    box-shadow: var(--shadow);
    position: sticky;
    top: 70px;
    z-index: 99;
}

.nav-btn {
    flex: 1;
    min-width: 100px;
    padding: 1rem 0.75rem;
    border: none;
    background: var(--bg);
    color: var(--text-light);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
}

.nav-btn i {
    font-size: 1.5rem;
}

.nav-btn:active {
    transform: scale(0.95);
}

.nav-btn.active {
    background: var(--primary);
    color: var(--white);
}

/* 内容区域 */
.content-area {
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* 快速操作按钮 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.quick-action-card {
    background: var(--white);
    padding: 2.5rem 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    border: 3px solid transparent;
}

.quick-action-card:active {
    transform: scale(0.98);
}

.quick-action-card.in {
    border-color: var(--success);
}

.quick-action-card.out {
    border-color: var(--danger);
}

.quick-action-card i {
    font-size: 3.5rem;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-action-card.in i {
    background: linear-gradient(135deg, var(--success), #059669);
}

.quick-action-card.out i {
    background: linear-gradient(135deg, var(--danger), #dc2626);
}

.quick-action-card h3 {
    font-size: 1.5rem;
    color: var(--text);
}

/* 卡片 */
.card {
    background: var(--white);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

/* 按钮 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

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

.btn-secondary {
    background: var(--white);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-secondary:active {
    transform: scale(0.95);
    background: #d1d5db;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1.25rem 2rem;
    font-size: 1.25rem;
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-light);
    transition: all 0.2s;
}

.btn-icon:active {
    transform: scale(0.9);
}

/* 表单 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-size: 1rem;
}

.form-input, .form-select {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1.125rem;
    transition: all 0.2s;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* 日期输入框 */
input[type="date"] {
    min-width: 0;
}

input[type="date"]::-webkit-datetime-edit {
    padding: 0;
}

input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    padding: 0;
    margin: 0;
}

/* 数字输入框 - 放大 */
input[type="number"] {
    font-size: 1.5rem;
    text-align: center;
}

/* 表格 */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text);
}

tr:hover {
    background: var(--bg);
}

/* 库存状态标签 */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-normal {
    background: #d1fae5;
    color: #065f46;
}

.status-low {
    background: #fed7aa;
    color: #92400e;
}

.status-empty {
    background: #fee2e2;
    color: #991b1b;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--white);
    border-radius: 1rem;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-body {
    padding: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

/* 扫码输入框（隐藏） */
.scanner-input {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

/* 搜索框 */
.search-box {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-box input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1.125rem;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.25rem;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.stat-label {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
}

/* 数量调整器 */
.quantity-adjuster {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
}

.quantity-adjuster button {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quantity-adjuster button:active {
    transform: scale(0.9);
}

.quantity-adjuster input {
    width: 5rem;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem;
}

/* 响应式 */
@media (max-width: 768px) {
    .content-area {
        padding: 1rem;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
}

/* 库存列表项 */
.inventory-item {
    background: var(--white);
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.inventory-item:active {
    transform: scale(0.98);
}

.inventory-info h4 {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.inventory-info p {
    color: var(--text-light);
    font-size: 0.875rem;
}

.inventory-quantity {
    text-align: right;
}

.inventory-quantity .quantity {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.inventory-quantity .unit {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* 建议容器样式 */
.suggestions-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.suggestion-item:hover {
    background: var(--bg);
}

.bearing-card:hover {
    border-color: var(--primary) !important;
}

.bearing-card.selected {
    border-color: var(--primary) !important;
    background: var(--bg) !important;
}
