/* ================= Bankroll V14 (Cleaned & Optimized) ================= */

/* =========================================
   1. 顶部胶囊 & 列表基础样式
   ========================================= */
.br-summary-card { width: 100%; margin-bottom: 15px; }
.bankroll-calm-bar {
    background: rgba(56, 189, 248, 0.1); border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 12px; padding: 6px 12px;
    display: flex; justify-content: space-between; align-items: center;
}
.as-left { display: flex; align-items: center; gap: 8px; }
.as-dot-blue { width: 6px; height: 6px; background-color: #38bdf8; border-radius: 50%; opacity: 0.8; }
.as-label-blue { color: rgba(255, 255, 255, 0.9); font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; font-family: inherit; }
.as-right { display: flex; align-items: center; gap: 12px; }
.as-info { color: #f1c40f; font-size: 12px; font-weight: 700; font-family: inherit; letter-spacing: 0.5px; }
.as-profit-text { font-size: 12px; font-weight: 600; font-family: inherit; letter-spacing: 0.5px; }
.as-profit-text.positive { color: #4ade80; }
.as-profit-text.negative { color: #f87171; }
.as-profit-text.text-neutral { color: #94a3b8; }

/* 列表区域 */
.ledger-section { padding: 0 16px; }
.ledger-tabs-minimal {
    display: flex; gap: 20px; margin-bottom: 10px;
    border-bottom: 1px solid #1e293b; padding-bottom: 5px;
}
.tab-pill {
    background: none; border: none; color: #64748b;
    font-size: 11px; font-weight: 700; cursor: pointer;
    text-transform: uppercase; padding: 4px 0;
    transition: color 0.2s, border-bottom 0.2s;
}
.tab-pill#tab-sessions.active { color: #38bdf8; border-bottom: 2px solid #38bdf8; }
.tab-pill#tab-adjustments.active { color: #f1c40f; border-bottom: 2px solid #f1c40f; }
.ledger-list-compact { list-style: none; padding: 0; margin: 0; }
.ledger-item {
    display: flex; align-items: center; justify-content: space-between; 
    padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.03);
}
.l-date { font-size: 11px; color: #64748b; width: 45px; flex-shrink: 0; }
.l-info { flex-grow: 1; display: flex; gap: 24px; padding-left: 8px; align-items: center; flex-wrap: wrap; }
.l-amt { font-size: 13px; font-weight: 700; min-width: 70px; text-align: right; flex-shrink: 0; }
.l-amt.pos { color: #4ade80; }
.l-amt.neg { color: #f87171; }
.tag-stakes { font-size: 11px; font-weight: 700; color: #cbd5e1; background: rgba(255,255,255,0.05); padding: 2px 6px; border-radius: 4px; }
.tag-loc { font-size: 10px; background: rgba(56, 189, 248, 0.15); color: #38bdf8; padding: 2px 5px; border-radius: 4px; font-weight: 500; }
.tag-time { font-size: 10px; color: #64748b; margin-left: 8px; }
.btn-xs-view { font-size: 9px; padding: 2px 6px; background: none; border: 1px solid #334155; color: #64748b; border-radius: 4px; margin-left: 8px; }

/* =========================================
   2. FAB 按钮样式 (Smart FAB)
   ========================================= */
/* 修改 .br-btn-main：缩小视觉尺寸 */
.br-btn-main {
    /* 1. 视觉变小 (原本是 52px) */
    width: 40px !important; 
    height: 40px !important; 
    font-size: 20px; /* 图标文字也稍微调小 */
    
    /* 2. 保持原有样式 */
    border-radius: 50%;
    color: #fff; 
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); /* 阴影也稍微收敛一点 */
    cursor: pointer; 
    display: flex !important; 
    align-items: center; 
    justify-content: center;
    padding-bottom: 2px; /* 微调图标垂直居中 */
    transition: background 0.2s, transform 0.2s;

    /* 3. 关键设置：为扩大点击范围做准备 */
    position: relative; 
    overflow: visible; /* 必须允许子元素超出边界 */
}

/* 🔥 核心技巧：使用伪元素创建一个看不见的“大点击区” */
.br-btn-main::after {
    content: '';
    position: absolute;
    
    /* 向四周各延伸 15px */
    /* 最终点击热区大小 = 40px + 15px + 15px = 70px (比原来的 52px 还要大好按) */
    top: -15px;
    bottom: -15px;
    left: -15px;
    right: -15px;
    
    border-radius: 50%;
    z-index: 1; /* 确保它在最上层接收点击 */
    
    /* background: rgba(255, 0, 0, 0.3); */ /* ⚠️ 调试用：取消注释这行，你就能看到那个隐形的点击圈了 */
}

/* 点击反馈：缩小效果 */
.br-btn-main:active { 
    transform: scale(0.90); 
}

/* 颜色变体 (保持不变) */
.br-fab-container.sessions .br-btn-main { background: #38bdf8; } 
.br-fab-container.adjustments .br-btn-main { background: #f1c40f; } 
.br-fab-container.sessions .br-btn-main:hover { background: #60a5fa; box-shadow: 0 6px 16px rgba(56, 189, 248, 0.3); }
.br-fab-container.adjustments .br-btn-main:hover { background: #fbbf24; box-shadow: 0 6px 16px rgba(241, 196, 15, 0.3); }

/* =========================================
   3. Modal 核心样式 (New Compact Style)
   ========================================= */

/* 基础遮罩 (默认隐藏) */
#add-session-modal,
#adjust-bankroll-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10000; /* 高于页面 */
    backdrop-filter: blur(5px);
    background-color: rgba(0, 0, 0, 0.75);
    display: none; /* 默认关闭 */
    align-items: center; justify-content: center;
}

/* 显示状态 (JS 添加 .visible 类) */
#add-session-modal.visible,
#adjust-bankroll-modal.visible {
    display: flex !important;
    z-index: 10001 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* 卡片容器 */
.br-modal-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    width: 90%; max-width: 340px; max-height: 95vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    overflow: hidden;
}

/* 头部 */
.modal-header {
    padding: 12px 16px;
    background: #0d1117;
    border-bottom: 1px solid #30363d;
}
.player-modal-title span { font-size: 15px; color: #e6edf3; font-weight: 700; }

/* 主体 */
.compact-body {
    padding: 16px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 12px;
}
.form-row { display: flex; gap: 10px; }
.input-wrapper { display: flex; flex-direction: column; gap: 4px; }
.tiny-label { font-size: 10px; color: #8b949e; text-transform: uppercase; font-weight: 600; margin-left: 2px; }

/* 输入框 */
.compact-input, .compact-select {
    background: #0d1117; border: 1px solid #30363d; color: #c9d1d9;
    border-radius: 6px; height: 36px; padding: 0 10px;
    font-size: 14px; width: 100%;
}
.compact-input:focus, .compact-select:focus { border-color: #38bdf8; outline: none; }

/* =========================================
   4. ⚡️ 按钮布局优化 (强制并排 50/50)
   ========================================= */

/* 按钮行容器：去除 Padding，贴底 */
.br-modal-card .modal-actions-row {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border-top: 1px solid #30363d !important;
    background: #0d1117 !important;
}

/* 按钮本体：去除圆角，各占一半 */
.br-modal-card .modal-action-btn {
    flex: 1 !important;
    width: 50% !important;
    margin: 0 !important;
    padding: 16px 0 !important;
    border-radius: 0 !important;
    border: none !important;
    background: transparent !important;
    font-size: 14px !important; font-weight: 700 !important;
    text-transform: uppercase !important; cursor: pointer !important;
    box-shadow: none !important;
}

/* 中间分割线 */
.br-modal-card .modal-action-btn:first-child {
    border-right: 1px solid #30363d !important;
}

/* Cancel 按钮颜色 */
#btn-cancel-session, 
#btn-cancel-adjust {
    color: #8b949e !important;
}
#btn-cancel-session:active,
#btn-cancel-adjust:active {
    background: rgba(139, 148, 158, 0.1) !important;
}

/* Save Session (绿色) */
#btn-save-session { color: #2ecc71 !important; }
#btn-save-session:active { background: rgba(46, 204, 113, 0.1) !important; }

/* Confirm Adjust (金色) */
#btn-save-adjust { color: #f1c40f !important; }
#btn-save-adjust:active { background: rgba(241, 196, 15, 0.1) !important; }

/* =========================================
   5. 交互：弹窗开启时隐藏 FAB
   ========================================= */
body:has(#add-session-modal.visible) .br-fab-container, 
body:has(#adjust-bankroll-modal.visible) .br-fab-container,
body:has(#add-session-modal.visible) #br-fab-group,
body:has(#adjust-bankroll-modal.visible) #br-fab-group {
    display: none !important;
}
/* =========================================
   Type 下拉框移至头部专用样式
   ========================================= */

/* 头部布局：两端对齐 */
#add-session-modal .modal-header h3 {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100%;
}

/* 头部里的 Type 下拉框 */
.header-select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #38bdf8; /* 亮蓝色文字 */
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    outline: none;
    height: 28px; /* 限制高度 */
}

.header-select:focus {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}
/* =========================================
   🚑 布局溢出紧急修复补丁
   ========================================= */

/* 强制所有输入框使用 border-box，防止 padding 导致宽度撑破容器 */
.br-modal-card input, 
.br-modal-card select,
.input-wrapper {
    box-sizing: border-box !important;
    max-width: 100% !important;
}

/* 优化 Date 输入框在 iOS 上的显示 */
input[type="date"] {
    -webkit-appearance: none; /* 移除 iOS 默认的一层外观 */
    min-width: 0; /* 允许 flex 容器压缩它 */
}
/* 筛选控制栏容器 */
.filter-control-bar {
    margin: 20px 12px 0 12px; /* 保持左右边距与下方列表一致 */
}

/* 触发按钮 (看起来像个长条形胶囊) */
.btn-filter-trigger {
    width: 100%;
    background: #1e293b; /* 接近你的深色背景 */
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-filter-trigger:active {
    background: #334155;
}

.filter-icon { margin-right: 6px; }
.filter-arrow { font-size: 10px; opacity: 0.6; }

/* 下拉面板 */
.filter-panel {
    background: #1e293b;
    border: 1px solid #334155;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 12px;
    margin-top: -4px; /* 让它看起来是从按钮延伸出来的 */
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 筛选行 */
.filter-row {
    margin-bottom: 12px;
}

.filter-row label {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-bottom: 6px;
    text-transform: uppercase;
    font-weight: 700;
}

/* 选项芯片组 (Chips) */
.filter-chip-group {
    display: flex;
    gap: 8px;
}

.filter-chip {
    flex: 1;
    background: #0f172a;
    border: 1px solid #334155;
    color: #cbd5e1;
    padding: 6px 0;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.filter-chip.active {
    background: #3b82f6; /* 蓝色高亮，可根据主题色修改 */
    border-color: #3b82f6;
    color: #fff;
    font-weight: 600;
}

/* 应用按钮 */
.btn-apply-filters {
    width: 100%;
    background: #10b981; /* 绿色确认 */
    color: #fff;
    border: none;
    padding: 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}
/* =========================================
   整合的 Analytics & Chart (低对比度版)
   ========================================= */

/* 1. 统计胶囊 (Analytics) */
.tools-wide-capsule {
    /* 降低对比度：使用极淡的透明背景，而不是深色实心背景 */
    background: rgba(255, 255, 255, 0.02); 
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 10px 0; /* 上下间距 */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tools-capsule-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.tools-capsule-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tools-capsule-dot {
    width: 6px;
    height: 6px;
    background-color: #3498db;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(52, 152, 219, 0.4);
}

.tools-capsule-label {
    font-size: 10px;
    color: #64748b;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.tools-capsule-rate {
    font-family: 'Consolas', monospace;
    font-size: 14px;
    font-weight: 700;
    color: #e2e8f0;
}
.tools-capsule-rate.positive { color: #2ecc71; }
.tools-capsule-rate.negative { color: #e74c3c; }

/* 扁平统计行 */
.tools-flat-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tools-flat-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.tools-flat-label {
    font-size: 9px;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.tools-flat-value {
    font-family: 'DIN Alternate', 'Roboto', sans-serif; /* 保持数字字体一致 */
    font-size: 13px;
    color: #cbd5e1;
    font-weight: 600;
}

.tools-flat-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.05);
}

/* 2. 走势图区域 (Trend Chart) */
.tools-wide-trend {
    /* 降低对比度 */
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 15px;
}

.trend-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.trend-title {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    margin: 0;
}

.trend-subtitle {
    font-size: 9px;
    color: #475569;
    margin-top: 2px;
}

.trend-controls {
    display: flex;
    gap: 6px;
}

.btn-trend-toggle, .btn-trend-refresh {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    color: #64748b;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.btn-trend-toggle:active, .btn-trend-refresh:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.95);
}

.btn-trend-toggle.toggled-off {
    opacity: 0.6;
}

.trend-chart-wide-container {
    height: 140px; /* 控制图表高度 */
    width: 100%;
    position: relative;
}

.trend-empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    color: #475569;
    text-align: center;
    width: 80%;
}

/* 让输入框在视觉上也保持大写 */
#session-location {
    text-transform: uppercase;
}