/* ============================================
   食品标签送检系统 - 全局样式
   ============================================ */

:root {
    --sidebar-width: 250px;
    --sidebar-collapsed: 0px;
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --danger-color: #e74a3b;
    --warning-color: #f6c23e;
    --info-color: #36b9cc;
    --dark-color: #5a5c69;
    --sidebar-bg: #2c3e50;
    --sidebar-admin-bg: #1a252f;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: #f4f6f9;
    font-size: 14px;
    margin: 0;
    padding: 0;
}

/* Wrapper */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: all 0.3s;
}

.sidebar-admin {
    background: var(--sidebar-admin-bg);
}

.sidebar-header {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h5 {
    margin: 0;
    font-size: 1.1rem;
    color: #fff;
}

.sidebar-user {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.avatar-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.avatar-admin {
    background: var(--info-color);
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover,
.sidebar-nav li.active a {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-left-color: var(--primary-color);
}

.sidebar-nav li a i {
    margin-right: 10px;
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.sidebar-badge {
    margin-left: auto;
    background: var(--danger-color);
    color: #fff;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.7rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: all 0.3s;
    min-width: 0;
}

/* Top Navbar */
.top-navbar {
    padding: 0.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.sidebar-toggle {
    color: inherit;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
}

.badge-pill {
    position: absolute;
    top: 2px;
    right: 0;
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 50%;
}

/* Content Wrapper */
.content-wrapper {
    min-height: calc(100vh - 60px);
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0 15px rgba(0,0,0,0.05);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e3e6f0;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* Stat Cards */
.stat-card {
    border-left: 4px solid;
    border-radius: 8px;
}

.stat-card.primary { border-left-color: var(--primary-color); }
.stat-card.success { border-left-color: var(--success-color); }
.stat-card.warning { border-left-color: var(--warning-color); }
.stat-card.danger { border-left-color: var(--danger-color); }
.stat-card.info { border-left-color: var(--info-color); }

.stat-card .stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--secondary-color);
    text-transform: uppercase;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table th {
    background: #f8f9fc;
    font-weight: 600;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

/* Status badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Forms */
.form-label {
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

/* Buttons */
.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: #2e59d7;
    border-color: #2e59d7;
}

/* Alert popup for dashboard */
.alert-popup {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    min-width: 320px;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Login page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-header {
    text-align: center;
    padding: 2rem 2rem 1rem;
}

.login-header h3 {
    margin: 0;
    color: var(--primary-color);
}

/* Rush order highlight */
.rush-order {
    background: #fff3cd;
    border-left: 3px solid var(--warning-color);
}

/* File upload area */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

/* Pagination */
.pagination .page-link {
    color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============================================
   响应式适配
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .stat-card .stat-number {
        font-size: 1.4rem;
    }

    .content-wrapper {
        padding: 0.75rem !important;
    }

    .card-body {
        padding: 0.75rem;
    }

    .table {
        font-size: 0.85rem;
    }

    .alert-popup {
        left: 10px;
        right: 10px;
        min-width: auto;
    }

    /* 移动端表单全宽 */
    .form-row-mobile .col {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* 移动端隐藏部分文字 */
    .hide-mobile {
        display: none !important;
    }

    /* 移动端表格滚动 */
    .table-responsive {
        font-size: 0.85rem;
    }

    /* 移动端按钮组 */
    .btn-group-mobile .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .login-card {
        margin: 1rem;
    }

    .sidebar-header h5 {
        font-size: 0.95rem;
    }

    .dropdown-menu {
        position: fixed;
        left: 10px;
        right: 10px;
        width: auto !important;
    }
}

/* Print */
@media print {
    .sidebar, .top-navbar, .sidebar-toggle {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
}

/* Scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

/* Toast notification */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}
