/* 医械职才平台 - 管理后台样式 */

/* ============ Reset & Base ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: #333; background: #f5f6fa; line-height: 1.6;
}
a { color: #3498db; text-decoration: none; }
a:hover { color: #2980b9; }
table { border-collapse: collapse; width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ============ Login Page ============ */
.login-wrapper {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
}
.login-card {
    background: #fff; border-radius: 8px; padding: 40px; width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.login-card h1 {
    text-align: center; margin-bottom: 8px; font-size: 24px; color: #2c3e50;
}
.login-card .subtitle {
    text-align: center; color: #999; margin-bottom: 30px; font-size: 14px;
}
.login-card .form-group { margin-bottom: 20px; }
.login-card label { display: block; margin-bottom: 6px; font-weight: 500; color: #555; }
.login-card input[type="text"],
.login-card input[type="password"] {
    width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 4px;
    font-size: 14px; transition: border-color 0.2s;
}
.login-card input:focus { outline: none; border-color: #3498db; box-shadow: 0 0 0 3px rgba(52,152,219,0.1); }
.login-card .btn-login {
    width: 100%; padding: 12px; background: #3498db; color: #fff; border: none;
    border-radius: 4px; font-size: 16px; cursor: pointer; transition: background 0.2s;
}
.login-card .btn-login:hover { background: #2980b9; }
.login-card .btn-login:disabled { background: #95a5a6; cursor: not-allowed; }
.login-card .error-msg { color: #e74c3c; font-size: 13px; margin-top: 10px; text-align: center; }

/* ============ Layout ============ */
.admin-layout {
    display: flex; min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px; background: #2c3e50; color: #ecf0f1;
    display: flex; flex-direction: column; position: fixed;
    top: 0; left: 0; bottom: 0; z-index: 100;
}
.sidebar-logo {
    padding: 20px; text-align: center; font-size: 20px; font-weight: 700;
    color: #fff; border-bottom: 1px solid rgba(255,255,255,0.1);
    letter-spacing: 2px;
}
.nav-item {
    display: flex; align-items: center; padding: 12px 20px;
    color: #bdc3c7; transition: all 0.2s; cursor: pointer;
    border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active {
    background: rgba(52,152,219,0.2); color: #fff;
    border-left-color: #3498db;
}
.nav-icon { margin-right: 10px; font-size: 16px; }
.nav-label { font-size: 14px; }

/* Main content */
.main-area {
    margin-left: 220px; flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}

/* Top bar */
.topbar {
    height: 56px; background: #fff; border-bottom: 1px solid #e8e8e8;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.topbar-left { font-size: 18px; font-weight: 600; color: #2c3e50; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user { color: #555; font-weight: 500; }
.topbar-role {
    background: #ecf0f1; color: #7f8c8d; padding: 2px 10px;
    border-radius: 12px; font-size: 12px;
}
.btn-logout {
    padding: 6px 16px; background: #fff; border: 1px solid #ddd;
    border-radius: 4px; cursor: pointer; color: #666; font-size: 13px;
    transition: all 0.2s;
}
.btn-logout:hover { border-color: #e74c3c; color: #e74c3c; }

/* Page content */
.page-content {
    padding: 24px; flex: 1;
}

/* ============ Cards ============ */
.stat-cards {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px;
}
.stat-card {
    background: #fff; border-radius: 8px; padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.stat-card .stat-label { font-size: 13px; color: #999; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: #2c3e50; }
.stat-card .stat-icon { font-size: 28px; float: right; opacity: 0.6; }

/* ============ Tables ============ */
.data-card {
    background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 20px; margin-bottom: 20px;
}
.data-card .card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.data-card .card-title { font-size: 16px; font-weight: 600; color: #2c3e50; }

table {
    border-collapse: collapse; width: 100%;
}
table thead th {
    background: #f8f9fa; padding: 10px 12px; text-align: left;
    font-weight: 600; color: #555; border-bottom: 2px solid #e8e8e8;
    font-size: 13px; white-space: nowrap;
}
table tbody td {
    padding: 10px 12px; border-bottom: 1px solid #f0f0f0;
    font-size: 13px; vertical-align: middle;
}
table tbody tr:hover { background: #f8fafc; }
table tbody tr:nth-child(even) { background: #fafbfc; }
table tbody tr:nth-child(even):hover { background: #f0f4f8; }

/* ============ Buttons ============ */
.btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 14px; border: none; border-radius: 4px;
    font-size: 13px; cursor: pointer; transition: all 0.2s;
    line-height: 1.4;
}
.btn-primary { background: #3498db; color: #fff; }
.btn-primary:hover { background: #2980b9; }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-warning { background: #f39c12; color: #fff; }
.btn-warning:hover { background: #d68910; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-default { background: #fff; color: #555; border: 1px solid #ddd; }
.btn-default:hover { border-color: #3498db; color: #3498db; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ============ Forms ============ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; margin-bottom: 6px; font-weight: 500;
    color: #555; font-size: 13px;
}
.form-group label .required { color: #e74c3c; margin-left: 2px; }
.form-control {
    width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px;
    font-size: 14px; transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: #3498db; box-shadow: 0 0 0 3px rgba(52,152,219,0.1); }
.form-control.error { border-color: #e74c3c; }
.form-hint { font-size: 12px; color: #999; margin-top: 4px; }
.form-error { font-size: 12px; color: #e74c3c; margin-top: 4px; }
select.form-control { height: 36px; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* Checkbox group */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 12px; }
.checkbox-group label {
    display: flex; align-items: center; gap: 4px;
    font-weight: normal; cursor: pointer;
}
.checkbox-group input[type="checkbox"] { margin: 0; }

/* Inline form */
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }

/* ============ Filters / Toolbar ============ */
.toolbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.filters {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.filters select, .filters input {
    padding: 7px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px;
}
.filters select:focus, .filters input:focus { outline: none; border-color: #3498db; }

/* ============ Modal ============ */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.modal {
    background: #fff; border-radius: 8px; width: 560px; max-width: 90vw;
    max-height: 85vh; display: flex; flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-header {
    padding: 16px 20px; border-bottom: 1px solid #eee;
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 16px; color: #2c3e50; }
.modal-close {
    background: none; border: none; font-size: 20px; cursor: pointer;
    color: #999; padding: 0; line-height: 1;
}
.modal-close:hover { color: #333; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 16px 20px; border-top: 1px solid #eee;
    display: flex; justify-content: flex-end; gap: 10px;
    flex-shrink: 0;
}

/* ============ Pagination ============ */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 4px; margin-top: 16px; padding: 10px 0;
}
.page-btn {
    padding: 6px 12px; border: 1px solid #ddd; border-radius: 4px;
    background: #fff; cursor: pointer; font-size: 13px; color: #555;
    transition: all 0.2s;
}
.page-btn:hover:not(:disabled) { border-color: #3498db; color: #3498db; }
.page-btn.active { background: #3498db; color: #fff; border-color: #3498db; }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.page-ellipsis { padding: 6px 8px; color: #999; }

/* ============ Status Tags ============ */
.tag {
    display: inline-block; padding: 2px 10px; border-radius: 12px;
    font-size: 12px; font-weight: 500;
}
.tag-pending { background: #fef3e2; color: #e67e22; }
.tag-processing { background: #e8f4fd; color: #3498db; }
.tag-shipped { background: #e8f8f5; color: #27ae60; }
.tag-completed { background: #eafaf1; color: #27ae60; }
.tag-rejected { background: #fdecea; color: #e74c3c; }
.tag-info { background: #e8f4fd; color: #3498db; }
.tag-success { background: #eafaf1; color: #27ae60; }
.tag-warning { background: #fef3e2; color: #e67e22; }
.tag-danger { background: #fdecea; color: #e74c3c; }

/* ============ Empty / Error State ============ */
.empty-state {
    text-align: center; padding: 60px 20px; color: #999;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.error-state {
    text-align: center; padding: 40px 20px; color: #e74c3c;
}

/* ============ Loading ============ */
.loading {
    text-align: center; padding: 40px; color: #999;
}
.loading::after {
    content: ''; display: inline-block; width: 24px; height: 24px;
    border: 3px solid #ddd; border-top-color: #3498db;
    border-radius: 50%; animation: spin 0.6s linear infinite;
    margin-left: 8px; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Badge ============ */
.badge {
    display: inline-block; padding: 1px 6px; border-radius: 10px;
    font-size: 11px; font-weight: 600; background: #e74c3c; color: #fff;
    margin-left: 4px;
}

/* ============ Detail View ============ */
.detail-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
.detail-item { }
.detail-item .detail-label { font-size: 12px; color: #999; margin-bottom: 4px; }
.detail-item .detail-value { font-size: 14px; color: #333; }

/* ============ Responsive (basic) ============ */
@media (max-width: 1280px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-logo { font-size: 14px; padding: 15px 5px; }
    .nav-label { display: none; }
    .nav-item { justify-content: center; padding: 12px; }
    .nav-icon { margin-right: 0; }
    .main-area { margin-left: 60px; }
    .stat-cards { grid-template-columns: 1fr; }
}

/* ============ File upload ============ */
.file-upload-area {
    border: 2px dashed #ddd; border-radius: 8px; padding: 30px;
    text-align: center; cursor: pointer; transition: border-color 0.2s;
    color: #999;
}
.file-upload-area:hover { border-color: #3498db; color: #3498db; }
.file-upload-area input[type="file"] { display: none; }

/* ============ Tabs ============ */
.tabs {
    display: flex; border-bottom: 2px solid #eee; margin-bottom: 20px;
}
.tab-item {
    padding: 10px 20px; cursor: pointer; color: #999; font-size: 14px;
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s;
}
.tab-item:hover { color: #555; }
.tab-item.active { color: #3498db; border-bottom-color: #3498db; font-weight: 500; }

/* ============ 通知铃铛 ============ */
.notif-bell {
    position: relative;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    user-select: none;
}
.notif-badge {
    position: absolute;
    top: -4px;
    right: 0;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    text-align: center;
    line-height: 18px;
    padding: 0 4px;
    font-weight: bold;
}
.notif-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 480px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    z-index: 1000;
}
.notif-dropdown.show { display: block; }
.notif-empty {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}
.notif-item {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
}
.notif-item:hover { background: #f7f7f7; }
.notif-item.read { opacity: 0.6; }
.notif-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: 13px; color: #333; margin-bottom: 2px; }
.notif-content { font-size: 12px; color: #666; line-height: 1.4; word-break: break-all; }
.notif-time { font-size: 11px; color: #aaa; margin-top: 4px; }
.notif-footer {
    padding: 10px;
    text-align: center;
    color: #1890ff;
    font-size: 13px;
    cursor: pointer;
    border-top: 1px solid #f0f0f0;
}
.notif-footer:hover { background: #f7f7f7; }
