/* ======================================================
   新外网络 - 用户中心 移动端响应式修复 (member-responsive.css)
   仅覆盖移动端/平板端样式，不修改PC端
   断点统一: 575.98px(手机) / 767.98px(平板) / 991.98px(小屏PC)
   ====================================================== */

/* ===== viewport 优化 ===== */
@viewport {
    width: device-width;
    zoom: 1;
}

/* ===== iOS安全区适配 (仅移动端) ===== */
@media (max-width: 991.98px) {
    @supports (padding-top: env(safe-area-inset-top)) {
        .bd-sidebar {
            padding-top: env(safe-area-inset-top);
        }

        .bd-navbar {
            padding-top: env(safe-area-inset-top);
            height: calc(56px + env(safe-area-inset-top));
        }

        .bd-main-content {
            margin-top: calc(56px + env(safe-area-inset-top));
            padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        }
    }
}

/* ===== 平板端 (768px - 991.98px) ===== */
@media (max-width: 991.98px) {
    /* 侧边栏默认隐藏（移动端滑出模式） */
    .bd-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 260px !important;
        z-index: 1060 !important;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .bd-sidebar.show {
        transform: translateX(0);
    }

    /* 主内容区全宽 */
    .bd-main-wrapper {
        margin-left: 0 !important;
        max-width: 100vw !important;
    }

    /* 导航栏全宽 */
    .bd-navbar {
        left: 0 !important;
        padding: 0 1rem !important;
    }

    /* 显示移动端菜单按钮 */
    .bd-mobile-menu-btn {
        display: flex !important;
    }

    .navbar-center {
        max-width: calc(100% - 200px) !important;
    }

    /* 主内容区padding调整 */
    .bd-main-content {
        padding: 1.25rem !important;
    }

    /* 消息下拉框宽度适配 */
    .message-dropdown {
        width: calc(100vw - 2rem) !important;
        max-width: 320px !important;
        right: 0 !important;
        left: auto !important;
    }

    /* 卡片padding调整 */
    .bd-card .bd-card-header {
        padding: 1rem 1.25rem !important;
    }

    .bd-card .bd-card-body {
        padding: 1.25rem !important;
    }

    /* 首页布局：右侧栏全宽 */
    .bd-index-main {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    /* 欢迎卡片高度调整 */
    .bd-welcome-card {
        min-height: auto !important;
    }

    /* 欢迎问候语 */
    .welcome-greeting {
        font-size: 1.35rem !important;
    }

    /* 产品统计5列改3-4列自适应 */
    .product-stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 12px !important;
    }

    .product-stat-item {
        min-width: 0 !important;
    }

    /* 快捷操作4列改3列 */
    .quick-actions-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    /* 统计卡片自适应 */
    .bd-stat-cards {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 统计数值缩小 */
    .bd-stat-card .stat-info .stat-value {
        font-size: 1.25rem !important;
    }

    /* 日志列取消固定宽度 */
    .log-col.ip,
    .log-col.location {
        width: auto !important;
        min-width: 0 !important;
    }

    /* 表格添加横向滚动 */
    .bd-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1.25rem;
        padding: 0 1.25rem;
    }

    .bd-table {
        min-width: 600px;
    }

    /* 公告消息行改为单列 */
    .bd-notice-message-row,
    .bd-account-product-row,
    .bd-log-row {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    /* 我的服务页 */
    .service-layout {
        grid-template-columns: 1fr !important;
    }

    .service-type-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 页脚（如果有的话） */
    .bd-footer-grid {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* ===== 手机端 (max-width: 767.98px) ===== */
@media (max-width: 767.98px) {
    /* 侧边栏宽度调整 */
    .bd-sidebar {
        width: 280px !important;
    }

    /* 侧边栏内部间距 */
    .bd-sidebar-header {
        padding: 1rem !important;
    }

    .user-avatar {
        width: 48px !important;
        height: 48px !important;
    }

    .user-name {
        font-size: 0.9rem !important;
    }

    .user-company {
        font-size: 0.7rem !important;
    }

    .section-title {
        padding: 0.5rem 1rem 0.35rem 1.25rem !important;
        font-size: 0.7rem !important;
    }

    .nav-link {
        padding: 0.85rem 1rem 0.85rem 1.25rem !important;
        font-size: 0.9rem !important;
        gap: 0.5rem !important;
    }

    .nav-link i {
        font-size: 1.1rem !important;
        width: 22px !important;
    }

    .bd-sidebar-footer {
        padding: 0.75rem 1rem !important;
    }

    .bd-sidebar-footer .copyright {
        font-size: 0.7rem !important;
    }

    /* 顶部导航栏 */
    .bd-navbar {
        height: 56px !important;
        padding: 0 0.875rem !important;
    }

    .bd-main-content {
        margin-top: 56px !important;
        padding: 1rem !important;
    }

    .navbar-right {
        gap: 0.5rem !important;
    }

    /* 首页按钮只显示图标 */
    .bd-home-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 0 !important;
        padding: 0 !important;
    }

    .bd-home-btn i {
        font-size: 1rem !important;
    }

    /* 消息按钮 */
    .message-toggle {
        width: 36px !important;
        height: 36px !important;
        font-size: 1rem !important;
    }

    /* 公告滚动条 */
    .bd-notice-scroll {
        padding: 0.375rem 0.5rem !important;
        border-radius: 6px !important;
    }

    .notice-scroll-icon {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.75rem !important;
        border-radius: 4px !important;
    }

    .notice-scroll-wrapper {
        height: 20px !important;
    }

    .notice-scroll-item {
        font-size: 0.75rem !important;
    }

    /* 时间/天气组件隐藏或缩小 */
    .bd-time-widget {
        display: none !important;
    }

    .bd-weather-widget {
        display: none !important;
    }

    .navbar-center {
        max-width: calc(100% - 120px) !important;
    }

    /* 移动端菜单按钮 */
    .bd-mobile-menu-btn {
        font-size: 1.2rem !important;
        padding: 0.25rem 0.375rem !important;
    }

    /* 卡片样式 */
    .bd-card {
        border-radius: 12px !important;
    }

    .bd-card .bd-card-header {
        padding: 0.875rem 1rem !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .bd-card .bd-card-header h5 {
        font-size: 0.9rem !important;
    }

    .bd-card .bd-card-body {
        padding: 1rem !important;
    }

    /* 表单样式 - 关键：font-size 16px 防止iOS缩放 */
    .bd-form .form-label {
        font-size: 0.85rem !important;
        margin-bottom: 0.35rem !important;
    }

    .bd-form .form-control,
    .bd-form .form-select {
        font-size: 16px !important;
        padding: 0.65rem 0.75rem !important;
        border-radius: 8px !important;
        min-height: 44px;
    }

    .bd-form .input-group-text {
        font-size: 0.8rem !important;
        padding: 0.65rem 0.75rem !important;
    }

    /* 按钮 */
    .bd-btn {
        padding: 0.65rem 1.5rem !important;
        font-size: 0.9rem !important;
        min-height: 44px !important;
        border-radius: 10px !important;
    }

    .bd-btn-sm {
        padding: 0.4rem 0.875rem !important;
        font-size: 0.8rem !important;
        min-height: 36px !important;
    }

    .bd-btn-lg {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.95rem !important;
    }

    /* 验证码组 */
    .bd-captcha-group {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }

    .bd-captcha-group .btn-send-code {
        width: 100% !important;
        min-height: 44px !important;
    }

    .captcha-img {
        width: 100px !important;
        min-width: 100px !important;
        height: 44px !important;
    }

    /* 表格 */
    .bd-table {
        font-size: 0.8rem !important;
    }

    .bd-table thead th {
        padding: 0.65rem 0.75rem !important;
        font-size: 0.75rem !important;
    }

    .bd-table tbody td {
        padding: 0.65rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    /* 徽章字号调整 */
    .bd-badge {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
    }

    /* 首页欢迎区 */
    .welcome-greeting {
        font-size: 1.2rem !important;
    }

    .welcome-meta {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    .welcome-meta .welcome-level,
    .welcome-meta .welcome-tag {
        font-size: 0.75rem !important;
        padding: 0.25rem 0.6rem !important;
    }

    /* 快捷操作2列 */
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .quick-action-item {
        padding: 14px 10px !important;
    }

    .quick-action-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
    }

    .quick-action-text {
        font-size: 13px !important;
    }

    /* 产品统计2列 */
    .product-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .product-stat-item {
        padding: 12px 10px !important;
    }

    .product-stat-num {
        font-size: 1.25rem !important;
    }

    .product-stat-label {
        font-size: 12px !important;
    }

    /* 统计卡片 */
    .bd-stat-cards {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .bd-stat-card {
        padding: 14px !important;
    }

    .bd-stat-card .stat-info .stat-value {
        font-size: 1.15rem !important;
    }

    .bd-stat-card .stat-info .stat-label {
        font-size: 12px !important;
    }

    /* 公告列表 */
    .notice-item {
        padding: 12px 0 !important;
        gap: 10px !important;
    }

    .notice-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }

    .notice-title {
        font-size: 13px !important;
    }

    .notice-time {
        font-size: 11px !important;
    }

    .notice-badge {
        font-size: 10px !important;
        padding: 1px 6px !important;
    }

    /* 账户产品 */
    .account-product-item {
        padding: 12px 0 !important;
    }

    .account-product-name {
        font-size: 13px !important;
    }

    .account-product-meta {
        font-size: 12px !important;
    }

    /* 日志 */
    .log-row {
        padding: 10px 0 !important;
    }

    .log-col {
        font-size: 12px !important;
    }

    .log-badge {
        font-size: 0.7rem !important;
    }

    .view-all-link {
        font-size: 0.8rem !important;
    }

    /* 我的服务页 */
    .service-type-grid {
        grid-template-columns: 1fr !important;
    }

    .svc-card {
        padding: 16px !important;
    }

    .svc-card-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
    }

    .svc-card-name {
        font-size: 14px !important;
    }

    .svc-card-desc {
        font-size: 12px !important;
    }

    .svc-notice-text,
    .svc-notice-item {
        font-size: 12px !important;
    }

    .svc-notice-group-title {
        font-size: 13px !important;
    }

    /* 服务导航选项卡 */
    .service-nav-item .nav-label {
        font-size: 12px !important;
    }

    .nav-count {
        font-size: 10px !important;
        padding: 1px 5px !important;
    }

    /* 认证页面（登录/注册） */
    .bd-auth-page {
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
    }

    .bd-auth-brand-side {
        display: none !important;
    }

    .bd-auth-form-side {
        flex: 1 1 100% !important;
        padding: 24px 16px !important;
        max-width: 100% !important;
        overflow-y: auto !important;
    }

    .bd-auth-card {
        padding: 24px 20px !important;
        max-width: 100% !important;
        border-radius: 16px !important;
    }

    .bd-auth-card h2 {
        font-size: 1.5rem !important;
    }

    .bd-auth-card .form-control {
        height: 44px !important;
        font-size: 16px !important;
    }

    .bd-auth-card .bd-btn {
        height: 48px !important;
        font-size: 15px !important;
    }

    .bd-login-mode-tabs .mode-tab {
        font-size: 14px !important;
        padding: 10px 0 !important;
    }

    .bd-form-hint-text {
        font-size: 12px !important;
    }

    .bd-agreement-label {
        font-size: 12px !important;
    }

    /* 实名认证页面 */
    .realname-card {
        padding: 20px 16px !important;
    }

    .realname-type-grid {
        grid-template-columns: 1fr !important;
    }

    /* 财务/充值页面 */
    .recharge-amount-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .finance-summary {
        flex-direction: column !important;
        gap: 12px !important;
    }

    /* 个人资料 */
    .profile-avatar-section {
        flex-direction: column !important;
        text-align: center !important;
    }

    /* 域名管理 */
    .domain-card {
        padding: 16px !important;
    }

    .domain-name {
        font-size: 16px !important;
    }

    /* 弹窗模态框 */
    .modal-dialog {
        margin: 0.5rem !important;
    }

    .modal-content {
        border-radius: 12px !important;
    }

    .modal-header {
        padding: 14px 16px !important;
    }

    .modal-body {
        padding: 16px !important;
        max-height: 60vh !important;
        overflow-y: auto !important;
    }

    .modal-footer {
        padding: 12px 16px !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .modal-footer .btn {
        flex: 1 !important;
        min-width: 120px !important;
    }

    /* Toast提示 */
    .bd-toast {
        min-width: auto !important;
        width: calc(100vw - 2rem) !important;
        max-width: 320px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: 20px !important;
        font-size: 13px !important;
        padding: 10px 16px !important;
    }

    /* 密码强度提示 */
    .bd-pwd-strength-text {
        font-size: 12px !important;
    }

    .bd-pwd-strength-text .pwd-hints {
        font-size: 11px !important;
    }

    /* 实名徽章 */
    .realname-badge-link {
        font-size: 11px !important;
    }

    /* 分页 */
    .pagination {
        flex-wrap: wrap !important;
        gap: 4px !important;
        justify-content: center !important;
    }

    .page-link {
        padding: 6px 12px !important;
        font-size: 13px !important;
        min-width: 36px !important;
        height: 36px !important;
    }
}

/* ===== 超小屏幕 (max-width: 575.98px) ===== */
@media (max-width: 575.98px) {
    .bd-main-content {
        padding: 0.75rem !important;
    }

    /* 侧边栏更宽一点利用空间 */
    .bd-sidebar {
        width: 85vw !important;
        max-width: 300px !important;
    }

    /* 欢迎区 */
    .welcome-greeting {
        font-size: 1.1rem !important;
    }

    /* 快捷操作 */
    .quick-actions-grid {
        gap: 8px !important;
    }

    .quick-action-item {
        padding: 12px 8px !important;
    }

    .quick-action-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
        border-radius: 10px !important;
    }

    .quick-action-text {
        font-size: 12px !important;
    }

    /* 产品统计 */
    .product-stats-grid {
        gap: 8px !important;
    }

    .product-stat-item {
        padding: 10px 8px !important;
    }

    .product-stat-num {
        font-size: 1.1rem !important;
    }

    .product-stat-label {
        font-size: 11px !important;
    }

    /* 卡片 */
    .bd-card .bd-card-header {
        padding: 0.75rem !important;
    }

    .bd-card .bd-card-body {
        padding: 0.75rem !important;
    }

    /* 认证页面 */
    .bd-auth-card {
        padding: 20px 16px !important;
    }

    .bd-auth-card h2 {
        font-size: 1.35rem !important;
    }

    /* 充值金额 */
    .recharge-amount-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .recharge-amount-item {
        padding: 12px 8px !important;
        font-size: 14px !important;
    }

    /* 消息下拉 */
    .message-dropdown {
        width: calc(100vw - 1rem) !important;
        max-width: none !important;
        right: 0.5rem !important;
    }

    .message-item {
        padding: 0.75rem 1rem !important;
    }

    .message-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.9rem !important;
    }

    .message-text {
        font-size: 0.8rem !important;
    }
}

/* ===== 横屏手机适配 ===== */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 991.98px) {
    .bd-sidebar {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .bd-sidebar-header {
        padding: 0.75rem 1rem !important;
    }

    .nav-link {
        padding: 0.6rem 1rem 0.6rem 1.25rem !important;
    }

    .bd-auth-form-side {
        padding: 16px !important;
    }

    .bd-auth-card {
        padding: 20px !important;
    }
}

/* ===== 手机端全局防溢出/不截断 (仅移动端) ===== */
@media (max-width: 767.98px) {
    .bd-card-body,
    .bd-card-header,
    .modal-body,
    .welcome-body,
    .notice-body,
    .log-col,
    .account-product-info,
    .svc-card-body,
    .bd-table td,
    .bd-table th {
        overflow-wrap: break-word !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
    }

    /* 确保所有图片不溢出 */
    .bd-card img,
    .modal-body img,
    .bd-main-content img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* 隐藏文字的元素在移动端恢复显示 */
    .user-company,
    .notice-time,
    .log-time {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* 表格单元格不截断 */
    .bd-table td,
    .bd-table th {
        white-space: normal !important;
    }

    /* 操作按钮组在移动端不换行 */
    .bd-table .btn-group,
    .bd-table .action-btns {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
        white-space: nowrap !important;
    }
}
