/* 帮老适 - 新增功能样式
   包括：字体大小调节、一键拨号、收藏按钮、运营数据看板、导航徽标
*/

/* ========== 导航栏徽标（未读数/待处理） ========== */
.nav-badge {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    margin-left: 4px;
    vertical-align: middle;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
    animation: nav-badge-pulse 1.6s ease-in-out infinite;
}

.nav-badge-alert {
    background: #ef4444; /* 红色：紧急（待处理绑定请求） */
}

.nav-badge-info {
    background: #3b82f6; /* 蓝色：普通（未读推荐） */
}

.nav-badge-pending {
    background: #f59e0b; /* 橙色：等待中（已发请求待对方确认） */
}

@keyframes nav-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

.navbar-item {
    position: relative;
    white-space: nowrap;
}

/* ========== 家庭功能提醒横幅（dashboard） ========== */
.family-alert-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 5px solid;
}

.family-alert-incoming {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-left-color: #f59e0b;
    color: #78350f;
}

.family-alert-outgoing {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-left-color: #3b82f6;
    color: #1e3a8a;
}

.family-alert-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.family-alert-text {
    flex: 1;
}

.family-alert-text strong {
    font-size: 16px;
    display: block;
    margin-bottom: 4px;
}

.family-alert-text p {
    margin: 0;
    font-size: 13px;
    opacity: 0.85;
}

.family-alert-banner .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* ========== 字体大小调节器 ========== */
.font-size-control {
    display: inline-flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 4px;
    margin-left: 8px;
}

.font-size-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
    font-family: serif;
    line-height: 1;
    /* 按钮字母大小由 HTML 内联 style 控制：12px / 18px / 26px，对应小/中/大三档 */
}

.font-size-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.font-size-btn.active {
    background: white;
    color: #2563eb;
    font-weight: bold;
}

/* 字体大小档位 - 整页缩放（不破坏布局） */
body.font-size-small {
    font-size: 14px; /* 小 */
}

body.font-size-medium {
    font-size: 16px; /* 中（默认） */
}

body.font-size-large {
    font-size: 22px; /* 大 */
}

/* 大字体下各模块的关键字号调整 */
body.font-size-large h1 { font-size: 1.4em; }
body.font-size-large h2 { font-size: 1.25em; }
body.font-size-large h3 { font-size: 1.15em; }

body.font-size-large .step-desc,
body.font-size-large .tutorial-info h3,
body.font-size-large .tutorial-card h3 { font-size: 1.2em; }

/* ========== 首页快捷操作 ========== */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 20px auto;
    max-width: 800px;
}

.quick-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 20px;
    border-radius: 14px;
    text-decoration: none;
    color: white;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.quick-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.quick-action.emergency {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.quick-action.favorite {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
}

.quick-action-icon {
    font-size: 28px;
}

@media (max-width: 600px) {
    .quick-action {
        padding: 14px 16px;
        font-size: 16px;
    }
    .quick-action-icon {
        font-size: 22px;
    }
}

/* ========== 收藏按钮 ========== */
.favorite-btn {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.favorite-btn:hover {
    transform: scale(1.1);
    border-color: #ec4899;
}

.favorite-btn.active {
    background: #ec4899;
    border-color: #ec4899;
    color: white;
    animation: heartPop 0.3s ease;
}

@keyframes heartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.tutorial-header-with-fav {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.tutorial-header-with-fav > div:first-child {
    flex: 1;
}

/* 教程卡片上的收藏小图标 */
.tutorial-card-wrap {
    position: relative;
}

.tutorial-card-wrap .favorite-corner {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    font-size: 20px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ========== 收藏列表页 ========== */
.favorites-list {
    max-width: 800px;
    margin: 0 auto;
}

.favorite-item {
    background: white;
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}

.favorite-item:hover {
    transform: translateX(4px);
}

.favorite-item-icon {
    font-size: 40px;
    flex-shrink: 0;
}

.favorite-item-info {
    flex: 1;
    min-width: 0;
}

.favorite-item-info h3 {
    margin-bottom: 4px;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.favorite-item-meta {
    font-size: 14px;
    color: #64748b;
}

/* ========== 运营数据看板 ========== */
.dashboard-section {
    background: white;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.dashboard-section h2 {
    margin-bottom: 16px;
    color: #1e293b;
    font-size: 20px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-card {
    background: white;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.dashboard-card-title {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 8px;
}

.dashboard-card-value {
    font-size: 32px;
    font-weight: bold;
    color: #2563eb;
}

.dashboard-card-trend {
    font-size: 12px;
    color: #10b981;
    margin-top: 4px;
}

.dashboard-card-trend.down {
    color: #ef4444;
}

.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

.top-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.top-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.top-list-item:last-child {
    border-bottom: none;
}

.top-list-rank {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.top-list-rank.silver { background: linear-gradient(135deg, #94a3b8, #64748b); }
.top-list-rank.bronze { background: linear-gradient(135deg, #f59e0b, #d97706); }

.top-list-content {
    flex: 1;
    min-width: 0;
}

.top-list-content h4 {
    margin: 0;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-list-content p {
    margin: 2px 0 0;
    font-size: 12px;
    color: #64748b;
}

.top-list-value {
    color: #2563eb;
    font-weight: bold;
    font-size: 14px;
}
