/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1890ff;
    --primary-dark: #096dd9;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --danger-color: #ff4d4f;
    --text-color: #333;
    --text-secondary: #666;
    --border-color: #d9d9d9;
    --bg-color: #f0f2f5;
    --white: #fff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
}

/* 首页样式 */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-header {
    text-align: center;
    color: var(--white);
    margin-bottom: 50px;
}

.login-header i {
    font-size: 60px;
    margin-bottom: 20px;
}

.login-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.login-header p {
    font-size: 16px;
    opacity: 0.9;
}

.role-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    max-width: 1100px;
    width: 100%;
}

.role-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.role-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.role-card.admin-card {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: var(--white);
}

.role-card.admin-card h3,
.role-card.admin-card p {
    color: var(--white);
}

.role-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.role-icon i {
    font-size: 36px;
    color: var(--primary-color);
}

.admin-card .role-icon {
    background: rgba(255, 255, 255, 0.2);
}

.admin-card .role-icon i {
    color: var(--white);
}

.role-card h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.role-card p {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer {
    margin-top: 60px;
    color: var(--white);
    opacity: 0.8;
}

/* 通用布局 */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: #001529;
    color: var(--white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 500;
}

.sidebar-header p {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 5px;
}

.sidebar-menu {
    padding: 10px 0;
}

.menu-item {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.menu-item.active {
    background: var(--primary-color);
    border-left-color: var(--white);
}

.menu-item i {
    width: 20px;
    margin-right: 12px;
}

.menu-item span {
    font-size: 14px;
}

.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 0;
}

.menu-group-title {
    padding: 10px 24px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 24px;
    background: var(--bg-color);
    min-height: 100vh;
}

/* 顶部导航 */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    padding: 16px 24px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.page-title {
    font-size: 20px;
    font-weight: 500;
}

.nav-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-success:hover {
    background: #389e0d;
}

.btn-warning {
    background: var(--warning-color);
    color: var(--white);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-outline {
    background: var(--white);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-back {
    background: transparent;
    color: var(--text-secondary);
}

.btn-back:hover {
    color: var(--primary-color);
}

/* 卡片样式 */
.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 500;
}

.card-body {
    padding: 24px;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--white);
}

.stat-icon.blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-icon.green { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.stat-icon.orange { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.stat-icon.purple { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }

.stat-info h4 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: #fafafa;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.data-table tr:hover {
    background: #fafafa;
}

.data-table td {
    font-size: 14px;
}

/* 状态标签 */
.status-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    display: inline-block;
}

.status-pending {
    background: #fff7e6;
    color: #fa8c16;
}

.status-approved {
    background: #f6ffed;
    color: #52c41a;
}

.status-rejected {
    background: #fff1f0;
    color: #ff4d4f;
}

.status-completed {
    background: #e6f7ff;
    color: #1890ff;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-bar input {
    flex: 1;
    min-width: 200px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 500;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 返回首页按钮 */
.back-home {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

/* Tab切换 */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab-item {
    padding: 12px 24px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
    color: var(--text-secondary);
}

.tab-item:hover {
    color: var(--primary-color);
}

.tab-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 盘点样式 */
.inventory-check-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.inventory-check-item:last-child {
    border-bottom: none;
}

.inventory-check-item .item-info {
    flex: 1;
}

.inventory-check-item .item-info h4 {
    margin-bottom: 4px;
}

.inventory-check-item .item-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.inventory-check-item .count-input {
    width: 120px;
    text-align: center;
}

.inventory-check-item .difference {
    width: 100px;
    text-align: center;
    font-weight: 500;
}

.difference.positive {
    color: var(--success-color);
}

.difference.negative {
    color: var(--danger-color);
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar-header h2,
    .sidebar-header p,
    .menu-item span,
    .menu-group-title {
        display: none;
    }
    
    .menu-item {
        padding: 14px;
        justify-content: center;
    }
    
    .menu-item i {
        margin-right: 0;
    }
    
    .main-content {
        margin-left: 60px;
    }
    
    .role-cards {
        grid-template-columns: 1fr;
    }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-color);
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 8px;
}

.action-buttons .btn {
    padding: 6px 12px;
    font-size: 12px;
}

/* 入库出库记录 */
.record-item {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.record-item:last-child {
    border-bottom: none;
}

.record-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
}

.record-icon.in {
    background: #f6ffed;
    color: var(--success-color);
}

.record-icon.out {
    background: #fff1f0;
    color: var(--danger-color);
}

.record-info {
    flex: 1;
}

.record-info h4 {
    font-size: 14px;
    margin-bottom: 4px;
}

.record-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.record-amount {
    font-weight: 500;
}

.record-amount.in {
    color: var(--success-color);
}

.record-amount.out {
    color: var(--danger-color);
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
}

.loading i {
    font-size: 32px;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* 通知提示 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    display: none;
}

.toast.show {
    display: block;
    animation: slideDown 0.3s ease;
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 管理员特殊样式 */
.admin-view .sidebar {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
}

.admin-badge {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 8px;
}