/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* 响应式容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 头部导航 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.logo h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.nav {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.nav-link:hover {
    background: rgba(255,255,255,0.2);
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* 主内容区 */
.main-content {
    min-height: calc(100vh - 60px - 60px);
    padding: 20px 0;
}

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

/* 登录/注册页面 */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 60px - 100px);
}

.auth-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background: white;
}

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

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102,126,234,0.4);
}

.btn-secondary {
    background: #e8e8e8;
    color: #666;
}

.btn-secondary:hover {
    background: #ddd;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

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

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

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* 仪表盘布局 */
.dashboard {
    display: flex;
    gap: 20px;
}

.sidebar {
    width: 200px;
    flex-shrink: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 80px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.3s;
    color: #555;
    font-size: 0.9rem;
}

.sidebar-nav a:hover {
    background: #f5f7fa;
    color: #667eea;
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.dashboard-main {
    flex: 1;
    min-width: 0;
}

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-header h2 {
    font-size: 1.4rem;
    color: #333;
}

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

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

.stat-card h3 {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-card p {
    color: #666;
    font-size: 0.9rem;
}

/* 表格样式 */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

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

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
    text-transform: uppercase;
}

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

.data-table .empty {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-confirmed {
    background: #d4edda;
    color: #155724;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.status-completed {
    background: #cce5ff;
    color: #004085;
}

.status-stored {
    background: #d4edda;
    color: #155724;
}

.status-approved {
    background: #d4edda;
    color: #155724;
}

.status-rejected {
    background: #f8d7da;
    color: #721c24;
}

.status-retrieved {
    background: #e2e3e5;
    color: #383d41;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.filter-bar label {
    color: #666;
    font-size: 0.9rem;
}

.filter-bar select,
.filter-bar input {
    padding: 8px 12px;
    border: 2px solid #e8e8e8;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
}

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

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

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 1.2rem;
    color: #333;
}

.close {
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #eee;
}

/* 库房卡片 */
.warehouse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.warehouse-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.warehouse-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.warehouse-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
}

.warehouse-header h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.warehouse-header .code {
    font-size: 0.85rem;
    opacity: 0.9;
}

.warehouse-body {
    padding: 20px;
}

.shelf-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shelf-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.shelf-info {
    flex: 1;
}

.shelf-number {
    font-weight: 600;
    color: #333;
}

.shelf-status {
    font-size: 0.8rem;
    color: #666;
    margin-top: 3px;
}

.shelf-item .btn {
    padding: 8px 16px;
}

/* 警告提示 */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.warning-message {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 帮助样式 */
.helper-text {
    font-size: 0.8rem;
    color: #999;
    margin-top: 5px;
}

.view-all {
    color: #667eea;
    font-size: 0.9rem;
}

.view-all:hover {
    text-decoration: underline;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h3 {
    font-size: 1.1rem;
    color: #333;
}

.recent-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 20px;
    margin-bottom: 20px;
}

/* 管理员统计 */
.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}

.stat-item .label {
    color: #666;
}

.stat-item .value {
    font-weight: 600;
    color: #333;
}

/* 物品详情 */
.item-info {
    background: #f5f7fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.item-info p {
    margin: 5px 0;
}

.item-info strong {
    display: inline-block;
    width: 80px;
    color: #666;
}

/* 标签页 */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 20px;
    background: #e8e8e8;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* 响应式设计 - 平板 */
@media (max-width: 768px) {
    .dashboard {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s;
        border-radius: 0;
        padding: 60px 20px 20px;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .header .nav {
        display: none;
    }
    
    .dashboard-main {
        width: 100%;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .warehouse-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-bar select,
    .filter-bar input {
        width: 100%;
    }
}

/* 响应式设计 - 手机 */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .auth-card {
        padding: 25px 20px;
        margin: 15px;
    }
    
    .auth-card h2 {
        font-size: 1.3rem;
    }
    
    .header .container {
        height: 50px;
    }
    
    .logo h1 {
        font-size: 1rem;
    }
    
    .main-content {
        padding: 15px 0;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-header h2 {
        font-size: 1.2rem;
    }
    
    .page-header .btn {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card h3 {
        font-size: 1.5rem;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 600px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px;
        font-size: 0.8rem;
    }
    
    .modal-content {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .modal {
        padding: 0;
    }
    
    .modal-header {
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
    
    .btn-small {
        padding: 4px 10px;
        font-size: 0.75rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 16px; /* 防止iOS自动缩放 */
    }
    
    .form-group label {
        font-size: 0.85rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .filter-bar {
        padding: 12px;
    }
    
    .warehouse-header,
    .warehouse-body {
        padding: 15px;
    }
    
    .shelf-item {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .shelf-item .btn {
        width: 100%;
    }
    
    .recent-section {
        padding: 15px;
    }
    
    .tabs {
        gap: 8px;
    }
    
    .tab {
        padding: 8px 15px;
        font-size: 0.85rem;
    }
}

/* 平板 - 表格优化 */
@media (min-width: 481px) and (max-width: 768px) {
    .data-table {
        min-width: 500px;
    }
}

/* 触摸设备优化 */
@media (hover: none) {
    .btn:hover,
    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-success:hover,
    .btn-danger:hover {
        transform: none;
        box-shadow: none;
    }
    
    .warehouse-card:hover {
        transform: none;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    }
    
    .sidebar-nav a:hover {
        background: transparent;
        color: #555;
    }
}

/* 横屏优化 */
@media (orientation: landscape) and (max-height: 500px) {
    .auth-container {
        min-height: auto;
        padding: 20px 0;
    }
    
    .auth-card {
        padding: 20px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
}
