/* ============================================================
   子女端监控页 - 样式
   设计风格：深空蓝 + 科技蓝 + 鎏金
   ============================================================ */

:root {
    --deep-blue: #071D49;
    --tech-blue: #0D6EFD;
    --tech-blue-light: #3B8BFF;
    --gold: #D4AF37;
    --white: #FFFFFF;
    --bg-dark: #020C24;
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255,255,255,0.7);
    --text-muted: rgba(255,255,255,0.45);
    --border-subtle: rgba(255,255,255,0.06);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: "PingFang SC","Microsoft YaHei","HarmonyOS Sans",-apple-system,sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

/* ============================================================
   导航栏
   ============================================================ */
.header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    background: rgba(2,12,36,0.85); backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle); padding: 0 24px;
}
.nav-container {
    max-width: 1440px; margin: 0 auto; display: flex;
    align-items: center; justify-content: space-between; height: 64px;
}
.nav-logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; color: var(--white); }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links > a, .nav-links .nav-dropdown > a {
    font-size: 14px; color: var(--text-secondary); padding: 8px 0;
    transition: color var(--transition); white-space: nowrap;
}
.nav-links a:hover { color: var(--white); }
.nav-links a.active, .nav-links .nav-dropdown > a.active { color: var(--tech-blue-light); font-weight: 600; }
.nav-dropdown { position: relative; }
.nav-dropdown .arrow { font-size: 10px; margin-left: 4px; }
.dropdown-menu {
    position: absolute; top: 100%; left: 0; min-width: 130px;
    background: rgba(6,14,43,0.95); border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm); padding: 8px 0; opacity: 0; visibility: hidden;
    transform: translateY(8px); transition: all var(--transition); backdrop-filter: blur(20px);
}
.nav-dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu a { display: block; padding: 8px 20px; font-size: 13px; color: var(--text-secondary); transition: all var(--transition); }
.dropdown-menu a:hover { background: rgba(13,110,253,0.1); color: var(--tech-blue-light); }
.dropdown-menu a.active { color: var(--tech-blue-light); font-weight: 600; }
.nav-actions { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.nav-actions a { color: var(--text-secondary); transition: color var(--transition); }
.nav-actions a:hover { color: var(--white); }
.nav-family {
    padding: 8px 18px; background: rgba(13,110,253,0.12);
    border: 1px solid rgba(13,110,253,0.25); border-radius: 20px;
    font-weight: 600; color: var(--tech-blue-light)!important;
}
.nav-family.active { background: rgba(13,110,253,0.2); border-color: var(--tech-blue); }
.btn-register { padding: 8px 20px; background: linear-gradient(135deg, var(--tech-blue), #2563EB); color: var(--white)!important; border-radius: 20px; font-weight: 600; }

/* ============================================================
   页面主体
   ============================================================ */
.page-main { padding-top: 64px; }

/* ============================================================
   顶部标题栏
   ============================================================ */
.top-bar {
    padding: 16px 24px; background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border-subtle);
}
.top-bar-inner {
    max-width: 1440px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
}
.top-title {
    font-size: 22px; font-weight: 700; color: var(--white);
    display: flex; align-items: center; gap: 10px;
}
.btn-settings {
    padding: 10px 22px; font-size: 14px; font-weight: 600; color: var(--white);
    background: rgba(255,255,255,0.06); border: 1px solid var(--border-subtle);
    border-radius: 24px; cursor: pointer; display: flex; align-items: center; gap: 8px;
    transition: all var(--transition);
}
.btn-settings:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.15); }

/* ============================================================
   主体三栏布局
   ============================================================ */
.main-content { padding: 20px 24px; }
.main-grid {
    max-width: 1440px; margin: 0 auto;
    display: grid; grid-template-columns: 120px 1fr 280px; gap: 20px;
    min-height: 420px;
}

/* 左侧菜单 */
.sidebar {
    display: flex; flex-direction: column; gap: 8px;
    padding: 12px; background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
}
.sidebar-btn {
    width: 100%; padding: 14px 8px; font-size: 14px; font-weight: 600;
    color: var(--text-secondary); background: transparent; border: none;
    border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition);
    text-align: center;
}
.sidebar-btn:hover { color: var(--white); background: rgba(255,255,255,0.04); }
.sidebar-btn.active {
    color: var(--white); background: linear-gradient(135deg, var(--tech-blue), #2563EB);
    box-shadow: 0 4px 14px rgba(13,110,253,0.25);
}

/* 中间监控区 */
.center-area {
    background: rgba(255,255,255,0.01);
    border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
    overflow: hidden; position: relative;
}
.monitor-panel { display: none; flex-direction: column; height: 100%; }
.monitor-panel.active { display: flex; }

/* 地图区域 */
.panel-map {
    flex: 1; position: relative; min-height: 360px;
    background: linear-gradient(135deg, rgba(3,12,38,0.9), rgba(6,18,50,0.95));
}
.map-placeholder {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px;
    color: var(--text-muted); font-size: 14px;
}
/* 地图网格装饰 */
.panel-map::before {
    content: ''; position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(13,110,253,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(13,110,253,0.06) 1px, transparent 1px);
    background-size: 40px 40px;
}
/* 老人定位标签 */
.elder-tag {
    position: absolute; transform: translate(-50%,-100%);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    z-index: 10;
}
.elder-dot {
    width: 16px; height: 16px; background: var(--tech-blue-light);
    border-radius: 50%; box-shadow: 0 0 0 6px rgba(13,110,253,0.25);
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 6px rgba(13,110,253,0.25); }
    50% { box-shadow: 0 0 0 14px rgba(13,110,253,0.08); }
}
.elder-tag span {
    font-size: 12px; font-weight: 700; color: var(--white);
    background: rgba(2,12,36,0.9); padding: 3px 10px; border-radius: 12px;
    white-space: nowrap;
}
/* 底部信息行 */
.panel-info-row {
    display: flex; gap: 20px; padding: 16px 20px;
    background: rgba(255,255,255,0.02); border-top: 1px solid var(--border-subtle);
}
.info-item { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.info-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.info-val {
    font-size: 13px; color: var(--text-secondary); overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.info-val.highlight { color: var(--tech-blue-light); font-weight: 600; }
.info-val.status-online { color: #10B981; font-weight: 600; }

/* 视频区域 */
.panel-video {
    flex: 1; min-height: 360px;
    background: linear-gradient(135deg, #0a0a1a, #0d1117);
    display: flex; align-items: center; justify-content: center;
}
.video-placeholder {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    color: var(--text-muted); font-size: 14px;
}

/* 行为轨迹 */
.track-timeline { padding: 24px; overflow-y: auto; max-height: 400px; }
.track-item {
    position: relative; padding: 0 0 24px 32px; border-left: 2px solid rgba(255,255,255,0.06);
}
.track-item:last-child { padding-bottom: 0; }
.track-item.future { opacity: 0.4; border-left-style: dashed; }
.track-dot {
    position: absolute; left: -7px; top: 4px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--text-muted); border: 2px solid var(--bg-dark);
}
.track-item.active .track-dot {
    background: var(--tech-blue-light);
    box-shadow: 0 0 0 4px rgba(13,110,253,0.25);
    animation: pulse-dot 2s infinite;
}
.track-item.active { border-left-color: var(--tech-blue-light); }
.track-item.done .track-dot { background: #10B981; }
.track-info strong { display: block; font-size: 14px; color: var(--white); margin-bottom: 2px; }
.track-info span { font-size: 12px; color: var(--text-muted); }

/* 右侧数据卡片 */
.right-cards { display: flex; flex-direction: column; gap: 16px; }

.stat-card {
    background: rgba(255,255,255,0.02); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md); padding: 20px;
}
.stat-card h3 {
    font-size: 14px; font-weight: 700; color: var(--gold); margin-bottom: 14px;
    display: flex; align-items: center; gap: 6px;
}
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-item {
    padding: 12px; background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.stat-num { font-size: 20px; font-weight: 700; color: var(--tech-blue-light); }
.stat-num small { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.stat-label { font-size: 11px; color: var(--text-muted); }

/* 陪护行为 */
.behavior-list { display: flex; flex-direction: column; gap: 10px; }
.behavior-item {
    display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary);
    padding: 8px; background: rgba(255,255,255,0.02); border-radius: var(--radius-sm);
}
.behavior-item em { margin-left: auto; font-style: normal; color: var(--text-muted); font-size: 11px; }
.be-icon { font-size: 16px; flex-shrink: 0; }

/* 设备状态 */
.device-row {
    display: flex; gap: 12px; align-items: flex-start;
}
.device-icon { font-size: 28px; flex-shrink: 0; }
.device-info { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.device-info strong { font-size: 14px; color: var(--white); }
.device-bar {
    width: 100%; height: 6px; background: rgba(255,255,255,0.06);
    border-radius: 3px; overflow: hidden;
}
.device-fill { height: 100%; background: linear-gradient(90deg, #10B981, #34D399); border-radius: 3px; transition: width 0.6s ease; }
.device-meta { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   底部：添加老人区域
   ============================================================ */
.add-elder-section { padding: 24px 24px 60px; }
.add-elder-inner { max-width: 1440px; margin: 0 auto; }

.btn-add-elder {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 14px 28px; font-size: 15px; font-weight: 700;
    color: var(--tech-blue-light); background: rgba(13,110,253,0.06);
    border: 1px dashed rgba(13,110,253,0.3); border-radius: var(--radius-md);
    cursor: pointer; transition: all var(--transition);
}
.btn-add-elder:hover { background: rgba(13,110,253,0.12); border-style: solid; }

.add-form-wrap {
    display: none; margin-top: 20px;
    padding: 28px; background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
    max-width: 720px;
}
.add-form-wrap.open { display: block; }
.add-form-wrap h3 { font-size: 18px; font-weight: 700; color: var(--white); margin-bottom: 6px; }
.add-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.add-form { display: flex; flex-direction: column; gap: 16px; }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.field label .req { color: #F87171; }
.field input, .field select {
    padding: 12px 16px; font-size: 14px; color: var(--white);
    background: rgba(255,255,255,0.04); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm); outline: none; transition: all var(--transition);
}
.field input:focus, .field select:focus { border-color: rgba(13,110,253,0.4); background: rgba(13,110,253,0.05); }
.field input::placeholder { color: var(--text-muted); }
.field select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.field select option { background: var(--bg-dark); color: var(--white); }

.form-actions { display: flex; gap: 12px; margin-top: 8px; }
.btn-cancel {
    padding: 12px 32px; font-size: 14px; font-weight: 600; color: var(--text-secondary);
    background: rgba(255,255,255,0.04); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition);
}
.btn-cancel:hover { background: rgba(255,255,255,0.08); }
.btn-submit {
    padding: 12px 32px; font-size: 14px; font-weight: 700; color: var(--white);
    background: linear-gradient(135deg, var(--tech-blue), #2563EB);
    border: none; border-radius: var(--radius-sm); cursor: pointer;
    box-shadow: 0 4px 14px rgba(13,110,253,0.3);
    transition: all var(--transition);
}
.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(13,110,253,0.45); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1024px) {
    .main-grid { grid-template-columns: 100px 1fr; }
    .right-cards { display: none; }
}
@media (max-width: 768px) {
    .nav-links { display: none; }
    .main-grid { grid-template-columns: 1fr; }
    .sidebar { flex-direction: row; overflow-x: auto; padding: 8px; }
    .sidebar-btn { flex-shrink: 0; white-space: nowrap; }
    .form-row-2 { grid-template-columns: 1fr; }
    .panel-map { min-height: 260px; }
    .panel-video { min-height: 260px; }
    .track-timeline { max-height: 300px; }
}
