/* =========================================
   base.css - 基础样式系统（优化版）
   ========================================= */

/* ===== 1. CSS变量定义 ===== */
:root { 
    /* 颜色系统 */
    --color-primary-bg: #2c3e50;
    --color-secondary-bg: #34495e;
    --color-input-bg: #212f3d;
    --color-hero-highlight: #2ecc71;
    --color-villain-highlight: #e74c3c;
    --color-text-light: #ecf0f1;
    --color-text-dim: #bdc3c7;
    
    /* 尺寸系统 */
    --font-size-base: 16px;
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    
    /* 阴影系统 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* ===== 2. 基础重置 ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* 隐藏滚动条 */
::-webkit-scrollbar {
    display: none;
}

* {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ===== 3. 基础HTML元素样式 ===== */
html {
    font-size: var(--font-size-base);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--color-primary-bg);
    color: var(--color-text-light);
    margin: 0;
    padding: 8px;
    padding-bottom: 80px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== 4. 基础排版 ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.5em;
}

p {
    margin-bottom: 1em;
}

a {
    color: #3498db;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== 5. 全局按钮系统 ===== */
/* 5.1 按钮基础 */
button {
    font-family: inherit;
    font-size: inherit;
    border: none;
    background: none;
    cursor: pointer;
    outline: none;
    user-select: none;
}

/* 5.2 全局按钮容器 */
.modal-footer-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 5.3 取消按钮 */
.btn-global-cancel {
    flex: 1;
    height: 44px;
    background: transparent;
    border: 1px solid #576574;
    color: #95a5a6;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-global-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-global-cancel:active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* 5.4 保存按钮 */
.btn-global-save {
    flex: 2;
    height: 44px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(39, 174, 96, 0.3);
    transition: transform 0.1s;
}

.btn-global-save:hover {
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.btn-global-save:active {
    transform: scale(0.98);
}

/* 5.5 删除按钮基础样式 */
.btn-delete {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: rgba(231, 76, 60, 0.25);
}

.btn-delete:active {
    background: #e74c3c;
    color: white;
}

/* ===== 6. 表单基础样式 ===== */
input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background-color: var(--color-input-bg);
    border: 1px solid #34495e;
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #3498db;
}

input::placeholder,
textarea::placeholder {
    color: #7f8c8d;
}


/* ===== 8. 性能优化 ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/* ===== 6. 动画与交互 ===== */
@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.action-table tr.new-row {
    animation: fadeInRow 0.3s ease-out;
}

/* ===== 7. 性能优化 ===== */
@media (prefers-reduced-motion: reduce) {
    .btn-save-hand-full:active,
    .btn-assist-chip:active,
    .action-table tr.new-row {
        animation: none;
        transition: none;
        transform: none;
    }
}


.modal-btn-close:hover {
    background: rgba(241,196,15,0.9);
    color: #111;
}
/* 智能助手弹窗样式 */
.bet-assist-popup {
    position: absolute;
    z-index: 100000; /* 确保最顶层 */
    background: rgba(25, 25, 25, 0.98);
    border: 1px solid #555;
    border-radius: 6px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    min-width: 150px;
}

.bet-popup-title {
    font-size: 11px;
    color: #888;
    text-align: center;
    margin-bottom: 5px;
    font-weight: 600;
    text-transform: uppercase;
}

.bet-btn-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.bet-assist-btn {
    background: #3a3a3a;
    color: #eee;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    padding: 6px 0;
    font-size: 12px;
    cursor: pointer;
}

.bet-assist-btn:active {
    background: #e67e22;
    border-color: #e67e22;
}
/* 强制修正智能助手样式 */
.bet-assist-popup {
    /* 1. 强制可见性 */
    opacity: 1 !important;
    visibility: visible !important;
    display: none; /* 默认隐藏，JS 会改成 block */
    
    /* 2. 确保层级最高 */
    position: absolute;
    z-index: 2147483647 !important; /* CSS 允许的最大 z-index */
    
    /* 3. 外观样式 */
    background: rgba(25, 25, 25, 0.98);
    border: 1px solid #666;
    border-radius: 6px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    min-width: 150px;
    
    /* 4. 防止被父级样式污染 */
    transform: none !important;
    transition: none !important;
}

/* 加上这个类时显示 (JS 设置 display:block 也会生效，这个双保险) */
.bet-assist-popup[style*="display: block"] {
    opacity: 1 !important;
    visibility: visible !important;
}

/* 按钮样式保持不变 */
.bet-popup-title {
    font-size: 11px;
    color: #888;
    text-align: center;
    margin-bottom: 5px;
    font-weight: 600;
    text-transform: uppercase;
}

.bet-btn-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.bet-assist-btn {
    background: #3a3a3a;
    color: #eee;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    padding: 6px 0;
    font-size: 12px;
    cursor: pointer;
}

.bet-assist-btn:hover {
    background: #505050;
}
.bet-assist-btn:active {
    background: #e67e22;
}

