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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 登录页面 */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    font-size: 64px;
    margin-bottom: 20px;
}

.login-box h2 {
    margin-bottom: 10px;
    color: #333;
}

.login-subtitle {
    color: #999;
    margin-bottom: 30px;
    font-size: 14px;
}

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

.input-icon {
    display: flex;
    align-items: center;
    background: #f5f7fa;
    border-radius: 8px;
    padding: 0 15px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.input-icon:focus-within {
    border-color: #667eea;
    background: white;
}

.input-icon span {
    font-size: 20px;
    margin-right: 10px;
}

.input-icon input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 0;
    font-size: 16px;
    outline: none;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

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

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.error-message {
    margin-top: 15px;
    padding: 12px;
    background: #fee;
    color: #c33;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.error-message.show {
    display: block;
}

/* 应用布局 */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .status-text {
    display: none;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.logo-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.3s;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-section {
    margin-bottom: 30px;
}

.nav-section-title {
    padding: 0 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    margin-bottom: 10px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
    cursor: pointer;
    white-space: nowrap;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.router-link-active {
    background: rgba(102, 126, 234, 0.3);
    color: white;
    border-left: 3px solid #667eea;
}

.nav-icon {
    font-size: 20px;
    margin-right: 12px;
    min-width: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-badge {
    background: #e74c3c;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    margin-left: 8px;
}

.nav-badge.badge-warning {
    background: #f39c12;
}

.nav-badge.badge-secondary {
    background: #95a5a6;
}

.nav-button {
    width: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

.status-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 260px;
    transition: margin-left 0.3s;
    display: flex;
    flex-direction: column;
}

.main-content.expanded {
    margin-left: 70px;
}

/* 顶部栏 */
.top-bar {
    background: white;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    font-size: 24px;
}

.user-name {
    font-weight: 500;
    color: #2c3e50;
}

/* 内容包装器 */
.content-wrapper {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.page-subtitle {
    font-size: 20px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.page-description {
    color: #7f8c8d;
    margin-bottom: 20px;
}

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-detail {
    font-size: 12px;
    color: #95a5a6;
}

.delay-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 5px;
    font-size: 11px;
}

.delay-badge.delay-warning {
    background: #fff3cd;
    color: #856404;
}

.delay-badge.delay-urgent {
    background: #ffe5d0;
    color: #d63384;
}

.delay-badge.delay-critical {
    background: #f8d7da;
    color: #842029;
}

/* 工具栏 */
.toolbar {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-box {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    min-width: 300px;
}

.search-icon {
    font-size: 20px;
}

.search-box input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

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

.btn-secondary:hover {
    background: #5568d3;
}

.btn-outline {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

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

.filter-box {
    display: flex;
    gap: 10px;
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: white;
    transition: border-color 0.3s;
}

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

/* 订单容器 */
.orders-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 订单卡片 */
.order-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    overflow: hidden;
}

.order-card:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.order-card.warehouse-available {
    border-left: 4px solid #2ecc71;
}

.order-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.3s;
}

.order-header:hover {
    background: #f8f9fa;
}

.order-info {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.order-info-item {
    display: flex;
    flex-direction: column;
}

.order-info-label {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.order-info-value {
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-delay-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.order-delay-badge.delay-warning {
    background: #fff3cd;
    color: #856404;
}

.order-delay-badge.delay-urgent {
    background: #ffe5d0;
    color: #d63384;
}

.order-delay-badge.delay-critical {
    background: #f8d7da;
    color: #842029;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.order-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.3s;
}

.btn-icon:hover {
    background: #f0f0f0;
}

.order-toggle {
    font-size: 12px;
    color: #7f8c8d;
    transition: transform 0.3s;
}

.order-toggle.open {
    transform: rotate(180deg);
}

/* 订单详情 */
.order-products {
    padding: 0 20px 20px;
    border-top: 1px solid #f0f0f0;
}

.shipping-info {
    margin: 20px 0;
}

.shipping-info h4 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    gap: 8px;
}

.info-label {
    color: #7f8c8d;
    font-size: 14px;
}

.info-value {
    color: #2c3e50;
    font-size: 14px;
    font-weight: 500;
}

.products-list {
    margin-top: 20px;
}

.products-list h4 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.product-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}

.product-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.product-info {
    flex: 1;
}

.product-name {
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 5px;
}

.product-spec {
    font-size: 12px;
    color: #7f8c8d;
}

.product-quantity {
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    min-width: 50px;
    text-align: center;
}

.product-price {
    font-size: 14px;
    font-weight: 600;
    color: #e74c3c;
    min-width: 80px;
    text-align: right;
}

.product-stock {
    min-width: 100px;
}

.stock-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.stock-badge.in-stock {
    background: #d4edda;
    color: #155724;
}

.stock-badge.low-stock {
    background: #fff3cd;
    color: #856404;
}

.stock-badge.out-of-stock {
    background: #f8d7da;
    color: #842029;
}

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pagination button {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 14px;
    color: #7f8c8d;
}

/* 加载状态 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    margin-top: 20px;
    color: #7f8c8d;
    font-size: 14px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.empty-state p {
    font-size: 16px;
}

/* 上传框 */
.upload-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.upload-box input[type="file"] {
    display: none;
}

/* 消息框 */
.message-box {
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 14px;
}

.message-box.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-box.error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    
    .sidebar .logo-text,
    .sidebar .nav-text,
    .sidebar .nav-section-title,
    .sidebar .nav-badge,
    .sidebar .status-text {
        display: none;
    }
    
    .main-content {
        margin-left: 70px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        min-width: 100%;
    }
    
    .order-info {
        grid-template-columns: 1fr;
    }
    
    .product-item {
        flex-wrap: wrap;
    }
}

/* 缺货统计页面特殊样式 */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.summary-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
    border-left: 4px solid #667eea;
}

.summary-card.warning {
    border-left-color: #f39c12;
    background: linear-gradient(135deg, #fff3cd 0%, #ffffff 100%);
}

.summary-card.info {
    border-left-color: #2ecc71;
    background: linear-gradient(135deg, #d4edda 0%, #ffffff 100%);
}

.summary-label {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.summary-value {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
}

.order-urgent {
    border-left: 4px solid #f39c12 !important;
    background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%) !important;
}

.urgent-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #f39c12;
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
    animation: pulse-urgent 2s infinite;
}

@keyframes pulse-urgent {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.05);
        opacity: 0.9;
    }
}

.text-warning {
    color: #f39c12 !important;
    font-weight: 700 !important;
}
