/* ============================================
   飞书 (Feishu/Lark) 风格设计系统
   结合参考图1的深蓝主色调
   ============================================ */

:root {
    /* ===== 主品牌色（参考图1饱和深蓝）===== */
    --brand-primary: #1E6FD9;        /* 主品牌色 */
    --brand-hover: #4080FF;
    --brand-active: #245BDB;
    --brand-deep: #0F4AA0;
    --brand-light: #5BA4E5;
    --brand-soft: #A4C9F0;
    --brand-bg: #E1EAFF;             /* 浅蓝块底 */
    --brand-bg-2: #F0F4FF;
    --brand-bg-3: #EFF6FF;

    /* ===== 飞书文字色阶 ===== */
    --text-1: #1F2329;               /* 主文本 */
    --text-2: #51565D;               /* 副文本 */
    --text-3: #8F959E;               /* 三级 / 提示 */
    --text-4: #C5CAD2;               /* 弱文本 / 占位 */
    --text-disabled: #DEE0E3;
    --text-link: #1E6FD9;
    --text-inverse: #FFFFFF;

    /* ===== 飞书背景色 ===== */
    --bg-body: #F5F6F7;              /* 页面主背景 */
    --bg-card: #FFFFFF;              /* 卡片底色 */
    --bg-secondary: #F2F3F5;         /* 二级灰底 */
    --bg-tertiary: #E5E6EB;
    --bg-hover: #F2F3F5;
    --bg-active: #E5E6EB;

    /* ===== 边框 ===== */
    --border-1: #E5E6EB;
    --border-2: #DEE0E3;
    --border-strong: #C9CDD4;
    --divider: rgba(31, 35, 41, 0.06);

    /* ===== 状态色 ===== */
    --success: #1A9F3D;
    --success-bg: #DCF5E1;
    --warning: #FF7D00;
    --warning-bg: #FFF3E0;
    --danger: #F53F3F;
    --danger-bg: #FFECE8;

    /* ===== 数据可视化色 ===== */
    --data-heart: #F53F3F;
    --data-breath: #1E6FD9;
    --data-hrv: #7B6FD9;
    --data-warm: #FF7D00;

    /* ===== 圆角 - 飞书风格 ===== */
    --radius-2: 2px;
    --radius-4: 4px;
    --radius-6: 6px;
    --radius-8: 8px;
    --radius-10: 10px;
    --radius-12: 12px;
    --radius-16: 16px;
    --radius-20: 20px;
    --radius-full: 9999px;

    /* ===== 阴影 - 飞书层级 ===== */
    --shadow-1: 0 1px 2px rgba(31, 35, 41, 0.04);
    --shadow-2: 0 2px 8px rgba(31, 35, 41, 0.06);
    --shadow-3: 0 4px 16px rgba(31, 35, 41, 0.08);
    --shadow-4: 0 8px 24px rgba(31, 35, 41, 0.10);
    --shadow-card: 0 1px 3px rgba(31, 35, 41, 0.04), 0 4px 12px rgba(31, 35, 41, 0.04);
    --shadow-brand: 0 4px 12px rgba(30, 111, 217, 0.30);
    --shadow-brand-lg: 0 8px 24px rgba(30, 111, 217, 0.24);

    /* ===== 渐变 ===== */
    --gradient-brand: linear-gradient(135deg, #4080FF 0%, #1E6FD9 100%);
    --gradient-brand-soft: linear-gradient(135deg, #5BA4E5 0%, #1E6FD9 100%);
    --gradient-banner: linear-gradient(180deg, #3375E0 0%, #1E6FD9 60%, #1860C4 100%);
    --gradient-banner-soft: linear-gradient(180deg, #DDE9FB 0%, #EEF4FC 60%, #F5F6F7 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    /* Notion 风格：Inter 为主，中文回退到系统字体 */
    font-family: "PingFang SC", "HarmonyOS Sans", "Noto Sans CJK SC", sans-serif;
    letter-spacing: 0.01em;
    background: #E5E7EB;
    background-image: radial-gradient(ellipse at top, #EEF0F3 0%, #D8DBE0 80%);
    color: var(--text-1);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 手机外壳容器 - 模拟真实手机屏幕尺寸 */
#app {
    width: 390px;
    height: 844px;
    max-height: 100vh;
    position: relative;
    overflow: hidden;
    background: var(--bg-body);
    border-radius: 44px;
    box-shadow:
        0 0 0 10px #1F2024,
        0 0 0 11px #2D2F35,
        0 24px 60px rgba(60, 70, 90, 0.22),
        0 8px 24px rgba(60, 70, 90, 0.14);
}

/* 移动端原生：撑满屏幕 */
@media (max-width: 480px) {
    body {
        background: var(--bg-body);
        display: block;
    }
    #app {
        width: 100vw;
        height: 100vh;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }
}

/* ===== 状态栏（相对于手机容器）===== */
.status-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 13px;
    z-index: 100;
    background: transparent;
    pointer-events: none;
}

.status-bar .time {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-1);
}

/* Banner 状态栏统一黑色 */
.status-bar.on-banner .time { color: var(--text-1); }
.status-bar.on-banner .status-icons svg { fill: var(--text-1); }

.status-icons { display: flex; gap: 6px; align-items: center; }
.status-icons svg { fill: var(--text-1); }

/* ===== 页面通用 ===== */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-body);
}

.page.active { display: flex; }

.page-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* ===== 顶部 Banner（飞书工作台风格）===== */
.feishu-banner {
    position: relative;
    background: var(--gradient-banner);
    padding: 50px 20px 56px;
    color: white;
    overflow: hidden;
}

.feishu-banner::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -60px;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, transparent 65%);
    border-radius: 50%;
    pointer-events: none;
}

.feishu-banner::after {
    content: '';
    position: absolute;
    bottom: -100px;
    left: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.10) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.banner-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.banner-title {
    font-size: 20px;
    font-weight: 600;
    color: white;
    letter-spacing: 0.5px;
}

.banner-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.78);
    font-weight: 400;
    margin-top: 4px;
    letter-spacing: 0.3px;
}

/* 普通 page header */
.page-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 50px 13px 12px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border-1);
}

.page-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-1);
    letter-spacing: 0.3px;
}

.btn-back {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-8);
    cursor: pointer;
    transition: background 0.15s;
}

.btn-back:hover { background: var(--bg-hover); }
.btn-back:active { background: var(--bg-active); }
.btn-back svg { stroke: var(--text-1); stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.btn-share {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-8);
    cursor: pointer;
}

.btn-share:hover { background: var(--bg-hover); }

/* ===== 飞书风格卡片 ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-12);
    padding: 16px;
    margin: 0 13px 10px;
    box-shadow: var(--shadow-card);
}

/* 下沉卡片（叠在 banner 上）*/
.banner-overlap {
    margin-top: -40px;
    position: relative;
    z-index: 2;
}

/* ===== Tab Bar - 底部导航（flex 布局固定在底部）===== */
.tab-bar {
    height: 64px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    border-top: 1px solid rgba(30,64,120,0.06);
    z-index: 90;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: #8A94A6;
    font-size: 10px;
    font-weight: 400;
    cursor: pointer;
    position: relative;
    padding: 6px 0;
    height: 100%;
    justify-content: center;
    transition: color 0.15s;
}

.tab-item.active {
    color: #167AF7;
    font-weight: 500;
}

.tab-item svg { width: 22px; height: 22px; }


/* ===== Toggle Switch ===== */
.toggle-switch { position: relative; width: 44px; height: 24px; display: inline-block; }
.toggle-switch.small { width: 36px; height: 20px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #C9CDD4;
    border-radius: 9999px;
    transition: 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-switch.small .toggle-slider::before { height: 16px; width: 16px; }

.toggle-switch input:checked + .toggle-slider {
    background: var(--brand-primary);
}

.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-switch.small input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ===== Toast（相对于手机容器）===== */
.toast {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(31, 35, 41, 0.92);
    backdrop-filter: blur(12px);
    color: white;
    padding: 10px 22px;
    border-radius: var(--radius-8);
    font-size: 13px;
    font-weight: 400;
    z-index: 200;
    opacity: 0;
    transition: all 0.25s ease;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: var(--shadow-3);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 飞书按钮系统 ===== */
.btn-primary {
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: var(--radius-8);
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:active { background: var(--brand-active); }

.btn-secondary {
    background: white;
    color: var(--brand-primary);
    border: 1px solid var(--brand-primary);
    border-radius: var(--radius-8);
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.btn-secondary:hover { background: var(--brand-bg-3); }

/* ===== 标签 / Tag ===== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-4);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}

.tag-blue { background: var(--brand-bg-3); color: var(--brand-primary); }
.tag-green { background: var(--success-bg); color: var(--success); }
.tag-orange { background: var(--warning-bg); color: var(--warning); }
.tag-red { background: var(--danger-bg); color: var(--danger); }
.tag-gray { background: var(--bg-secondary); color: var(--text-2); }

/* ===== 动画 ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.3); }
}

@keyframes breathe {
    0%, 100% { transform: scale(0.92); opacity: 0.85; }
    50% { transform: scale(1.08); opacity: 1; }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.page::-webkit-scrollbar { width: 0; }

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .tab-bar {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(64px + env(safe-area-inset-bottom));
    }
}
