/**
 * Mac 设计风格样式表
 *
 * 参考 macOS Big Sur / Monterey 设计语言：
 *   - 磨砂玻璃效果（backdrop-filter: blur）
 *   - 圆角卡片式布局
 *   - macOS 系统色板（主色 #007aff）
 *   - -apple-system 系统字体
 *   - 渐变背景
 *
 * 适用页面：公开测算页（index）、结果展示页（result）
 */

/* ============================================================
   全局基础样式
   ============================================================ */

/* 重置外边距，保证浏览器默认样式不影响布局 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 页面根样式：系统字体 + 渐变背景 */
body {
    /* macOS 系统字体栈，优先使用苹果系统字体 */
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    /* 135° 渐变背景，模拟 macOS 桌面壁纸的柔和色调 */
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    /* 最小高度撑满视窗，保证渐变铺满整个页面 */
    min-height: 100vh;
    /* 文字颜色：深灰，保证在浅色背景上有良好对比度 */
    color: #1d1d1f;
    /* 行高 1.6，提升中文阅读体验 */
    line-height: 1.6;
    /* 字体抗锯齿，让 macOS 下的文字渲染更细腻 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   页面容器（居中布局）
   ============================================================ */

/* 页面主容器：限制最大宽度并居中 */
.page-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

/* ============================================================
   顶部标题区
   ============================================================ */

/* 标题区容器 */
.header {
    text-align: center;
    margin-bottom: 32px;
}

/* 主标题：大号字体 + macOS 深色 */
.header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

/* 副标题/说明文本：中号灰色字体 */
.header .subtitle {
    font-size: 15px;
    color: #6e6e73;
    font-weight: 400;
}

/* ============================================================
   磨砂玻璃卡片（核心组件）
   ============================================================ */

/* 卡片容器：磨砂玻璃效果 + 圆角 + 阴影 */
.glass-card {
    /* 半透明白色背景，配合 backdrop-filter 实现磨砂效果 */
    background: rgba(255, 255, 255, 0.72);
    /* backdrop-filter: 模糊背景，模拟 macOS 毛玻璃 */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* 圆角 12px，macOS 标准圆角 */
    border-radius: 12px;
    /* 细边框增强卡片层次感 */
    border: 1px solid rgba(255, 255, 255, 0.6);
    /* 内边距 */
    padding: 32px;
    /* 阴影：柔和的多层阴影模拟 macOS 卡片悬浮效果 */
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    margin-bottom: 24px;
}

/* ============================================================
   表单区域样式
   ============================================================ */

/* 表单项分组 */
.form-section {
    margin-bottom: 24px;
}

/* 表单项最后一项去除底部间距 */
.form-section:last-child {
    margin-bottom: 0;
}

/* 表单标签：macOS 风格的紧凑标签 */
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 8px;
}

/* 必填项标记（红色星号） */
.form-label .required {
    color: #ff3b30;
    margin-left: 2px;
}

/* ============================================================
   输入框样式覆盖（配合 layui）
   ============================================================ */

/* layui 输入框圆角化 + 聚焦光晕 */
.layui-input,
.layui-select,
.layui-textarea {
    /* 圆角 8px，比默认更圆润 */
    border-radius: 8px !important;
    /* 边框颜色：macOS 浅灰 */
    border-color: #d2d2d7 !important;
    /* 高度调整为 macOS 风格 */
    height: 42px !important;
    line-height: 42px !important;
    /* 内边距 */
    padding: 0 14px !important;
    /* 字体大小 */
    font-size: 15px !important;
    /* 过渡动画：聚焦时平滑变化 */
    transition: border-color 0.2s, box-shadow 0.2s !important;
    /* 背景半透明白色 */
    background: rgba(255, 255, 255, 0.8) !important;
}

/* 输入框聚焦状态：macOS 蓝色光晕 */
.layui-input:focus,
.layui-select:focus,
.layui-textarea:focus {
    border-color: #007aff !important;
    /* 蓝色光晕阴影 */
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12) !important;
    outline: none !important;
}

/* layui 下拉框圆角化 */
.layui-form-select .layui-input {
    border-radius: 8px !important;
}

/* layui 日期选择器图标对齐 */
.layui-input-wrap .layui-input-suffix {
    right: 8px;
}

/* ============================================================
   单选/复选按钮样式（macOS 风格）
   ============================================================ */

/* layui 单选按钮容器 */
.layui-form-radio,
.layui-form-checkbox {
    margin: 6px 16px 6px 0;
}

/* 单选按钮选中态：macOS 蓝 */
.layui-form-radioed i,
.layui-form-radioed .layui-icon {
    color: #007aff !important;
}

/* 复选框选中态：macOS 蓝 */
.layui-form-checked[lay-skin="primary"] i {
    color: #007aff !important;
    border-color: #007aff !important;
}

/* ============================================================
   按钮（macOS 风格）
   ============================================================ */

/* 主按钮：macOS 蓝色实心按钮 */
.btn-primary {
    /* 背景渐变：macOS 蓝 */
    background: linear-gradient(180deg, #0a84ff 0%, #007aff 100%) !important;
    /* 白色文字 */
    color: #ffffff !important;
    /* 圆角 */
    border-radius: 10px !important;
    /* 去除默认边框 */
    border: none !important;
    /* 高度 */
    height: 46px !important;
    line-height: 46px !important;
    /* 字体 */
    font-size: 16px !important;
    font-weight: 500 !important;
    /* 内边距 */
    padding: 0 32px !important;
    /* 阴影：按钮悬浮感 */
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25) !important;
    /* 过渡动画 */
    transition: all 0.2s ease !important;
    /* 手型指针 */
    cursor: pointer;
    width: 100%;
}

/* 主按钮悬浮：上浮 + 加深阴影 */
.btn-primary:hover {
    background: linear-gradient(180deg, #0071e1 0%, #0064d6 100%) !important;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.35) !important;
    transform: translateY(-1px);
}

/* 主按钮按下：下沉效果 */
.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 122, 255, 0.2) !important;
}

/* 次按钮：macOS 浅色描边按钮 */
.btn-secondary {
    background: rgba(255, 255, 255, 0.8) !important;
    color: #007aff !important;
    border: 1px solid #007aff !important;
    border-radius: 10px !important;
    height: 46px !important;
    line-height: 44px !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    padding: 0 32px !important;
    transition: all 0.2s ease !important;
    cursor: pointer;
    width: 100%;
}

/* 次按钮悬浮 */
.btn-secondary:hover {
    background: rgba(0, 122, 255, 0.06) !important;
}

/* ============================================================
   历法切换 / 日期选择区
   ============================================================ */

/* 日期选择行：横向排列年/月/日下拉 */
.date-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* 日期选择项：等分 */
.date-row .date-item {
    flex: 1;
}

/* 闰月勾选项：固定宽度 */
.date-row .leap-item {
    flex: 0 0 auto;
    white-space: nowrap;
    padding-top: 28px;
}

/* ============================================================
   时间不确定勾选行
   ============================================================ */

/* 横向排列时间选择器与勾选框 */
.time-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* 时间选择器占主区 */
.time-row .time-input {
    flex: 1;
}

/* 勾选框固定宽度 */
.time-row .unknown-check {
    flex: 0 0 auto;
    white-space: nowrap;
    padding-top: 28px;
}

/* ============================================================
   省市联动行
   ============================================================ */

/* 省份 + 市县文本框横向排列 */
.place-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* 省份下拉 */
.place-row .place-province {
    flex: 0 0 140px;
}

/* 市县文本框 */
.place-row .place-city {
    flex: 1;
}

/* ============================================================
   页脚
   ============================================================ */

/* 页脚样式 */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: #86868b;
    font-size: 13px;
    line-height: 1.8;
}

/* ============================================================
   结果页样式
   ============================================================ */

/* 结果卡片基础样式 */
.result-card {
    /* 半透明背景 */
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 40px 32px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* 结果图标：大号 emoji */
.result-icon {
    font-size: 64px;
    margin-bottom: 16px;
    line-height: 1;
}

/* 结果标签文本 */
.result-label {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

/* 结果副文本 */
.result-subtext {
    font-size: 15px;
    color: #6e6e73;
}

/* ----- 三档颜色变体 ----- */

/* 优选：绿色系 */
.result-prefer {
    background: rgba(48, 209, 88, 0.12) !important;
    border-color: rgba(48, 209, 88, 0.3) !important;
}
.result-prefer .result-label {
    color: #248a3d;
}

/* 观察：橙色系 */
.result-watch {
    background: rgba(255, 159, 10, 0.12) !important;
    border-color: rgba(255, 159, 10, 0.3) !important;
}
.result-watch .result-label {
    color: #c93400;
}

/* 淘汰：红色系 */
.result-eliminate {
    background: rgba(255, 69, 58, 0.12) !important;
    border-color: rgba(255, 69, 58, 0.3) !important;
}
.result-eliminate .result-label {
    color: #c93400;
}

/* ============================================================
   命理依据卡片
   ============================================================ */

/* 命理依据文本：保留换行，等宽中文排版 */
.reason-text {
    font-size: 15px;
    color: #1d1d1f;
    line-height: 1.9;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 命理依据卡片标题 */
.reason-title {
    font-size: 17px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* ============================================================
   四柱展示区（结果页）
   ============================================================ */

/* 四柱容器：横向均分 */
.bazi-row {
    display: flex;
    justify-content: space-around;
    gap: 12px;
    margin-top: 16px;
}

/* 单柱单元格 */
.bazi-pillar {
    flex: 1;
    text-align: center;
    padding: 16px 8px;
    background: rgba(0, 122, 255, 0.06);
    border-radius: 10px;
    border: 1px solid rgba(0, 122, 255, 0.12);
}

/* 柱名（年柱/月柱/日柱/时柱） */
.bazi-pillar .pillar-name {
    font-size: 12px;
    color: #6e6e73;
    margin-bottom: 8px;
}

/* 干支组合 */
.bazi-pillar .pillar-value {
    font-size: 20px;
    font-weight: 600;
    color: #1d1d1f;
    letter-spacing: 1px;
}

/* ============================================================
   返回按钮区
   ============================================================ */

.action-bar {
    text-align: center;
    margin-top: 8px;
}

.action-bar .btn-secondary {
    display: inline-block;
    width: auto;
    min-width: 160px;
}

/* ============================================================
   提示信息（精度标注等）
   ============================================================ */

/* 精度提示：小号灰色文本 */
.precision-hint {
    font-size: 13px;
    color: #86868b;
    text-align: center;
    margin-top: 12px;
}

/* ============================================================
   移动端响应式（max-width: 600px）
   ============================================================ */

@media (max-width: 600px) {
    /* 页面容器减小内边距 */
    .page-container {
        padding: 20px 12px 40px;
    }

    /* 标题字号缩小 */
    .header h1 {
        font-size: 22px;
    }

    /* 副标题字号缩小 */
    .header .subtitle {
        font-size: 13px;
    }

    /* 卡片内边距减小 */
    .glass-card,
    .result-card {
        padding: 20px 16px;
    }

    /* 日期行改为纵向排列 */
    .date-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    /* 闰月勾选改为行内 */
    .date-row .leap-item {
        padding-top: 0;
    }

    /* 时间行改为纵向排列 */
    .time-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    /* 勾选框改为行内 */
    .time-row .unknown-check {
        padding-top: 0;
    }

    /* 省市联动行改为纵向排列 */
    .place-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    /* 省份下拉占满宽度 */
    .place-row .place-province {
        flex: 1;
    }

    /* 四柱容器间距缩小 */
    .bazi-row {
        gap: 6px;
    }

    /* 单柱内边距减小 */
    .bazi-pillar {
        padding: 12px 4px;
    }

    /* 干支字号缩小 */
    .bazi-pillar .pillar-value {
        font-size: 17px;
    }

    /* 结果图标缩小 */
    .result-icon {
        font-size: 52px;
    }

    /* 结果标签字号缩小 */
    .result-label {
        font-size: 19px;
    }
}

/* ============================================================
   加载遮罩（提交时显示）
   ============================================================ */

/* 全屏遮罩 */
.loading-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

/* 遮罩显示 */
.loading-mask.show {
    display: flex;
}

/* 加载文本 */
.loading-mask .loading-text {
    font-size: 16px;
    color: #1d1d1f;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 32px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* 加载动画圆点 */
.loading-mask .loading-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #007aff;
    border-radius: 50%;
    margin: 0 2px;
    animation: loading-bounce 1.4s infinite ease-in-out both;
}

/* 三个圆点错开动画 */
.loading-mask .loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}
.loading-mask .loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

/* 弹跳动画 */
@keyframes loading-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}
