/*
 * SafeCheck 通用样式
 * 屏幕自适应 - 内容占据屏幕尺寸的90%
 *
 * 测试提示：使用浏览器开发者工具模拟手机屏幕
 * Chrome/Edge: F12 -> Ctrl+Shift+M -> 选择 1080×2400 或添加自定义尺寸
 */

/* 默认：占据90%屏幕宽度 */
body .container,
body .app-container,
body .main-content {
    width: 90vw !important;
    max-width: 90vw !important;
    min-height: 85vh !important;
    margin: 0 auto;
}

/* 小屏幕优化 - 增加宽度和高度占比 */
@media (max-width: 480px) {
    body .container,
    body .app-container,
    body .main-content {
        width: 94vw !important;
        max-width: 94vw !important;
        min-height: 88vh !important;
    }
}

/* 中等屏幕 */
@media (min-width: 481px) and (max-width: 768px) {
    body .container,
    body .app-container,
    body .main-content {
        width: 92vw !important;
        max-width: 92vw !important;
        min-height: 86vh !important;
    }
}

/* ==================== 超长屏手机优化 (1080×2400) - 200% 放大 ==================== */
@media (min-width: 1000px) and (max-width: 1200px) and (min-height: 2000px) and (orientation: portrait) {

    /* body - 不使用 flex，避免影响固定定位元素 */
    body {
        font-size: 40px !important;
        line-height: 1.5 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* 容器 - 使用 margin 居中，不影响固定定位元素 */
    body .container,
    body .app-container,
    body .main-content {
        width: 92vw !important;
        max-width: 92vw !important;
        height: 67vh !important;
        min-height: 67vh !important;
        max-height: 67vh !important;
        font-size: 40px !important;
        overflow-y: auto !important;
        margin: 16.5vh auto !important; /* 垂直居中：(100vh - 67vh) / 2 */
        position: relative !important;
    }

    /* ========== 所有按钮 200% ========== */
    /* 通用按钮选择器 - 覆盖所有可能的按钮 */
    body button,
    body .button,
    body .btn,
    body input[type="button"],
    body input[type="submit"],
    body .checkin-button,
    body .upgrade-button,
    body .add-button,
    body .action-button,
    body .back-btn,
    body .delete-btn,
    body .save-btn,
    body .cancel-btn,
    body .settings-btn,
    body .lang-btn,
    body .menu-btn,
    body .close-btn,
    body .confirm-btn {
        min-height: 140px !important;
        font-size: 44px !important;
        padding: 36px 60px !important;
        width: auto !important;
    }

    /* 登录页面角色选择按钮 - 老人端/监护端 */
    body .role-option,
    body .role-selector .role-option {
        min-height: 140px !important;
        font-size: 48px !important;
        padding: 36px 60px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* 登录页面验证码按钮 */
    body .send-code-btn,
    body .verify-btn {
        min-height: 100px !important;
        font-size: 38px !important;
        padding: 24px 40px !important;
    }

    /* ========== 语言选择按钮 200% ========== */
    /* 语言切换按钮 - 增强特异性覆盖内联样式 */
    body .lang-dropdown-btn,
    body .lang-switcher .lang-dropdown-btn,
    body div.lang-dropdown-btn {
        min-height: 80px !important;
        height: auto !important;
        font-size: 32px !important;
        padding: 20px 60px !important;
        line-height: 1.5 !important;
        border-radius: 8px !important;
    }

    /* 语言下拉菜单选项 */
    body .lang-dropdown-content a,
    body .lang-dropdown-content .lang-option,
    body div.lang-dropdown-content a {
        min-height: 70px !important;
        height: auto !important;
        font-size: 30px !important;
        padding: 18px 30px !important;
        line-height: 1.5 !important;
    }

    /* 语言菜单容器 */
    body .lang-dropdown-content,
    body div.lang-dropdown-content {
        min-width: 240px !important;
        border-radius: 8px !important;
    }

    /* ========== 按钮位置：右上角区域，一左一右 ========== */
    /* 语言选择器容器 - 右上角右侧 - 确保固定定位 */
    body .lang-switcher,
    body .lang-dropdown,
    body .elder .lang-switcher,
    body .guardian .lang-switcher,
    body div.lang-switcher {
        position: fixed !important;
        top: 20px !important;
        right: 20px !important;
        left: auto !important;
        margin: 0 !important;
        z-index: 100 !important;
        min-width: 150px !important;
    }

    /* 导航/设置按钮容器 - 只对老人端应用固定定位 */
    body .elder .settings-dropdown,
    body .elder .nav-dropdown {
        position: fixed !important;
        top: 20px !important;
        right: 400px !important;
        z-index: 100 !important;
        display: flex !important;
        align-items: center !important;
    }

    /* 其他页面保持原有布局 */
    body .settings-dropdown,
    body .nav-dropdown {
        display: flex !important;
        align-items: center !important;
    }

    /* ========== 导航/设置按钮 200% - 只针对老人端固定定位 ========== */
    /* 老人端设置按钮 - 老人端页面需要固定定位 */
    body .elder .settings-btn,
    body .elder #settingsBtn,
    body.elder button.settings-btn {
        position: fixed !important;
        top: 20px !important;
        right: 400px !important;
        z-index: 100 !important;
        min-height: 80px !important;
        height: auto !important;
        width: auto !important;
        font-size: 40px !important;
        padding: 20px !important;
    }

    /* 监护端和其他页面的按钮保持原有布局，只放大尺寸 */
    body .settings-btn,
    body button.settings-btn {
        min-height: 80px !important;
        height: auto !important;
        width: auto !important;
        font-size: 40px !important;
        padding: 20px !important;
    }

    /* 其他导航/设置按钮 */
    body .nav-btn,
    body .menu-btn {
        min-height: 80px !important;
        height: auto !important;
        width: auto !important;
        font-size: 40px !important;
        padding: 20px !important;
    }

    /* 导航按钮内的 SVG 图标 */
    body .settings-btn svg,
    body .nav-btn svg,
    body .menu-btn svg {
        width: 40px !important;
        height: 40px !important;
    }

    /* 老人端的语言选择器容器 */
    body .elder .lang-switcher,
    body .elder .language-selector {
        position: fixed !important;
        top: 20px !important;
        right: 20px !important;
        z-index: 100 !important;
    }

    /* ========== 导航弹出菜单 - 在按钮正下方 ========== */
    body .settings-menu,
    body .nav-menu,
    body .menu-dropdown {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: auto !important;
        margin-top: 10px !important;
        transform: translateX(0) !important;
    }

    /* ========== 导航弹出菜单 200% ========== */
    /* 设置/导航菜单容器 */
    body .settings-menu,
    body .nav-menu,
    body .menu-dropdown {
        min-width: 300px !important;
        border-radius: 16px !important;
    }

    /* 菜单项 */
    body .settings-menu-item,
    body .nav-menu-item,
    body .menu-item {
        min-height: 80px !important;
        height: auto !important;
        font-size: 38px !important;
        padding: 24px 32px !important;
        line-height: 1.3 !important;
    }

    /* 确保按钮内的文字也是200% */
    button *, .button *, .btn *, input[type="button"] *, input[type="submit"] *,
    .checkin-button *, .upgrade-button *, .add-button *, .action-button *,
    .back-btn *, .delete-btn *, .save-btn *, .cancel-btn * {
        font-size: inherit !important;
    }

    /* 全宽按钮 - 更大的字体 */
    body .checkin-button,
    body .upgrade-button,
    body .add-button,
    body .action-button {
        width: 100% !important;
        min-height: 160px !important;
        font-size: 48px !important;
    }

    /* ========== 所有输入框和文本框 200% ========== */
    /* 通用输入框选择器 - 覆盖所有可能的输入框 */
    body input,
    body input[type="text"],
    body input[type="tel"],
    body input[type="number"],
    body input[type="email"],
    body input[type="password"],
    body input[type="search"],
    body input[type="url"],
    body select,
    body textarea,
    body .verification-input,
    body .code-input,
    body .form-input,
    body .text-input,
    body .form-group input,
    body .form-group textarea,
    body .form-group select {
        min-height: 120px !important;
        font-size: 40px !important;
        padding: 30px !important;
        border-radius: 16px !important;
    }

    /* 验证码输入框组 */
    body .code-input-group,
    body .verification-group {
        display: flex !important;
        gap: 16px !important;
        align-items: center !important;
    }

    /* 确保输入框内的placeholder文字也是200% */
    body input::placeholder,
    body textarea::placeholder,
    body input::-webkit-input-placeholder,
    body textarea::-webkit-input-placeholder,
    body input::-moz-placeholder,
    body textarea::-moz-placeholder {
        font-size: 40px !important;
    }

    /* ========== 表单标签 200% ========== */
    body .form-group label,
    body label,
    body .form-label,
    body .input-label {
        font-size: 36px !important;
        margin-bottom: 20px !important;
        display: block !important;
    }

    /* ========== 表单组 200% ========== */
    body .form-group {
        margin-bottom: 32px !important;
    }

    /* ========== 登录/提交按钮 200% ========== */
    body .login-btn,
    body .submit-btn,
    body .confirm-btn,
    body .form-submit {
        width: 100% !important;
        min-height: 160px !important;
        font-size: 48px !important;
        padding: 36px !important;
        margin-top: 16px !important;
    }

    /* ========== 文字和标题 200% ========== */
    h1, h2, h3, h4, h5, h6,
    body h1, body h2, body h3 {
        font-size: 60px !important;
        margin-bottom: 40px !important;
    }

    .logo, .plan-name, .status-text,
    body .logo, body .plan-name, body .status-text {
        font-size: 56px !important;
    }

    .tagline, .subtitle,
    body .tagline, body .subtitle {
        font-size: 36px !important;
    }

    /* ========== 列表和卡片 200% ========== */
    .card, .elder-card, .plan-card, .status-card,
    .history-section, .elder-card,
    body .card, body .elder-card, body .plan-card, body .status-card,
    body .history-section {
        padding: 60px !important;
        margin-bottom: 50px !important;
        border-radius: 16px !important;
    }

    li, .history-item, .settings-menu-item,
    body li, body .history-item, body .settings-menu-item {
        padding: 24px 0 !important;
        font-size: 38px !important;
    }

    .history-title, .section-title,
    body .history-title, body .section-title {
        font-size: 42px !important;
        margin-bottom: 30px !important;
    }

    .history-date, .history-time,
    body .history-date, body .history-time {
        font-size: 36px !important;
    }

    /* ========== 链接和可点击元素 200% ========== */
    a, .clickable,
    body a {
        min-height: 100px !important;
        display: inline-flex;
        align-items: center;
        font-size: 38px !important;
    }

    /* 复选框内的链接保持原样 */
    .agreement-checkbox a,
    body .agreement-checkbox a {
        min-height: auto !important;
        display: inline !important;
        font-size: inherit !important;
    }

    /* ========== 图标和SVG 200% ========== */
    svg, body svg {
        width: 48px !important;
        height: 48px !important;
    }

    /* ========== 菜单和下拉框 200% ========== */
    .settings-btn, .lang-btn,
    body .settings-btn, body .lang-btn {
        font-size: 40px !important;
        padding: 16px !important;
    }

    .settings-menu, .lang-dropdown,
    body .settings-menu, body .lang-dropdown {
        min-width: 300px !important;
        border-radius: 16px !important;
    }

    .settings-menu-item, .lang-option,
    body .settings-menu-item, body .lang-option {
        padding: 24px 32px !important;
        font-size: 38px !important;
    }

    /* ========== Toast 提示 200% ========== */
    .toast, body .toast {
        padding: 28px 48px !important;
        font-size: 36px !important;
        border-radius: 8px !important;
        bottom: 60px !important;
    }

    /* ========== 表单元素 200% ========== */
    label, .form-label,
    body label, body .form-label {
        font-size: 38px !important;
        margin-bottom: 20px !important;
    }

    .verification-input, .code-input,
    body .verification-input, body .code-input {
        min-height: 120px !important;
        font-size: 48px !important;
        letter-spacing: 20px !important;
    }

    /* ========== 页面特定元素 200% ========== */
    .elder-name, .elder-status, .checkin-status,
    body .elder-name, body .elder-status, body .checkin-status {
        font-size: 44px !important;
    }

    .price-amount, .price-period,
    body .price-amount, body .price-period {
        font-size: 56px !important;
    }

    .badge, .tag,
    body .badge, body .tag {
        font-size: 28px !important;
        padding: 12px 24px !important;
    }
}

/* ==================== 大屏手机 (768-1400px) ==================== */
@media (min-width: 768px) and (max-width: 1400px) {
    body {
        font-size: 18px !important;
    }

    button, .button, .btn, input[type="button"], input[type="submit"] {
        min-height: 60px !important;
        font-size: 19px !important;
        padding: 15px 25px !important;
    }

    input[type="text"],
    input[type="tel"],
    input[type="number"],
    input[type="email"],
    select,
    textarea {
        min-height: 55px !important;
        font-size: 18px !important;
        padding: 12px !important;
    }
}

/* ==================== 大屏幕（桌面/平板） ==================== */
@media (min-width: 1200px) {
    body .container,
    body .app-container,
    body .main-content {
        width: 800px !important;
        max-width: 800px !important;
        min-height: 80vh !important;
    }
}

/* ==================== body 基础样式 ==================== */
body {
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 20px;
    overflow-x: hidden;
    overflow-y: hidden;
}

@media (max-width: 480px) {
    body {
        padding: 12px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    body {
        padding: 16px;
    }
}

/* 超长屏特殊布局 - 内容垂直居中，高度2/3 */
@media (min-width: 1000px) and (max-width: 1200px) and (min-height: 2000px) {
    body {
        padding: 0 !important;
    }
}

/* ==================== 防止内容溢出 ==================== */
* {
    max-width: 100%;
    box-sizing: border-box;
}

/* ==================== 默认触摸目标尺寸 ==================== */
button, a, input, select {
    min-height: 44px;
}

/* 复选框内的链接保持正常尺寸 - 排除在通用样式外 */
.agreement-checkbox a {
    min-height: auto !important;
    display: inline !important;
    vertical-align: baseline !important;
}

/* ==================== 横屏模式优化 ==================== */
@media (orientation: landscape) and (max-height: 600px) {
    body {
        padding: 10px;
    }
    body .container,
    body .app-container,
    body .main-content {
        min-height: 90vh !important;
    }
}

/* ==================== 隐私政策/用户协议页面样式 ==================== */
.policy-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* 隐私政策/用户协议可滚动内容区域 */
.scrollable-content {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 8px;
    /* 自定义滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

/* Webkit 浏览器滚动条样式 (Chrome, Safari, Edge) */
.scrollable-content::-webkit-scrollbar {
    width: 8px;
}

.scrollable-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.scrollable-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.scrollable-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ==================== 返回按钮样式 ==================== */
.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    color: #1a1a1a;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 100;
    text-decoration: none;
}

.back-btn:hover {
    background-color: #f5f5f5;
}

.back-btn svg {
    width: 16px;
    height: 16px;
}

.policy-container .page-header {
    text-align: center;
    margin-bottom: 40px;
}

.policy-container .page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.policy-container .page-header p {
    color: #666;
    font-size: 13px;
}

.policy-container .content {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
}

.policy-container .section {
    margin-bottom: 30px;
}

.policy-container .section h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.policy-container .section p,
.policy-container .section ul {
    color: #333;
    line-height: 1.7;
    font-size: 14px;
}

.policy-container .section ul {
    padding-left: 20px;
    margin-top: 10px;
}

.policy-container .section li {
    margin-bottom: 8px;
}

.policy-container .section strong {
    font-weight: 500;
    color: #1a1a1a;
}

.policy-container .contact {
    background: #f9f9f9;
    padding: 16px;
    border-radius: 4px;
    margin-top: 30px;
}

.policy-container .contact p {
    color: #1a1a1a;
    font-size: 14px;
    margin-bottom: 4px;
}

.policy-container .contact a {
    color: #1a1a1a;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .policy-container {
        padding: 20px;
    }

    .policy-container .content {
        padding: 20px;
    }

    .policy-container .page-header h1 {
        font-size: 22px;
    }
}

/* ==================== 语言切换器样式 ==================== */
.lang-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

/* RTL页面语言切换器样式 - 镜像为左侧 */
html[dir="rtl"] .lang-switcher {
    left: 20px;
    right: auto;
}

.lang-dropdown {
    position: relative;
    display: inline-block;
}

.lang-dropdown-btn {
    padding: 8px 30px 8px 12px;
    font-size: 13px;
    text-decoration: none;
    color: #1a1a1a;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a1a1a' d='M6 8L2 4h8z'/%3E%3C/svg%3E") no-repeat right 10px center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.lang-dropdown-btn:hover {
    background-color: #f5f5f5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a1a1a' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
}

.lang-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 5px;
    background: white;
    min-width: 120px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 4px;
    overflow: hidden;
}

/* RTL页面下拉菜单样式 - 镜像为左侧 */
html[dir="rtl"] .lang-dropdown-content {
    left: 0;
    right: auto;
}

.lang-dropdown-content.show {
    display: block;
}

.lang-dropdown-content a {
    display: block;
    padding: 10px 16px;
    font-size: 13px;
    color: #1a1a1a;
    text-decoration: none;
    transition: background 0.2s;
    white-space: nowrap;
}

.lang-dropdown-content a:hover {
    background-color: #f5f5f5;
}

.lang-dropdown-content a.active {
    background-color: #e8f4ff;
    color: #0066cc;
    font-weight: 500;
}

/* ==================== 阿拉伯语字体支持 ==================== */
@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Noto+Sans+Arabic:wght@400;500;700&display=swap');

html[dir="rtl"] body,
html[dir="rtl"] .container,
html[dir="rtl"] .app-container,
html[dir="rtl"] .main-content {
    font-family: 'Noto Sans Arabic', 'Amiri', Arial, sans-serif !important;
}

html[dir="rtl"] .policy-container .page-header h1,
html[dir="rtl"] .policy-container .section h2,
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3 {
    font-family: 'Amiri', 'Noto Sans Arabic', Arial, sans-serif !important;
}

html[dir="rtl"] .back-btn {
    left: auto;
    right: 20px;
}

html[dir="rtl"] .lang-switcher {
    left: 20px;
    right: auto;
}

html[dir="rtl"] .lang-dropdown-content {
    left: 0;
    right: auto;
}

html[dir="rtl"] .back-btn svg {
    transform: rotate(180deg);
}

html[dir="rtl"] .policy-container .section ul {
    padding-left: 0;
    padding-right: 20px;
}

html[dir="rtl"] .help-item-icon {
    margin-left: 12px;
    margin-right: 0;
}

html[dir="rtl"] .help-item-content {
    text-align: right;
}

html[dir="rtl"] .faq-answer {
    padding-left: 0;
    padding-right: 20px;
    border-left: none;
    border-right: 3px solid #e0e0e0;
}

html[dir="rtl"] .faq-question::before {
    display: none;
}

html[dir="rtl"] .faq-question::after {
    content: '؟';
    display: inline-block;
    margin-left: 0;
    margin-right: 8px;
    color: #1890ff;
    font-weight: bold;
}

html[dir="rtl"] .nav-item {
    flex-direction: row-reverse;
}

html[dir="rtl"] .nav-item .nav-icon {
    margin-left: 12px;
    margin-right: 0;
}

/* RTL 模式下帮助页面的特殊调整 */
html[dir="rtl"] .help-page .section-icon {
    margin-left: 12px;
    margin-right: 0;
}

html[dir="rtl"] .help-page .faq-item {
    text-align: right;
}

html[dir="rtl"] .help-page .faq-question {
    flex-direction: row-reverse;
    padding-left: 0;
    padding-right: 16px;
}

html[dir="rtl"] .help-page .faq-question::after {
    display: none;
}

html[dir="rtl"] .help-page .faq-question::before {
    content: '+';
    display: inline-block;
    margin-right: 0;
    margin-left: 8px;
    color: #1890ff;
    font-weight: bold;
}

html[dir="rtl"] .help-page .faq-answer {
    text-align: right;
    padding-left: 0;
    padding-right: 32px;
}

html[dir="rtl"] .help-page .back-btn svg {
    transform: rotate(180deg);
}

html[dir="rtl"] .help-page .nav-link svg {
    transform: rotate(180deg);
}
