/* =========================================
   戰鬥公式頁面 (bInfoFormula.php)
   ========================================= */

/* --- 快速導航列 --- */
.formula-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.formula-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.88rem;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    color: #888;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.formula-nav-btn.active {
    color: #fff;
    background: rgba(251, 183, 80, 0.15);
    border-color: var(--primary-gold, #fbb750);
    cursor: pointer;
}

.formula-nav-btn.active:hover {
    background: rgba(251, 183, 80, 0.25);
    transform: translateY(-1px);
}

.formula-nav-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- 公式展示框 --- */
.formula-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px dashed rgba(251, 183, 80, 0.3);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
}

.formula-display {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.formula-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ddd;
    font-size: 0.9rem;
    transition: all 0.3s;
    min-width: 90px;
    text-align: center;
}

.formula-item:hover {
    background: rgba(251, 183, 80, 0.1);
    border-color: var(--primary-gold, #fbb750);
    transform: translateY(-3px);
}

.formula-item i {
    color: var(--primary-gold, #fbb750);
    font-size: 1.3rem;
}

.formula-op {
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--primary-gold, #fbb750);
    min-width: 25px;
    text-align: center;
}

.formula-note {
    margin-top: 15px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    color: #999;
    font-size: 0.85rem;
}

.formula-note i {
    color: var(--primary-gold, #fbb750);
    margin-right: 5px;
}

/* --- 傷害上下限卡片 --- */
.formula-limits {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.limit-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.limit-card.limit-max {
    border-left: 3px solid #ff4444;
}

.limit-card.limit-min {
    border-left: 3px solid #7fff00;
}

.limit-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.limit-max .limit-icon {
    background: rgba(255, 68, 68, 0.15);
    color: #ff4444;
}

.limit-min .limit-icon {
    background: rgba(127, 255, 0, 0.15);
    color: #7fff00;
}

.limit-info {
    display: flex;
    flex-direction: column;
}

.limit-label {
    font-size: 0.85rem;
    color: #aaa;
}

.limit-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
}

/* --- 子標題 --- */
.sub-section-title {
    color: var(--primary-gold, #fbb750);
    font-size: 1.05rem;
    margin: 25px 0 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sub-section-title i {
    margin-right: 6px;
}

/* --- STR/DEX 兩欄表格 --- */
.stat-tables-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.stat-table-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
}

.stat-table-header {
    padding: 12px 15px;
    font-weight: bold;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.str-header {
    background: linear-gradient(135deg, rgba(255, 68, 68, 0.2), rgba(255, 68, 68, 0.05));
    color: #ff6b6b;
    border-bottom: 1px solid rgba(255, 68, 68, 0.2);
}

.dex-header {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(76, 175, 80, 0.05));
    color: #81c784;
    border-bottom: 1px solid rgba(76, 175, 80, 0.2);
}

.stat-table-scroll {
    max-height: 420px;
    overflow-y: auto;
}

.stat-table-scroll::-webkit-scrollbar {
    width: 6px;
}

.stat-table-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.stat-table-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* --- 表格外框響應式 --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- 公式表格 --- */
.formula-table {
    width: 100%;
    min-width: 320px;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.formula-table th {
    background: rgba(255, 255, 255, 0.05);
    color: #ccc;
    padding: 10px 15px;
    text-align: center;
    font-weight: normal;
    position: sticky;
    top: 0;
    z-index: 1;
}

.formula-table td {
    padding: 8px 15px;
    text-align: center;
    color: #ddd;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.formula-table tbody tr:hover {
    background: rgba(251, 183, 80, 0.06);
}

/* --- 顏色 --- */
.text-red { color: #ff4444; }
.text-green { color: #7fff00; }
.text-yellow { color: #ffd700; }
.text-orange { color: #ff8c00; }
.text-gold { color: var(--primary-gold, #fbb750) !important; }

/* --- 骰子判定機制 --- */
.dice-mechanism {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dice-step {
    flex: 1;
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dice-label {
    font-size: 0.85rem;
    color: var(--primary-gold, #fbb750);
    font-weight: bold;
    margin-bottom: 8px;
}

.dice-formula {
    color: #ddd;
    font-size: 0.92rem;
    font-family: 'Consolas', 'Monaco', monospace;
    line-height: 1.6;
}

.dice-vs {
    font-size: 1.4rem;
    font-weight: bold;
    color: #ff4444;
    flex-shrink: 0;
}

/* --- 狀態標籤 --- */
.badge-ok {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    background: rgba(127, 255, 0, 0.12);
    color: #7fff00;
    border: 1px solid rgba(127, 255, 0, 0.2);
}

.badge-warn {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    background: rgba(255, 215, 0, 0.12);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.badge-danger {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    background: rgba(255, 140, 0, 0.12);
    color: #ff8c00;
    border: 1px solid rgba(255, 140, 0, 0.2);
}

.badge-critical {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    background: rgba(255, 68, 68, 0.15);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.25);
}

/* --- RWD 手機版 --- */
@media (max-width: 768px) {
    .formula-nav {
        gap: 6px;
        padding: 10px;
    }

    .formula-nav-btn {
        font-size: 0.8rem;
        padding: 5px 10px;
    }

    .formula-display {
        gap: 8px;
    }

    .formula-item {
        padding: 10px 12px;
        min-width: 70px;
        font-size: 0.82rem;
    }

    .formula-op {
        font-size: 1.2rem;
    }

    .formula-limits {
        grid-template-columns: 1fr;
    }

    .stat-tables-row {
        grid-template-columns: 1fr;
    }

    .limit-value {
        font-size: 1.2rem;
    }

    .dice-mechanism {
        flex-direction: column;
        gap: 10px;
    }

    .dice-vs {
        font-size: 1.1rem;
    }

    /* 表格手機版：橫向可滾動 */
    .formula-table {
        font-size: 0.85rem;
    }

    .formula-table th,
    .formula-table td {
        padding: 6px 10px;
        white-space: nowrap;
    }

    /* 素質表格手機版標題 */
    .stat-table-header {
        font-size: 0.88rem;
        padding: 10px 12px;
    }

    .stat-table-scroll {
        max-height: 320px;
    }

    /* 子標題手機版 */
    .sub-section-title {
        font-size: 0.95rem;
    }

    /* 公式框內文字 */
    .formula-note {
        font-size: 0.8rem;
    }

    /* BUFF 衝突表格手機版：允許文字換行 */
    .formula-table td {
        word-break: break-word;
        white-space: normal;
    }

    /* 手機版表格不要 nowrap */
    .formula-table th,
    .formula-table td {
        white-space: normal;
    }
}

/* 極小螢幕 */
@media (max-width: 480px) {
    .formula-nav-btn {
        font-size: 0.72rem;
        padding: 4px 8px;
    }

    .formula-item {
        padding: 8px 8px;
        min-width: 55px;
        font-size: 0.75rem;
    }

    .formula-item i {
        font-size: 1rem;
    }

    .formula-op {
        font-size: 1rem;
        min-width: 18px;
    }
}

/* =========================================
   裝備回魔表格的 icon + 連結
   ========================================= */
.mpr-icon {
    width: 26px;
    height: 26px;
    vertical-align: middle;
    margin-right: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.25);
    padding: 2px;
}
.mpr-equip-link {
    color: #e0e0e0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s;
}
.mpr-equip-link strong {
    border-bottom: 1px dashed rgba(77, 184, 255, 0.35);
    padding-bottom: 1px;
}
.mpr-equip-link:hover {
    color: #4db8ff;
}
.mpr-equip-link:hover strong {
    border-bottom-color: #4db8ff;
}
.formula-table .row-highlight {
    background: rgba(212, 175, 55, 0.1);
}
@media (max-width: 480px) {
    .mpr-icon {
        width: 22px;
        height: 22px;
        margin-right: 4px;
    }
}
