/* ============================================================
 *  main.php 专属样式（北单首页）
 *  依赖：public/css/style.css 已先加载
 * ============================================================ */

/* ============================================================
 *  一、搜索框
 * ============================================================ */
.bd-search-box {
    display: flex !important;
    align-items: center;
    background: #fff;
    margin: 10px 12px 0;
    padding: 10px 14px;
    border-radius: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    height: auto !important;
    min-height: 40px;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative;
    z-index: 1;
    overflow: visible;
}
.bd-search-icon {
    font-size: 16px;
    color: #999;
    margin-right: 6px;
}
.bd-search-box input {
    display: block !important;
    flex: 1;
    border: none !important;
    outline: none !important;
    font-size: 14px;
    background: transparent !important;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    visibility: visible !important;
    opacity: 1 !important;
    color: #333;
}
#bdSearchClearBtn {
    display: none;
    background: none;
    border: none;
    font-size: 16px;
    color: #999;
    cursor: pointer;
    padding: 0 6px;
}
#bdSearchCount {
    font-size: 12px;
    color: #999;
    margin-left: 6px;
    white-space: nowrap;
}

/* ============================================================
 *  二、用户选择率条（胜平负三色条）
 * ============================================================ */

/* 🚀 隐藏所有玩法内部克隆生成的支持率条，保证只在顶部胜平负区域显示 */
.match-card:has(.grid-4) > .support-bar,
.match-card:has(.grid-3) > .support-bar,
.match-card:has(.jq-grid) > .support-bar,
.match-card:has(.odds-hda.odds-2col) > .support-bar {
    display: none !important;
}

/* ===== 用户选择率条（只保留百分比，极致小巧） ===== */
.support-bar {
    display: flex;
    height: 6px;
    width: 90%;
    margin: 0 auto 6px !important;
    border-radius: 7px;
    overflow: hidden;
    background: #eef1f4;
    font-size: 9px;
    font-weight: 600;
    color: #fff;
    line-height: 14px;
    transition: opacity 0.2s ease;
}

.unlock-qr-top {
    margin: 0 0 20px 0;
    text-align: center;
}
.unlock-qr-top img {
    width: 150px;
    height: 150px;
    border-radius: 8px;
    border: 1px solid #ddd;
    display: inline-block;
}
.unlock-qr-tip {
    font-size: 13px;
    color: #888;
    margin-top: 8px;
}

/* 隐藏"胜 / 平 / 负"标签 */
.support-seg .seg-label {
    display: none !important;
}

.support-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.35s ease;
    overflow: hidden;
    white-space: nowrap;
    cursor: default;
}

.support-seg .seg-pct {
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
}

/* 颜色 */
.support-seg.seg-win  { background: #e74c3c; }  /* 胜 - 红 */
.support-seg.seg-draw { background: #f39c12; }  /* 平 - 橙 */
.support-seg.seg-lose { background: #27ae60; }  /* 负 - 绿 */

/* 📱 手机端适配 */
@media (max-width: 600px) {
    .support-bar {
        height: 6px;
        width: 90%;
        margin: 0 auto 5px !important;
        font-size: 3px;
        line-height: 12px;
        border-radius: 6px;
    }
    .support-seg .seg-pct {
        font-size: 6px;
    }
}

/* ============================================================
 *  三、对阵行 + 让球徽章
 * ============================================================ */
.mc-handicap {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-right: 4px;
    flex-shrink: 0;
}
.mc-handicap .hc-badge {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 700;
    line-height: 1.5;
    color: #fff;
    display: inline-block;
    vertical-align: middle;
}

.match-teams {
    font-size: 17px;
    font-weight: 600;
    color: #1a2332;
    text-align: center;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.match-teams .home-name,
.match-teams .away-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40%;
}
.match-teams .vs {
    color: #ccc;
    font-weight: 400;
    font-size: 12px;
    margin: 0 2px;
    flex-shrink: 0;
}

/* 胜负过关 2 列 */
.match-body .odds-hda.odds-2col {
    grid-template-columns: 1fr 1fr;
}

/* 搜索隐藏 */
.match-card.bd-hidden {
    display: none !important;
}

/* ============================================================
 *  四、卡片容器
 * ============================================================ */
.match-card {
    background: #fff;
    margin: 8px 12px;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.match-header {
    padding: 10px 14px 8px;
    cursor: pointer;
    user-select: none;
}

/* 第一行：联赛 | 时间 + 状态 */
.mc-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.mc-top-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}
.mc-top-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.league-name {
    font-size: 13px;
    color: #888;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.match-date {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
}
.match-time-display {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
}

/* 第二行：场次号 + 对阵 */
.mc-teams-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 2px 0 4px;
}
.match-num {
    background: #152f52;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    line-height: 1.5;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

/* ============================================================
 *  五、状态徽章 / 状态文字
 * ============================================================ */
.match-status-block {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.match-status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
    line-height: 1.6;
    display: inline-block;
}
.match-status-badge.selling {
    color: #27ae60;
    background: #eafaf1;
}
.match-status-badge.stopped {
    color: #e67e22;
    background: #fdf2e3;
}
.match-status-badge.stopped-sale {
    color: #95a5a6;
    background: #eef1f4;
}

.match-status-text {
    font-size: 13px;
    font-weight: 600;
    color: #e74c3c;
}
.match-status-text.finished {
    color: #27ae60;
}
.match-score {
    font-size: 15px;
    font-weight: 700;
    margin-left: 6px;
}
.match-score.finished {
    color: #27ae60;
}

/* ============================================================
 *  六、直播按钮
 * ============================================================ */
.live-badge {
    display: inline-flex;
    align-items: center;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.5;
    flex-shrink: 0;
    white-space: nowrap;
}
.live-badge:active {
    opacity: 0.7;
}

/* ============================================================
 *  七、赔率区（main.js 注入）
 * ============================================================ */
.match-body {
    padding: 0 14px 14px;
    background: #fff;
}
.match-body.collapsed {
    display: none;
}

/* 胜平负 / 让球胜平负：3 列 */
.match-body .odds-hda {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    align-items: stretch;
}
.match-body .odds-hda .hda-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 0;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.match-body .odds-hda .hda-item .label {
    font-size: 12px;
    color: #888;
    line-height: 1.2;
}
.match-body .odds-hda .hda-item .value {
    font-size: 16px;
    font-weight: 700;
    color: #e74c3c;
    line-height: 1.3;
}
.match-body .odds-hda .hda-item .value.draw {
    color: #f39c12;
}
.match-body .odds-hda .hda-item:active {
    transform: scale(0.97);
}
.match-body .odds-hda .hda-item.selected {
    background: #e8f0fb;
    border-color: #152f52;
}

/* 比分 / 半全场 */
.match-body .grid-4,
.match-body .grid-3 {
    display: grid;
    gap: 6px;
    margin-bottom: 8px;
}
.match-body .grid-4 { grid-template-columns: repeat(5, 1fr); }
.match-body .grid-3 { grid-template-columns: repeat(3, 1fr); }
.match-body .grid-item {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 6px 2px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    border: 2px solid transparent;
}
.match-body .grid-item .label {
    font-size: 13px;
    color: #333;
    line-height: 1.3;
}
.match-body .grid-item .odds {
    font-size: 12px;
    font-weight: 700;
    color: #e74c3c;
    line-height: 1.3;
}
.match-body .grid-item:active {
    transform: scale(0.96);
}
.match-body .grid-item.selected {
    background: #e8f0fb;
    border-color: #152f52;
}

/* 总进球 */
.match-body .jq-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.match-body .odds-tag {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.match-body .odds-tag .label-text {
    font-size: 12px;
    color: #666;
    line-height: 1.2;
}
.match-body .odds-tag .val {
    font-size: 15px;
    font-weight: 700;
    color: #e74c3c;
    line-height: 1.2;
}
.match-body .odds-tag:active {
    transform: scale(0.96);
}
.match-body .odds-tag.selected {
    background: #e8f0fb;
    border-color: #152f52;
}

/* 分区标题 */
.match-body .section-title {
    font-size: 12px;
    font-weight: 600;
    color: #152f52;
    margin: 6px 0 4px;
    padding-left: 2px;
}

/* ============================================================
 *  八、展开/收起箭头
 * ============================================================ */
.match-arrow {
    display: none;
}

/* ============================================================
 *  九、日期组按钮
 * ============================================================ */
.toggle-finished-btn {
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 2px 14px;
    font-size: 13px;
    cursor: pointer;
    margin-left: 12px;
    transition: background 0.2s;
}
.toggle-finished-btn:hover {
    background: #2980b9;
}
.toggle-finished-btn:active {
    transform: scale(0.95);
}

/* ============================================================
 *  十、全屏视频遮罩
 * ============================================================ */
.live-video-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 99999;
    justify-content: center;
    align-items: center;
}
.live-video-overlay.show {
    display: flex;
}
.live-video-overlay .close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 48px;
    color: #fff;
    cursor: pointer;
    z-index: 100000;
    font-weight: 300;
}
.live-video-wrapper {
    width: 92vw;
    max-width: 1300px;
    height: 78vh;
    overflow: hidden;
    position: relative;
    border-radius: 16px;
    background: #000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
.live-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================================
 *  十一、解锁弹窗内嵌内容
 * ============================================================ */
.hidden-area {
    display: none;
}

.qr-code-block {
    text-align: center;
}
.qr-code-img {
    width: 150px;
    height: 150px;
    border-radius: 8px;
    border: 1px solid #ddd;
}
.qr-code-hint {
    font-size: 14px;
    color: #555;
    margin: 8px 0;
}

.qr-password-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}
.qr-password-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    flex: 1;
    max-width: 200px;
}
.btn-confirm {
    background: #152f52;
    color: #fff;
    padding: 8px 20px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
}
.qr-cancel-row {
    text-align: center;
    margin-top: 8px;
}
.btn-cancel {
    background: #eef1f4;
    border: none;
    padding: 6px 18px;
    border-radius: 30px;
    cursor: pointer;
}

#adDisplay {
    margin-top: 15px;
    border-radius: 12px;
    overflow: hidden;
    background: #1a2332;
    position: relative;
}
.ad-img {
    width: 100%;
    display: block;
    height: auto;
    border-radius: 12px;
}

#adCountdown {
    margin-top: 12px;
    font-size: 18px;
    font-weight: 600;
    color: #152f52;
    background: #f0f2f5;
    padding: 10px 0;
    border-radius: 30px;
    text-align: center;
}

/* ============================================================
 *  十二、手机适配
 * ============================================================ */
@media (max-width: 600px) {
    .match-card { margin: 6px 8px; }
    .match-header { padding: 8px 12px 6px; }
    .match-teams { font-size: 15px; }
    .match-num { font-size: 10px; padding: 1px 7px; }
    .match-body { padding: 0 12px 12px; }
    .match-body .odds-hda .hda-item .value { font-size: 15px; }
    .match-body .grid-4 { grid-template-columns: repeat(4, 1fr); }
    .match-body .jq-grid { grid-template-columns: repeat(4, 1fr); }
    .live-video-wrapper { width: 98vw; height: 55vh; }
    .toggle-finished-btn { font-size: 11px; padding: 1px 10px; margin-left: 6px; }
}

/* 计算器小屏兼容 */
@media screen and (max-width: 600px) {
    .calc-row {
        flex-wrap: wrap !important;
        justify-content: space-between !important;
    }
    .calc-row .btn {
        flex: 1 1 auto !important;
        min-width: 60px !important;
        padding: 6px 10px !important;
        font-size: 14px !important;
        margin: 2px !important;
    }
    .calc-odds-display {
        flex: 0 1 auto !important;
        min-width: 70px !important;
        margin-right: 4px !important;
    }
    .calc-input-group input {
        width: 60px !important;
        font-size: 16px !important;
    }
}