/**
 * DODO 卡密验证系统 - 全局样式
 * 现代黑白风格 · 微圆润 · 解决溢出与居中
 */

/* ==========================================
   全局与排版基础
   ========================================== */
:root {
    --bw-black: #111;
    --bw-white: #fff;
    --bw-gray-light: #f7f7f7;
    --bw-gray-border: #e5e5e5;
    --bw-gray-text: #666;
    --bw-gray-dark: #333;
    --bw-danger: #dc2626;
    --radius-sm: 6px;
    --radius-md: 8px;
}

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--bw-gray-light);
    color: var(--bw-black);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px #fff inset !important;
}

/* ==========================================
   认证页面 (绝对居中 / 极简边框 / 微圆角)
   ========================================== */
.bw-auth-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;    /* 强制水平居中 */
    justify-content: center; /* 强制垂直居中 */
    background: var(--bw-gray-light);
    padding: 24px;
    box-sizing: border-box;
}
.bw-auth-box {
    width: 100%;
    max-width: 380px;
    background: var(--bw-white);
    padding: 40px 32px;
    border: 1px solid var(--bw-gray-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}
.bw-auth-header {
    margin-bottom: 32px;
    text-align: center;
}
.bw-auth-logo {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--bw-black);
    line-height: 1;
}
.bw-auth-sub {
    font-size: 13px;
    color: var(--bw-gray-text);
    margin-top: 6px;
    letter-spacing: 1px;
}
.bw-auth-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--bw-black);
    margin-bottom: 24px;
    text-align: center;
}
.bw-auth-link {
    text-align: center;
    font-size: 13px;
    color: var(--bw-gray-text);
    margin-top: 16px;
}

/* ==========================================
   布局结构 (Sider / Header)
   ========================================== */
.bw-sider {
    background: var(--bw-white) !important;
    border-right: 1px solid var(--bw-gray-border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
}
.bw-logo {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--bw-gray-border);
    color: var(--bw-black);
}
.bw-menu {
    border-right: 0 !important;
    padding-top: 12px;
    background: transparent !important;
}

/* 彻底解决菜单收缩时的文字遮挡、图标不居中问题 */
.bw-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 12px;
    flex-shrink: 0;
}
/* 1. 强制隐藏文字与箭头 */
.ant-layout-sider-collapsed .ant-menu-title-content {
    display: none !important;
}
.ant-layout-sider-collapsed .ant-menu-submenu-title .ant-menu-title-content,
.ant-layout-sider-collapsed .ant-menu-submenu-arrow {
    display: none !important;
}
/* 2. 重置 padding，让图标绝对居中 */
.ant-layout-sider-collapsed .bw-icon-wrapper {
    margin-right: 0 !important;
}
.ant-layout-sider-collapsed .ant-menu-item,
.ant-layout-sider-collapsed .ant-menu-submenu-title {
    padding: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    margin: 4px 0 !important; /* 取消左右 margin */
}

/* 顶栏 */
.bw-header {
    background: var(--bw-white);
    height: 60px;
    padding: 0 24px 0 16px;
    border-bottom: 1px solid var(--bw-gray-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}
.bw-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--bw-black);
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.bw-trigger:hover {
    background: var(--bw-gray-light);
}

/* 右上角用户下拉（微透视弥散阴影） */
.bw-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.bw-user:hover {
    background: var(--bw-gray-light);
}
.bw-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--bw-black);
    color: var(--bw-white);
    font-size: 13px;
    font-weight: bold;
    border-radius: var(--radius-sm);
}
.bw-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--bw-black);
}
.bw-user-down {
    display: flex;
    align-items: center;
    color: var(--bw-gray-text);
}
.bw-dropdown-menu {
    border: 1px solid var(--bw-gray-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08) !important;
}

.bw-content {
    padding: 32px;
    min-height: calc(100vh - 60px);
}

/* ==========================================
   页面通用元素 (Page / Panel / Stat Card)
   ========================================== */
.bw-page {
    max-width: 1200px;
}
.bw-page-header {
    margin-bottom: 24px;
}
.bw-page-title {
    font-size: 22px;
    font-weight: bold;
    color: var(--bw-black);
    margin: 0;
}

.bw-panel {
    background: var(--bw-white);
    border: 1px solid var(--bw-gray-border);
    border-radius: var(--radius-md);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.bw-panel-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--bw-black);
    margin-top: 0;
    margin-bottom: 24px;
}

/* 控制面板欢迎区 */
.bw-welcome {
    margin-bottom: 32px;
}
.bw-welcome-title {
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 8px 0;
}
.bw-welcome-sub {
    font-size: 14px;
    color: var(--bw-gray-text);
}
.bw-notice {
    background: var(--bw-white);
    border: 1px solid var(--bw-gray-border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 32px;
    font-size: 14px;
    font-weight: 500;
}
.bw-divider {
    color: #ccc;
    margin: 0 8px;
}

/* 统计卡片：微圆角 */
.bw-stat-card {
    background: var(--bw-white);
    border: 1px solid var(--bw-gray-border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.bw-stat-title {
    font-size: 13px;
    color: var(--bw-gray-text);
    margin-bottom: 12px;
}
.bw-stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--bw-black);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

/* 定价卡 */
.bw-pricing-card {
    background: var(--bw-white);
    border: 1px solid var(--bw-gray-border);
    border-radius: var(--radius-md);
    padding: 32px 24px;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.bw-pricing-card:hover {
    border-color: var(--bw-black);
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
}
.bw-pricing-name {
    font-size: 16px;
    font-weight: bold;
    color: var(--bw-black);
}
.bw-pricing-price {
    font-size: 40px;
    font-weight: bold;
    color: var(--bw-black);
    margin: 20px 0;
    font-variant-numeric: tabular-nums;
}
.bw-pricing-price span {
    font-size: 20px;
    margin-right: 4px;
}
.bw-pricing-quota {
    font-size: 14px;
    font-weight: bold;
    color: var(--bw-black);
    margin-bottom: 8px;
}
.bw-pricing-desc {
    color: var(--bw-gray-text);
    font-size: 13px;
    min-height: 40px;
    margin-bottom: 24px;
    line-height: 1.5;
}
.bw-empty {
    text-align: center;
    padding: 60px 0;
    color: #999;
    border: 1px dashed var(--bw-gray-border);
    border-radius: var(--radius-md);
    font-size: 14px;
}

/* ==========================================
   组件定制 (Form / Button / Input)
   ========================================== */
.bw-form .ant-form-item { margin-bottom: 24px; }
.bw-label {
    font-size: 13px;
    font-weight: bold;
    color: var(--bw-black);
    margin-bottom: 8px;
}
.bw-link { color: var(--bw-black); text-decoration: underline; cursor: pointer; font-weight: 500; }
.bw-link:hover { color: var(--bw-gray-text); }

/* 覆盖 Antd：抹除发光，采用黑边框，加微圆角 */
.ant-input, .ant-input-affix-wrapper, .ant-input-number, .ant-select-selector, .ant-input-search .ant-input {
    border-radius: var(--radius-sm) !important;
    border-color: #d9d9d9 !important;
    box-shadow: none !important;
}
.ant-input:focus, .ant-input-focused, 
.ant-input-affix-wrapper:focus, .ant-input-affix-wrapper-focused,
.ant-input-number:focus, .ant-input-number-focused,
.ant-select-focused .ant-select-selector {
    border-color: var(--bw-black) !important;
    box-shadow: 0 0 0 1px var(--bw-black) !important;
}
.ant-input-affix-wrapper:focus-within {
    border-color: var(--bw-black) !important;
    box-shadow: 0 0 0 1px var(--bw-black) !important;
}

/* 按钮 */
.ant-btn {
    border-radius: var(--radius-sm) !important;
    box-shadow: none !important;
    font-weight: 600;
}
.bw-btn-black {
    background-color: var(--bw-black) !important;
    border-color: var(--bw-black) !important;
    color: var(--bw-white) !important;
}
.bw-btn-black:hover, .bw-btn-black:focus, .bw-btn-black:active {
    background-color: var(--bw-gray-dark) !important;
    border-color: var(--bw-gray-dark) !important;
    color: var(--bw-white) !important;
}
.bw-btn-outline {
    background-color: var(--bw-white) !important;
    border-color: var(--bw-gray-border) !important;
    color: var(--bw-black) !important;
}
.bw-btn-outline:hover {
    border-color: var(--bw-black) !important;
}
.ant-modal-content {
    border-radius: var(--radius-md) !important;
    padding: 24px !important;
}

/* ==========================================
   表格
   ========================================== */
.bw-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}
.bw-toolbar-left, .bw-toolbar-right { display: flex; gap: 12px; flex-wrap: wrap; }

.bw-table-box {
    background: var(--bw-white);
    border: 1px solid var(--bw-gray-border);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    overflow: hidden;
}
.bw-table .ant-table {
    border-radius: 0;
    font-size: 13px;
    color: var(--bw-black);
}
.bw-table .ant-table-thead > tr > th {
    background: var(--bw-gray-light) !important;
    color: var(--bw-gray-text);
    font-weight: bold;
    border-bottom: 1px solid var(--bw-gray-border);
}
.bw-table .ant-table-tbody > tr > td {
    border-bottom: 1px solid var(--bw-gray-border);
    word-break: break-all; /* 防止表格内长文本溢出 */
}
.bw-table .ant-table-tbody > tr:hover > td {
    background: var(--bw-gray-light) !important;
}
.ant-table-wrapper .ant-table-pagination.ant-pagination {
    margin: 20px;
}

/* ==========================================
   信息列表 (Descriptions)
   ========================================== */
.bw-desc-list { display: flex; flex-direction: column; }
.bw-desc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--bw-gray-border);
    font-size: 14px;
}
.bw-desc-item span:first-child { color: var(--bw-gray-text); flex-shrink: 0; padding-right: 16px; }
.bw-desc-item span:last-child { color: var(--bw-black); font-weight: bold; text-align: right; }

/* ==========================================
   代码块
   ========================================== */
.bw-code {
    background: var(--bw-gray-light);
    color: var(--bw-black);
    font-family: monospace;
    padding: 2px 6px;
    font-size: 13px;
    border: 1px solid var(--bw-gray-border);
    border-radius: 4px;
    word-break: break-all;
}
pre {
    background: var(--bw-gray-light);
    border: 1px solid var(--bw-gray-border);
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    color: var(--bw-black);
    border-radius: var(--radius-md);
}
pre code { background: transparent; padding: 0; border: none; }

/* ==========================================
   工单聊天框
   ========================================== */
.bw-chat {
    max-height: 400px;
    overflow-y: auto;
    background: var(--bw-gray-light);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--bw-gray-border);
    border-radius: var(--radius-md);
}
.bw-chat-bubble {
    display: inline-block;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.6;
    max-width: 85%;
    word-break: break-word;
    border-radius: var(--radius-sm);
}
.bw-chat-bubble.left {
    background: var(--bw-white);
    color: var(--bw-black);
    border: 1px solid var(--bw-gray-border);
}
.bw-chat-bubble.right {
    background: var(--bw-black);
    color: var(--bw-white);
}

/* ==========================================
   菜单覆盖 (纯黑选中态)
   ========================================== */
.bw-menu .ant-menu-item,
.bw-menu .ant-menu-submenu-title {
    border-radius: var(--radius-sm) !important;
    margin: 4px 12px !important;
    width: calc(100% - 24px) !important;
    color: var(--bw-gray-text);
    font-weight: bold;
}
.bw-menu.ant-menu-light .ant-menu-item-selected {
    background: var(--bw-black) !important;
    color: var(--bw-white) !important;
}
.bw-menu.ant-menu-light .ant-menu-item:hover,
.bw-menu.ant-menu-light .ant-menu-submenu-title:hover {
    color: var(--bw-black);
}
/* 隐藏无用的悬浮灰底 */
.ant-menu-item-active { background: transparent !important; }

/* ==========================================
   响应式调整
   ========================================== */
@media (max-width: 768px) {
    .bw-content { padding: 16px; }
    .bw-header { padding: 0 12px; height: 56px; }
    
    .bw-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
    .bw-toolbar-left > div, .bw-toolbar-left > input, .bw-toolbar-left > span,
    .bw-toolbar-right > button {
        width: 100% !important;
    }
    
    /* 登录框适配小屏幕 */
    .bw-auth-box { 
        padding: 32px 24px; 
        border-radius: var(--radius-md);
    }
    .bw-auth-wrapper {
        padding: 16px;
    }
    
    .ant-modal { max-width: calc(100vw - 24px) !important; margin: 12px auto !important; }
}

@media (max-width: 480px) {
    .bw-pricing-price { font-size: 32px; }
    .bw-page-title { font-size: 20px; }
    .bw-welcome-title { font-size: 22px; }
    .bw-stat-value { font-size: 28px; }
}