/* ============================================================
   小兜家 - 运营网站统一样式
   ============================================================ */

:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #E0E7FF;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
    --shadow: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
    --sidebar-w: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ===== 通用按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--gray-700); }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* ===== 卡片 ===== */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}
.card-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; color: var(--gray-900); }

/* ===== 统计卡片 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary);
}
.stat-card .stat-label { font-size: 13px; color: var(--gray-500); margin-bottom: 4px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); }
.stat-card .stat-sub { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.info { border-left-color: var(--info); }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow-sm); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: var(--gray-50); text-align: left; padding: 12px 16px; font-weight: 600; color: var(--gray-600); border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
tr:hover td { background: var(--gray-50); }
tr:last-child td { border-bottom: none; }

/* ===== 标签 ===== */
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.tag-success { background: #D1FAE5; color: #065F46; }
.tag-warning { background: #FEF3C7; color: #92400E; }
.tag-danger { background: #FEE2E2; color: #991B1B; }
.tag-info { background: #DBEAFE; color: #1E40AF; }
.tag-gray { background: var(--gray-100); color: var(--gray-600); }

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 16px; }
.pagination button { min-width: 36px; height: 36px; border: 1px solid var(--gray-300); background: #fff; border-radius: 8px; cursor: pointer; font-size: 14px; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ===== 提示框 ===== */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #D1FAE5; color: #065F46; }
.alert-error { background: #FEE2E2; color: #991B1B; }
.alert-info { background: #DBEAFE; color: #1E40AF; }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center; z-index: 999;
}
.modal {
    background: #fff; border-radius: var(--radius); padding: 28px;
    max-width: 520px; width: 90%; max-height: 85vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ============================================================
   前台官网样式
   ============================================================ */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255,255,255,.95); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--gray-200);
}
.site-header-inner {
    max-width: 1200px; margin: 0 auto; padding: 0 24px;
    height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.site-logo { font-size: 20px; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.logo-img { width: 36px; height: 36px; border-radius: 9px; display: block; }
.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav a { color: var(--gray-600); font-size: 15px; font-weight: 500; }
.site-nav a:hover { color: var(--primary); }

.hero {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: #fff; padding: 80px 24px; text-align: center;
}
.hero h1 { font-size: 42px; font-weight: 800; margin-bottom: 16px; }
.hero p { font-size: 18px; opacity: .9; max-width: 600px; margin: 0 auto 32px; }
.hero-actions { display: flex; gap: 16px; justify-content: center; }
.hero .btn-primary { background: #fff; color: var(--primary); }
.hero .btn-primary:hover { background: var(--gray-100); }
.hero .btn-outline { border-color: rgba(255,255,255,.5); color: #fff; }
.hero .btn-outline:hover { border-color: #fff; background: rgba(255,255,255,.1); }

.section { max-width: 1200px; margin: 0 auto; padding: 64px 24px; }
.section-title { text-align: center; font-size: 32px; font-weight: 800; color: var(--gray-900); margin-bottom: 12px; }
.section-desc { text-align: center; font-size: 16px; color: var(--gray-500); margin-bottom: 48px; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 24px; }
.product-card {
    background: #fff; border-radius: 16px; overflow: hidden;
    box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.product-card-header { padding: 32px 24px 16px; }
.product-card-header h3 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.product-card-header p { color: var(--gray-500); font-size: 14px; }
.product-card-price { padding: 0 24px 24px; }
.product-card-price .amount { font-size: 36px; font-weight: 800; color: var(--primary); }
.product-card-price .unit { font-size: 16px; color: var(--gray-500); }
.product-card-features { padding: 0 24px 24px; list-style: none; }
.product-card-features li { padding: 8px 0; color: var(--gray-600); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.product-card-features li::before { content: "✓"; color: var(--success); font-weight: 700; }
.product-card-action { padding: 0 24px 24px; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 32px; }
.feature-item { text-align: center; }
.feature-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--primary-light); display: inline-flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 16px; }
.feature-item h4 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.feature-item p { color: var(--gray-500); font-size: 14px; }

.site-footer { background: var(--gray-900); color: var(--gray-400); padding: 48px 24px 24px; }
.site-footer-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 28px; }
.site-footer h5 { color: #fff; font-size: 16px; margin-bottom: 16px; }
.site-footer-slogan { color: #fff; font-size: 16px; font-weight: 800; margin: 0 0 12px; }
.site-footer-soon { color: #6b7280; display: block; padding: 4px 0; font-size: 14px; }
.site-footer a { color: var(--gray-400); display: block; padding: 4px 0; font-size: 14px; }
.site-footer a:hover { color: #fff; }
.site-footer-bottom { max-width: 1200px; margin: 32px auto 0; padding-top: 24px; border-top: 1px solid var(--gray-700); text-align: center; font-size: 13px; }

/* ============================================================
   后台管理样式
   ============================================================ */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); background: var(--gray-900); color: var(--gray-300);
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
    display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-700); }
.sidebar-header .logo { font-size: 18px; font-weight: 800; color: #fff; }
.sidebar-header .role { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.sidebar-nav { flex: 1; padding: 16px 0; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 24px; color: var(--gray-400); font-size: 14px; font-weight: 500;
    transition: all .15s;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: var(--gray-800); color: #fff; border-left: 3px solid var(--primary); padding-left: 21px; }
.sidebar-nav .nav-icon { width: 20px; text-align: center; }
.sidebar-footer { padding: 16px 24px; border-top: 1px solid var(--gray-700); }
.sidebar-footer .user-name { font-size: 14px; color: #fff; font-weight: 600; }
.sidebar-footer .user-id { font-size: 12px; color: var(--gray-500); }
.sidebar-footer .btn-logout { margin-top: 8px; display: block; color: var(--gray-500); font-size: 13px; }
.sidebar-footer .btn-logout:hover { color: var(--danger); }

.main-content {
    flex: 1; margin-left: var(--sidebar-w);
    padding: 24px 32px; min-width: 0;
}
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h2 { font-size: 24px; font-weight: 700; color: var(--gray-900); }

.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar .form-input, .filter-bar .form-select { width: auto; min-width: 160px; }

/* ===== 登录页 ===== */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
}
.login-card {
    background: #fff; border-radius: 20px; padding: 40px;
    width: 400px; max-width: 90vw; box-shadow: var(--shadow-lg);
}
.login-card .logo { text-align: center; margin-bottom: 32px; }
.login-card .logo h1 { font-size: 24px; font-weight: 800; color: var(--primary); }
.login-card .logo p { font-size: 14px; color: var(--gray-500); margin-top: 8px; }
.login-tabs { display: flex; gap: 0; margin-bottom: 24px; border-bottom: 2px solid var(--gray-100); }
.login-tab { flex: 1; text-align: center; padding: 12px; cursor: pointer; font-size: 15px; font-weight: 600; color: var(--gray-400); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.login-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 48px 24px; color: var(--gray-400); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state .text { font-size: 16px; }

/* ===== Loading ===== */
.loading { text-align: center; padding: 40px; color: var(--gray-400); font-size: 16px; }
.loading::after { content: ""; display: inline-block; width: 20px; height: 20px; border: 2px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; margin-left: 8px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast ===== */
.toast {
    position: fixed; top: 24px; right: 24px; z-index: 9999;
    padding: 14px 24px; border-radius: 10px; font-size: 14px; font-weight: 500;
    box-shadow: var(--shadow-lg); animation: slideIn .3s ease;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--info); color: #fff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .3s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .site-footer-inner { grid-template-columns: 1fr; }
    .hero h1 { font-size: 28px; }
    .section { padding: 40px 16px; }
}

/* ===== 系统状态页（/admin/system.html）===== */
.check-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-bottom: 1px solid var(--gray-100, #f3f4f6);
    font-size: 14px;
}
.check-row:last-child { border-bottom: none; }
.check-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.check-label { flex: 1; color: var(--gray-700, #374151); }
.check-detail { color: var(--gray-500, #6b7280); font-size: 13px; font-family: monospace; text-align: right; word-break: break-all; }
.check-ok { background: rgba(16, 185, 129, .03); }
.check-fail { background: rgba(239, 68, 68, .05); }

.kv-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 0; border-bottom: 1px dashed var(--gray-100, #f3f4f6);
    font-size: 14px; gap: 12px;
}
.kv-row:last-child { border-bottom: none; }
.kv-label { color: var(--gray-600, #4b5563); flex-shrink: 0; }
.kv-value { color: var(--gray-800, #1f2937); font-family: monospace; text-align: right; word-break: break-all; }

/* ===== 子女端 H5（/care/*）===== */
.care-layout { max-width: 480px; margin: 0 auto; min-height: 100vh; background: #f7f8fa; position: relative; padding-bottom: 64px; box-sizing: border-box; }
.care-header { position: sticky; top: 0; z-index: 10; background: #fff; display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid #eee; gap: 8px; }
.care-back { font-size: 28px; color: var(--primary, #2563eb); text-decoration: none; line-height: 1; min-width: 28px; }
.care-back-placeholder { min-width: 28px; }
.care-title { flex: 1; font-size: 18px; font-weight: 600; margin: 0; color: #1f2937; text-align: center; }
.care-actions { min-width: 28px; display: flex; gap: 8px; justify-content: flex-end; }
.care-actions .btn { font-size: 13px; padding: 6px 12px; }
.care-main { padding: 16px; }
.care-tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: #fff; display: flex; border-top: 1px solid #eee; z-index: 10; }
.care-tab { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 0 6px; text-decoration: none; color: #9ca3af; font-size: 11px; gap: 2px; }
.care-tab.active { color: var(--primary, #2563eb); }
.care-tab-icon { font-size: 20px; line-height: 1; }
.care-tab-label { font-size: 11px; }
.care-card { background: #fff; border-radius: 12px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.care-card-title { font-size: 16px; font-weight: 600; margin: 0 0 12px; color: #1f2937; }
.care-elder-switch { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.care-elder-chip { flex-shrink: 0; padding: 8px 16px; border-radius: 20px; background: #fff; border: 1px solid #e5e7eb; font-size: 14px; color: #6b7280; cursor: pointer; }
.care-elder-chip.active { background: var(--primary, #2563eb); color: #fff; border-color: var(--primary, #2563eb); }
.care-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.care-stat { background: #fff; border-radius: 12px; padding: 14px; text-align: center; }
.care-stat-num { font-size: 28px; font-weight: 700; color: #1f2937; }
.care-stat-label { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.care-list-item { display: flex; align-items: center; padding: 14px 16px; background: #fff; border-radius: 12px; margin-bottom: 8px; gap: 12px; }
.care-list-item-icon { font-size: 24px; flex-shrink: 0; }
.care-list-item-body { flex: 1; min-width: 0; }
.care-list-item-title { font-size: 15px; font-weight: 500; color: #1f2937; }
.care-list-item-sub { font-size: 13px; color: #9ca3af; margin-top: 2px; }
.care-empty { text-align: center; padding: 48px 16px; color: #9ca3af; }
.care-empty-icon { font-size: 48px; margin-bottom: 12px; }
.care-btn-big { display: block; width: 100%; padding: 14px; font-size: 16px; font-weight: 600; border: none; border-radius: 12px; background: var(--primary, #2563eb); color: #fff; cursor: pointer; margin-top: 12px; }
.care-btn-big.outline { background: #fff; color: var(--primary, #2563eb); border: 1px solid var(--primary, #2563eb); }
.care-form-group { margin-bottom: 14px; }
.care-form-label { display: block; font-size: 14px; color: #4b5563; margin-bottom: 6px; }
.care-form-input { display: block; width: 100%; padding: 12px; font-size: 16px; border: 1px solid #e5e7eb; border-radius: 8px; box-sizing: border-box; }
.care-form-input:focus { outline: none; border-color: var(--primary, #2563eb); }
.care-alert { padding: 12px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 12px; }
.care-alert.info { background: #eff6ff; color: #1e40af; }
.care-alert.warning { background: #fffbeb; color: #92400e; }
.care-alert.danger { background: #fef2f2; color: #991b1b; }
.care-alert.success { background: #f0fdf4; color: #166534; }
.care-consent-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.care-consent-title { font-size: 16px; font-weight: 600; color: #92400e; margin-bottom: 8px; }
.care-consent-text { font-size: 14px; color: #78350f; line-height: 1.7; }
@media (max-width: 480px) {
    .care-stat-grid { grid-template-columns: repeat(2, 1fr); }
}
