/* =========================================
   modals.css - 弹窗系统（最终变量版）
   ========================================= */

/* ===== 1. 基础弹窗覆盖层 ===== */
.modal-overlay, 
#auth-overlay, 
.card-picker-overlay,
#dialog-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); /* 保持半透明黑 */
    z-index: 30000;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.modal-overlay.visible, 
.card-picker-overlay.visible,
#dialog-overlay.visible {
    display: flex;
}

#dialog-overlay {
    backdrop-filter: blur(4px);
    z-index: 100000;
}

/* ===== 2. 通用弹窗内容结构 ===== */
.modal-content {
    background: var(--bg-body); /* 使用变量 */
    width: 95%;
    max-width: 550px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border: 1px solid #4a637a;
}

.modal-header {
    background: var(--bg-input);
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #4a637a;
}

.modal-body {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
}

/* ===== 3. Session 弹窗 (资金记录) ===== */
.session-modal-card {
    background: var(--bg-dark);
    width: 85%;
    max-width: 360px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--primary-color); /* 黄色边框 */
    box-shadow: var(--shadow-card);
    overflow: hidden;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
}

.session-header {
    padding: 15px;
    background: rgba(241, 196, 15, 0.1);
    border-bottom: 1px solid rgba(241, 196, 15, 0.2);
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}

.session-title {
    margin: 0; 
    color: var(--primary-color); 
    font-size: 16px;
}

.session-close-btn {
    background: transparent; 
    border: none; 
    color: var(--text-dim); 
    font-size: 20px; 
    cursor: pointer;
}

.session-body {
    padding: 20px; 
    display: flex; 
    flex-direction: column; 
    gap: 15px;
}

/* 表单布局 */
.form-row-dual { display: flex; gap: 10px; }
.form-group { flex: 1; }
.form-label { display: block; color: var(--text-dim); font-size: 10px; margin-bottom: 4px; }

/* 表单输入框 */
.form-input {
    width: 100%; 
    background: var(--bg-body); 
    border: 1px solid #34495e; 
    color: var(--text-light); 
    padding: 8px; 
    border-radius: 6px; 
    font-size: 13px; 
    box-sizing: border-box;
    outline: none;
}
.form-input:focus { border-color: var(--primary-color); }

.highlight-duration { color: var(--primary-color); font-weight: bold; }
.highlight-profit { color: var(--accent-green); font-weight: bold; }

/* 底部按钮 */
.session-actions { display: flex; gap: 10px; margin-top: 10px; }

.btn-session-cancel {
    flex: 1; padding: 12px; background: transparent; border: 1px solid #34495e; 
    color: var(--text-dim); border-radius: 6px; font-weight: bold; cursor: pointer;
}

.btn-session-save {
    flex: 1; padding: 12px; background: var(--primary-color); border: none; 
    color: #000; border-radius: 6px; font-weight: bold; cursor: pointer; 
    box-shadow: var(--shadow-glow);
}

/* ===== 4. 玩家详情弹窗 (Player Details) ===== */
.player-modal-card { max-width: 350px; }
.player-modal-title { margin: 0; color: var(--accent-green); }
.player-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===== 5. 玩家选择器 (Selector) ===== */
.selector-card {
    max-width: 320px;
    height: 70vh;
    display: flex;
    flex-direction: column;
}

.selector-title { margin: 0; color: var(--accent-blue); font-size: 16px; }
.selector-close-btn { background: transparent; border: none; color: var(--text-dim); font-size: 20px; cursor: pointer; }

.selector-list-container {
    list-style: none; padding: 0; margin-top: 10px; 
    overflow-y: auto; flex: 1;
}

.selector-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer; transition: background 0.2s;
}
.selector-item:hover { background: rgba(255,255,255,0.05); }

.sel-name { color: var(--text-light); font-weight: bold; font-size: 14px; }
.sel-tag {
    padding: 2px 8px; border-radius: 4px; font-size: 10px; 
    font-weight: 800; text-transform: uppercase; color: #000;
}

/* ===== 6. 设置弹窗 (Settings) ===== */
.settings-modal-card { max-width: 400px; }
.settings-title { margin: 0; color: var(--text-dim); }
.settings-separator { border: 0; border-top: 1px solid #444; margin: 15px 0; }
.settings-group-label { font-size: 0.75em; color: var(--text-dim); margin-bottom: 4px; margin-top: 8px; }
.settings-actions-right { margin-top: 8px; text-align: right; }
.settings-grid-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn-backup-highlight { border-color: var(--primary-color) !important; color: var(--primary-color) !important; }
.btn-settings-cancel { background-color: var(--text-dim) !important; color: white !important; border: none !important; }
.btn-settings-save { background: linear-gradient(135deg, #e67e22, #d35400) !important; }

/* ===== 7. 认证框 & 其他 ===== */
.auth-box {
    background: var(--bg-body); padding: 30px; border-radius: var(--radius-lg);
    width: 80%; max-width: 320px; box-shadow: var(--shadow-card); text-align: center; border: 1px solid #555;
}
.auth-hidden-group { display: none; }
.auth-input {
    width: 100%; padding: 12px; margin: 8px 0; background: var(--bg-input);
    border: 1px solid #555; border-radius: 6px; color: white; box-sizing: border-box;
}
.btn-auth {
    width: 100%; padding: 12px; margin-top: 15px; background: var(--accent-green);
    color: var(--bg-body); border: none; border-radius: 6px; font-weight: 800; cursor: pointer;
}

/* 按钮容器 */
.modal-footer-buttons {
    display: flex !important; gap: 10px !important; margin-top: 25px !important;
    padding-top: 20px !important; border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}
.modal-footer-group {
    display: flex; gap: 12px; margin-top: 20px; padding-top: 15px; border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== 8. 注额助手与动画 (保留原样) ===== */
.bet-assist-popup {
    position: fixed; background: rgba(20, 25, 35, 0.85); backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1); padding: 8px; border-radius: 12px;
    display: none; grid-template-columns: repeat(3, 1fr); gap: 6px; z-index: 10000;
    width: 200px; transition: all 0.2s; opacity: 0; visibility: hidden; transform: translateY(10px) scale(0.95);
}
.bet-assist-popup.visible { display: grid; opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.btn-assist-chip {
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px; padding: 8px 0; cursor: pointer; text-align: center;
}
.btn-assist-chip span { color: #fff; font-weight: 700; font-size: 16px; }

/* 日期输入框特殊修复 */
#sess-date::-webkit-calendar-picker-indicator { display: none !important; opacity: 0; }
#sess-date { text-align: center; font-weight: bold; position: relative; }
#sess-date:hover { cursor: pointer; }
/* =========================================
   补丁：Session Modal 遮罩层修复
   ========================================= */

/* 1. 默认隐藏，固定定位 */
.session-modal-overlay {
    display: none; /* 关键：默认不显示 */
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000; /* 确保在最上层 */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

/* 2. JS 激活时的显示状态 */
.session-modal-overlay.visible {
    display: flex !important;
}
/* css/components/modals.css */

.modal-footer-buttons {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #18181b;
}

.modal-btn-close {
    flex: 1;
    background: #52525b; /* 灰色 */
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 0;
    font-weight: 700;
}

.modal-btn-copy {
    flex: 1.2;
    background: #f1c40f; /* 黄色 */
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 10px 0;
    font-weight: 700;
}

.modal-btn-save {
    flex: 1.5;
    background: #10b981; /* 绿色 */
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 0;
    font-weight: 700;
}
/* 确保这一段在 modals.css 里 */
#preview-img-target {
    width: 100% !important; /* 宽度填满弹窗 */
    height: auto !important;
    display: block;
    border-radius: 8px; /* 给图片本身也加点圆角 */
}
/* =========================================
   预览弹窗 UI - 自适应高度 + 扁平化修复版 (V12)
   ========================================= */

/* 1. 容器位置 & 尺寸 */
#main-modal .preview-content {
    position: absolute;
    left: 50%;
     transform: translate(-50%, -50%);
     top: 50%; 
    width: 95%;
    max-width: 600px;
    
    /* 🔥 核心修复：高度改为 auto，让弹窗紧紧包裹图片 */
    height: auto !important; 
    /* 限制最大高度，防止超长图溢出屏幕，内部会自动滚动 */
    max-height: 85vh !important; 
    
    background: #0f172a; /* 深蓝背景 */
    border-radius: 16px;
    border: 1px solid #334155;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 2. 内容区域 (图片容器) */
#main-modal .modal-body {
    flex: 1 1 auto; /* 允许伸缩 */
    overflow-y: auto;
    padding: 0;
    scrollbar-width: none; /* 隐藏滚动条 */
    
    /* 让图片居中 */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #0f172a; 
}

/* 确保生成的图片撑满宽度，且没有奇怪的间隙 */
#main-modal .modal-body img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* 3. 底部工具栏 (扁平化核心) */
#main-modal .modal-footer {
    flex-shrink: 0; /* 防止被压缩 */
    padding: 12px 16px;
    background: #1e293b;
    border-top: 1px solid #334155;
    display: flex;
    gap: 12px;
}

/* 4. 扁平按钮样式 */
#main-modal .preview-btn {
    flex: 1;
    height: 48px;
    border-radius: 8px; /* 小圆角，更商务 */
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    
    /* Flex 居中 */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    
    /* 默认：透明背景 (扁平风格) */
    background: transparent;
}

/* Close (灰色系) */
#btn-preview-close { 
    color: #94a3b8;
    border-color: #334155;
}
#btn-preview-close:active { background: #334155; color: #fff; }

/* Copy (金色系) */
#btn-preview-copy { 
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.05);
}
#btn-preview-copy:active { background: rgba(245, 158, 11, 0.2); }

/* Save (绿色系 - 强调色) */
#btn-preview-save { 
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}
#btn-preview-save:active { background: rgba(16, 185, 129, 0.2); }

/* =========================================
   笔记弹窗专用样式 (保持不变)
   ========================================= */
#note-input-modal textarea {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #e6edf3;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
}
#note-input-modal textarea:focus {
    border-color: #38bdf8;
    outline: none;
}
/* 扁平按钮区域 */
.modal-footer-flat {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* 扁平按钮样式 */
.preview-btn-flat {
    flex: 1;
    height: 32px; /* 更矮 */
    border-radius: 4px; /* 更方 */
    font-size: 12px; /* 更小 */
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
    color: #cbd5e1;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.2s;
}

.preview-btn-flat:hover {
    background: rgba(255,255,255,0.1);
}

