/* ============================================================
   眼镜店后台管理系统 - 统一样式表
   主色调：深科技蓝 | 纯文字界面 | 双端响应式
   ============================================================ */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif; color: #1a1a1a; background: #f2f4f8; line-height: 1.6; min-height: 100vh; }
a { color: #1a5a8a; text-decoration: none; }
a:hover { color: #0d3b5e; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; outline: none; }

/* --- Page --- */
.page { display: none; }
.page.active { display: flex; }

/* ========== 登录页 ========== */
#login-page { min-height: 100vh; align-items: center; justify-content: center; background: linear-gradient(135deg, #0a2540 0%, #103558 40%, #0d2b4e 100%); padding: 20px; }
.login-container { width: 100%; max-width: 400px; background: #fff; border-radius: 6px; padding: 40px 36px; box-shadow: 0 8px 32px rgba(0,0,0,0.25); }
.login-header { text-align: center; margin-bottom: 32px; }
.login-header h1 { font-size: 1.5rem; font-weight: 700; color: #0d2b4e; letter-spacing: 1px; }
.login-header p { font-size: 0.8rem; color: #888; margin-top: 6px; text-transform: uppercase; letter-spacing: 2px; }
.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: block; font-size: 0.85rem; font-weight: 600; color: #444; margin-bottom: 5px; }
.login-form input[type="text"],
.login-form input[type="password"] { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #d0d5dd; border-radius: 4px; color: #1a1a1a; background: #f9fafb; font-size: 0.95rem; transition: border-color 0.15s; }
.login-form input:focus { border-color: #2563a0; background: #fff; }
.form-error { color: #c0392b; font-size: 0.8rem; min-height: 20px; margin-bottom: 8px; }
.login-footer { text-align: center; margin-top: 24px; font-size: 0.75rem; color: #bbb; display: flex; justify-content: space-between; }

/* ========== 顶部导航 ========== */
.topbar { background: #0d2b4e; color: #fff; height: 50px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; position: fixed; top: 0; left: 0; right: 0; z-index: 100; font-size: 0.9rem; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 1rem; font-weight: 700; letter-spacing: 1px; }
.menu-toggle { cursor: pointer; font-size: 0.85rem; font-weight: 600; padding: 4px 10px; border: 1px solid rgba(255,255,255,0.3); border-radius: 3px; }
.menu-toggle:hover { background: rgba(255,255,255,0.1); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-store { font-size: 0.8rem; opacity: 0.85; }
.topbar-user { font-size: 0.85rem; }
.topbar-link { color: #c5d5e8; font-size: 0.8rem; }
.topbar-link:hover { color: #fff; }

/* ========== 侧边栏 ========== */
.sidebar { position: fixed; top: 50px; left: 0; bottom: 0; width: 200px; background: #fff; border-right: 1px solid #e2e5ea; overflow-y: auto; z-index: 90; transition: transform 0.2s; }
.sidebar.collapsed { transform: translateX(-200px); }
.nav-list { padding: 8px 0; }
.nav-list li { cursor: pointer; }
.nav-list .nav-category { padding: 10px 20px 6px; font-size: 0.7rem; font-weight: 700; color: #999; text-transform: uppercase; letter-spacing: 1px; }
.nav-list .nav-item { padding: 9px 20px; font-size: 0.85rem; color: #444; font-weight: 500; border-left: 3px solid transparent; transition: all 0.1s; }
.nav-list .nav-item:hover { background: #f5f7fa; color: #0d2b4e; }
.nav-list .nav-item.active { background: #edf2f8; color: #0d2b4e; border-left-color: #1a5a8a; font-weight: 700; }
.nav-list .nav-sub { padding: 2px 0 6px; }
.nav-list .nav-sub .nav-item { padding: 6px 32px; font-size: 0.8rem; }

/* ========== 内容区 ========== */
.content { margin: 50px 0 0 200px; min-height: calc(100vh - 50px); transition: margin 0.2s; }
.content.expanded { margin-left: 0; }
.content-inner { padding: 24px; }

/* ========== 页面标题 ========== */
.page-title { font-size: 1.3rem; font-weight: 700; color: #0d2b4e; margin-bottom: 6px; }
.page-subtitle { font-size: 0.8rem; color: #888; margin-bottom: 20px; }

/* ========== 卡片 ========== */
.card { background: #fff; border: 1px solid #e2e5ea; border-radius: 4px; margin-bottom: 20px; }
.card-header { padding: 14px 20px; border-bottom: 1px solid #eef1f5; display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 1rem; font-weight: 700; color: #0d2b4e; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid #eef1f5; background: #fafbfc; }

/* ========== 工具栏 ========== */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }

/* ========== 表单 ========== */
.form-row { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.form-group { flex: 1; min-width: 180px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: #555; margin-bottom: 4px; }
.form-group input,
.form-group select,
.form-group textarea { width: 100%; height: 36px; padding: 0 10px; border: 1px solid #d0d5dd; border-radius: 3px; font-size: 0.9rem; color: #1a1a1a; background: #f9fafb; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: #2563a0; background: #fff; }
.form-group textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 60px; }
.form-group select { cursor: pointer; }
.form-hint { font-size: 0.75rem; color: #999; margin-top: 2px; }

/* ========== 按钮 ========== */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 16px; border: 1px solid transparent; border-radius: 3px; font-size: 0.85rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all 0.1s; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #1a5a8a; color: #fff; border-color: #1a5a8a; }
.btn-primary:hover:not(:disabled) { background: #0d3b5e; }
.btn-success { background: #27ae60; color: #fff; border-color: #27ae60; }
.btn-success:hover:not(:disabled) { background: #1e8449; }
.btn-danger { background: #c0392b; color: #fff; border-color: #c0392b; }
.btn-danger:hover:not(:disabled) { background: #922b21; }
.btn-warning { background: #f39c12; color: #fff; border-color: #f39c12; }
.btn-warning:hover:not(:disabled) { background: #c87f0a; }
.btn-default { background: #fff; color: #444; border-color: #d0d5dd; }
.btn-default:hover:not(:disabled) { background: #f5f7fa; }
.btn-small { height: 30px; padding: 0 10px; font-size: 0.78rem; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; }

/* ========== 表格 ========== */
.table-wrap { overflow-x: auto; }
.table { font-size: 0.85rem; }
.table th { background: #f5f7fa; color: #444; font-weight: 700; padding: 10px 12px; text-align: left; border-bottom: 2px solid #d0d5dd; white-space: nowrap; font-size: 0.78rem; }
.table td { padding: 10px 12px; border-bottom: 1px solid #eef1f5; color: #333; }
.table tr:hover td { background: #fafcfd; }
.table .text-danger { color: #c0392b; font-weight: 700; }
.table .text-warning { color: #e67e22; font-weight: 600; }
.table .text-success { color: #27ae60; }

/* ========== 标签 ========== */
.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 2px; font-size: 0.75rem; font-weight: 600; margin: 2px; }
.tag-blue { background: #e8f0fe; color: #1a5a8a; }
.tag-green { background: #e6f7ee; color: #1e8449; }
.tag-red { background: #fdecea; color: #c0392b; }
.tag-orange { background: #fef5e7; color: #e67e22; }
.tag-gray { background: #eef1f5; color: #666; }
.tag-purple { background: #f3e8ff; color: #6b3fa0; }

/* ========== 状态徽章 ========== */
.badge-success { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: 0.75rem; font-weight: 600; background: #e6f7ee; color: #1e8449; }
.badge-danger { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: 0.75rem; font-weight: 600; background: #fdecea; color: #c0392b; }

/* ========== 代码/技术显示 ========== */
code { font-family: 'SF Mono', 'Consolas', 'Monaco', monospace; background: #f0f2f5; padding: 1px 6px; border-radius: 2px; font-size: 0.82rem; color: #2c3e50; }

/* ========== 分页 ========== */
.pagination { display: flex; align-items: center; gap: 4px; margin-top: 16px; justify-content: flex-end; flex-wrap: wrap; }
.pagination a { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid #d0d5dd; border-radius: 3px; font-size: 0.82rem; color: #444; background: #fff; cursor: pointer; }
.pagination a:hover { background: #f5f7fa; }
.pagination a.active { background: #1a5a8a; color: #fff; border-color: #1a5a8a; font-weight: 700; }
.pagination a.disabled { color: #ccc; pointer-events: none; }
.pagination-info { font-size: 0.8rem; color: #888; margin-right: 10px; }

/* ========== 统计卡片 ========== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid #e2e5ea; border-radius: 4px; padding: 18px 20px; }
.stat-card .stat-label { font-size: 0.78rem; color: #888; font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; color: #0d2b4e; }
.stat-card .stat-sub { font-size: 0.75rem; color: #999; margin-top: 4px; }
.stat-card.warn .stat-value { color: #c0392b; }
.stat-card.info .stat-value { color: #1a5a8a; }

/* ========== 搜索框 ========== */
.search-box { display: flex; align-items: center; gap: 6px; }
.search-box input { height: 34px; width: 200px; padding: 0 10px; border: 1px solid #d0d5dd; border-radius: 3px; font-size: 0.85rem; }
.search-box input:focus { border-color: #2563a0; }

/* ========== 权限开关 ========== */
.perm-table { font-size: 0.85rem; }
.perm-table th { background: #f5f7fa; font-weight: 700; text-align: center; padding: 8px 6px; font-size: 0.78rem; }
.perm-table td { text-align: center; padding: 6px; border-bottom: 1px solid #eef1f5; }
.perm-table td:first-child { text-align: left; font-weight: 600; }
.perm-toggle { width: 16px; height: 16px; cursor: pointer; accent-color: #1a5a8a; }

/* ========== 详情面板 ========== */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.detail-item { padding: 10px 0; }
.detail-item .detail-label { font-size: 0.78rem; color: #888; font-weight: 600; margin-bottom: 2px; }
.detail-item .detail-value { font-size: 0.9rem; color: #1a1a1a; font-weight: 500; }
.detail-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid #eef1f5; }
.detail-section h3 { font-size: 1rem; font-weight: 700; color: #0d2b4e; margin-bottom: 12px; }

/* ========== 对话框 ========== */
.dialog { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; border-radius: 6px; z-index: 200; width: 90%; max-width: 500px; box-shadow: 0 8px 40px rgba(0,0,0,0.2); }
.dialog.open { display: block; }
.dialog-header { padding: 16px 20px; border-bottom: 1px solid #eef1f5; font-size: 1rem; font-weight: 700; color: #0d2b4e; }
.dialog-body { padding: 20px; max-height: 400px; overflow-y: auto; }
.dialog-footer { padding: 12px 20px; border-top: 1px solid #eef1f5; display: flex; justify-content: flex-end; gap: 8px; background: #fafbfc; }

/* ========== 遮罩层 ========== */
.overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 150; }
.overlay.active { display: block; }

/* ========== Toast ========== */
.toast { position: fixed; top: 60px; right: 20px; z-index: 300; padding: 12px 20px; border-radius: 4px; font-size: 0.85rem; font-weight: 600; display: none; box-shadow: 0 4px 12px rgba(0,0,0,0.15); max-width: 360px; }
.toast.show { display: block; }
.toast.success { background: #e6f7ee; color: #1e8449; border: 1px solid #b7e4cf; }
.toast.error { background: #fdecea; color: #c0392b; border: 1px solid #f5c6c2; }
.toast.warn { background: #fef5e7; color: #e67e22; border: 1px solid #fad7a0; }
.toast.info { background: #e8f0fe; color: #1a5a8a; border: 1px solid #c5d5e8; }

/* ========== 空状态 ========== */
.empty-state { text-align: center; padding: 40px 20px; color: #aaa; font-size: 0.9rem; }

/* ========== 异常标记 ========== */
.anomaly-mark { color: #c0392b; font-weight: 700; }
.anomaly-mark::after { content: ' *'; }

/* ========== 离线提示 ========== */
.offline-bar { display: none; background: #f39c12; color: #fff; text-align: center; padding: 4px; font-size: 0.78rem; font-weight: 600; }
.offline-bar.show { display: block; }

/* ========== 响应式 - 手机端 ========== */
@media screen and (max-width: 768px) {
    html { font-size: 13px; }
    .sidebar { width: 220px; transform: translateX(-220px); }
    .sidebar.open { transform: translateX(0); }
    .content { margin-left: 0 !important; }
    .content-inner { padding: 12px; }
    .topbar { padding: 0 12px; }
    .topbar-store { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 12px 14px; }
    .stat-card .stat-value { font-size: 1.3rem; }
    .form-row { flex-direction: column; gap: 8px; }
    .form-group { min-width: 100%; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-left, .toolbar-right { width: 100%; }
    .search-box input { width: 100%; }
    .btn { width: 100%; justify-content: center; }
    .btn-group { flex-wrap: wrap; }
    .btn-group .btn { flex: 1; min-width: 80px; }
    .table-wrap { margin: 0 -12px; }
    .detail-grid { grid-template-columns: 1fr; }
    .pagination { justify-content: center; }
    .dialog { width: 95%; max-width: 95%; }
    .card-body { padding: 12px; }
    .card-header { padding: 10px 12px; }
}

@media screen and (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .stat-card .stat-label { font-size: 0.7rem; }
    .stat-card .stat-value { font-size: 1.1rem; }
    .table { font-size: 0.78rem; }
    .table th, .table td { padding: 6px 8px; }
}

/* ========== 打印 ========== */
@media print {
    .topbar, .sidebar, .toolbar, .pagination, .btn { display: none !important; }
    .content { margin: 0 !important; }
    .content-inner { padding: 0; }
    .card { border: none; box-shadow: none; }
}
