/* css/market.css | v1.9.10 my_bid_daily_limit_invalidated_hint_20260707 */

.market-page {
    display: block;
    padding-right: 10px;
}

.market-type-tabs {
    width: 100%;
    margin: 8px 0 18px 0;
}

.market-type-tabs .bh-tabs {
    width: 100% !important;
    display: flex !important;
    overflow: visible !important;
}

.market-type-tabs .bh-tab {
    flex: 1 1 50% !important;
    width: 50% !important;
    min-width: 0 !important;
    max-width: none !important;
}

.market-main-card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    overflow: hidden;
    min-width: 0;
}

.market-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-wrap: wrap;
}

.market-status-inline {
    color: #6b7280;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
}

.market-status-inline.error {
    color: #b91c1c;
}

.market-status-inline.success {
    color: #047857;
}

.market-vip-badge {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: #fff7d6;
    color: #7c5200;
    border: 1px solid #f3d675;
    font-size: 12px;
    font-weight: 900;
}


/* VIP badge/panel hidden guard: class display rules must not override hidden attr */
.market-vip-badge[hidden],
.market-vip-filter-panel[hidden],
.market-vip-filter-body[hidden],
.market-vip-only-filter[hidden] {
    display: none !important;
}


.market-basic-age-filter[hidden],
#marketBasicFilterBtn[hidden] {
    display: none !important;
}

.market-filter-card {
    padding: 10px 12px 12px 12px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8faf8;
}

.market-basic-filter-row,
.market-vip-select-grid,
.market-filter-actions,
.market-pagination-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.market-filter-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
}

.market-filter-label {
    color: #064b12;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.market-filter-select {
    height: 30px;
    min-width: 96px;
    padding: 4px 28px 4px 12px;
    border: 1px solid #d9e2d6;
    border-radius: 5px;
    background: #fff;
    color: #064b12;
    font-size: 12px;
    font-weight: 800;
    outline: none;
}

.market-filter-select:focus {
    border-color: #065f46;
    box-shadow: 0 0 0 2px rgba(6, 95, 70, 0.14);
}

.market-action-btn,
.market-page-btn,
.market-filter-toggle-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    border-radius: 999px;
    min-height: 32px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
}

.market-primary-btn {
    background: rgb(5, 71, 0);
    color: #fff;
}

.market-primary-btn:hover {
    background: #064b12;
}

.market-secondary-btn,
.market-page-btn,
.market-filter-toggle-btn {
    background: #e9f2e6;
    color: #064b12;
    border: 1px solid #cfe0ca;
}

.market-secondary-btn:hover,
.market-page-btn:hover,
.market-filter-toggle-btn:hover {
    background: #dcebd7;
}

.market-action-btn:disabled,
.market-page-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.market-vip-filter-panel {
    margin-top: 10px;
    border: 1px solid #d9e2d6;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.market-vip-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: #f3f5f2;
    border-bottom: 1px solid #d9e2d6;
}

.market-vip-filter-title {
    color: #064b12;
    font-size: 14px;
    font-weight: 900;
}

.market-vip-filter-summary {
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
    margin-top: 2px;
}

.market-vip-filter-body {
    padding: 12px;
}

.market-vip-select-grid {
    margin-bottom: 10px;
}

.market-range-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.market-range-item {
    border: 1px solid #e3ebe0;
    border-radius: 8px;
    padding: 9px 10px;
    background: #fbfdfb;
}

.market-range-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #064b12;
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 8px;
}

.market-range-value {
    color: #334155;
    font-weight: 900;
    white-space: nowrap;
}

.market-dual-range {
    position: relative;
    height: 26px;
}

.market-dual-range input[type="range"] {
    position: absolute;
    left: 0;
    top: 4px;
    width: 100%;
    height: 18px;
    margin: 0;
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}

.market-dual-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: rgb(5, 71, 0);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
    cursor: pointer;
}

.market-dual-range input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: rgb(5, 71, 0);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
    cursor: pointer;
}

.market-range-track {
    position: absolute;
    left: 0;
    right: 0;
    top: 12px;
    height: 4px;
    border-radius: 999px;
    background: #d9e2d6;
}

.market-filter-actions {
    justify-content: flex-end;
    margin-top: 12px;
}

.market-table-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.market-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.market-table th,
.market-table td {
    white-space: nowrap;
    text-align: center;
}

.market-table th {
    background-color: rgb(5, 71, 0);
    color: white;
    padding: 11px 8px;
    font-size: 13px;
}

.market-table td {
    padding: 10px 8px;
    font-size: 13px;
    border-bottom: 1px solid #e5e7eb;
}

.market-table tbody tr:nth-child(even) td {
    background-color: #edf7ed;
}

.market-table tbody tr:hover td {
    background-color: #fff4d6;
}

.market-name-cell {
    text-align: left !important;
    padding-left: 14px !important;
    font-weight: 900;
    color: #064b12;
}

.market-skill-value-cell {
    min-width: 42px;
    color: #064b12;
    font-weight: 900;
}

.market-skill-value-cell.hidden-skill {
    color: #9ca3af;
    font-weight: 900;
}

.market-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    height: 24px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.market-status-open {
    background: #e8f3e5;
    color: #064b12;
}

.market-status-bidding {
    background: #fff7d6;
    color: #7c5200;
}

.market-bid-disabled-btn {
    border: 0;
    border-radius: 999px;
    background: #e5e7eb;
    color: #6b7280;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 900;
    cursor: not-allowed;
}

.market-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.72);
    color: #064b12;
    font-size: 14px;
    font-weight: 900;
}

.market-empty-row td {
    padding: 24px 12px !important;
    color: #6b7280;
    font-weight: 800;
}

.market-pagination-row {
    justify-content: center;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.market-page-info {
    color: #334155;
    font-size: 13px;
    font-weight: 900;
}

@media (max-width: 1180px) {
    .market-range-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .market-range-grid {
        grid-template-columns: 1fr;
    }

    .market-vip-filter-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .market-filter-toggle-btn {
        align-self: flex-end;
    }
}

/* ==========================================
   [MARKET ACTIONS] 操作欄：偵查報告 / 出價
   ========================================== */
.market-action-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.market-row-action-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid #cfe0ca;
    background: #ffffff;
    color: #064b12;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    line-height: 1;
}

.market-row-action-btn:hover {
    background: #e8f3e5;
    color: #043d0d;
}

.market-scout-report-btn.is-scouted {
    background: #fff7d6;
    color: #7c5200;
    border-color: #f3d675;
}

.market-bid-btn {
    background: rgb(5, 71, 0);
    color: #ffffff;
    border-color: rgb(5, 71, 0);
}

.market-bid-btn:hover {
    background: #064b12;
    color: #ffffff;
}

/* ==========================================
   [MARKET BID MODAL] 出價視窗骨架
   ========================================== */
body.market-modal-open {
    overflow: hidden;
}

.market-modal-backdrop[hidden] {
    display: none !important;
}

.market-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.38);
}

.market-modal {
    width: min(520px, 100%);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.22);
    overflow: hidden;
}

.market-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #f3f5f2;
    border-bottom: 1px solid #d9e2d6;
}

.market-modal-title {
    color: #064b12;
    font-size: 18px;
    font-weight: 900;
}

.market-modal-subtitle {
    margin-top: 4px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 800;
}

.market-modal-close-btn {
    appearance: none;
    -webkit-appearance: none;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    background: #e5e7eb;
    color: #111827;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}

.market-modal-close-btn:hover {
    background: #d1d5db;
}

.market-modal-body {
    padding: 16px;
}

.market-bid-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.market-bid-info-grid > div {
    border: 1px solid #e3ebe0;
    border-radius: 8px;
    padding: 9px 10px;
    background: #fbfdfb;
}

.market-bid-info-grid span {
    display: block;
    color: #6b7280;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 4px;
}

.market-bid-info-grid strong {
    display: block;
    color: #064b12;
    font-size: 13px;
    font-weight: 900;
}

.market-bid-field {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.market-bid-field span {
    color: #064b12;
    font-size: 12px;
    font-weight: 900;
}

.market-bid-field input,
.market-bid-field select {
    height: 36px;
    border: 1px solid #d9e2d6;
    border-radius: 8px;
    padding: 6px 10px;
    color: #111827;
    font-size: 14px;
    font-weight: 800;
    outline: none;
}

.market-bid-field input:focus,
.market-bid-field select:focus {
    border-color: #065f46;
    box-shadow: 0 0 0 2px rgba(6, 95, 70, 0.14);
}

.market-modal-note {
    margin-top: 12px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
}

.market-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px 16px;
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 640px) {
    .market-bid-info-grid {
        grid-template-columns: 1fr;
    }

    .market-action-group {
        flex-direction: column;
        align-items: stretch;
    }
}

/* v1.6 update_market_bid: active bid state remains clickable for modification */
.market-row-action-btn[disabled] {
    opacity: 0.62;
    cursor: not-allowed;
    pointer-events: none;
}

.market-bid-btn.is-bidded {
    background: #eef2f7;
    color: #064b12;
    border-color: #cfe0ca;
    cursor: pointer;
}

.market-bid-btn.is-bidded:hover {
    background: #e9f2e6;
}

.market-modal-note.error {
    background: #fff1f2;
    color: #b91c1c;
    border-color: #fecdd3;
}

.market-modal-note.success {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

/* v1.5.00 my_bid daily signed-limit preview invalidation */
.market-row-action-btn.is-my-bid-invalidated,
.market-row-action-btn.is-my-bid-invalidated[aria-disabled="true"] {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #d1d5db;
    cursor: default;
}

.market-row-action-btn.is-my-bid-invalidated:hover,
.market-row-action-btn.is-my-bid-invalidated:focus {
    background: #f3f4f6;
    color: #4b5563;
    border-color: #d1d5db;
    filter: brightness(0.98);
}

/* v1.7 market bid withdraw */
.market-danger-btn {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.market-danger-btn:hover:not(:disabled) {
    background: #fecaca;
    color: #7f1d1d;
}

.market-row-action-btn.is-withdrawn,
.market-row-action-btn.is-withdrawn:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    border-color: #e5e7eb;
    cursor: not-allowed;
}

/* v1.8.1 daily new-bid guard */
.market-bid-btn.is-disabled-by-rule,
.market-bid-btn.is-disabled-by-rule:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    border-color: #e5e7eb;
    cursor: not-allowed;
}

/* v1.9.8 free market manual claim */
.market-claim-signing-btn.is-claimable {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.market-claim-signing-btn.is-claimable:hover {
    background: #d1fae5;
    color: #065f46;
}

.market-row-action-btn.is-settled,
.market-row-action-btn.is-settled:disabled {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #e5e7eb;
    cursor: not-allowed;
}

/* v1.4.54 market player name link */
.market-player-link,
.market-player-link:visited {
    color: #064b12;
    font-weight: 900;
    text-decoration: none;
}

.market-player-link:hover,
.market-player-link:focus {
    color: #047857;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.market-player-link:focus-visible {
    outline: 2px solid rgba(6, 95, 70, 0.28);
    outline-offset: 2px;
    border-radius: 3px;
}

/* v1.4.56 market table sorting */
.market-sortable-th {
    padding: 0 !important;
}

.market-sort-btn {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-height: 39px;
    padding: 10px 8px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

.market-sort-btn:hover,
.market-sort-btn.active {
    background: rgba(255, 255, 255, 0.14);
}

.market-sort-indicator {
    display: inline-block;
    min-width: 10px;
    font-size: 10px;
    line-height: 1;
    opacity: 0.95;
}


/* v1.9.8e: 操作欄顯示完整 team_name 截斷版；完整名稱保留在 title hover */
.market-row-action-btn.is-winner-name,
.market-row-action-btn.is-winner-name:disabled {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    line-height: 28px;
}

/* 得標隊名顏色 */
.market-row-action-btn.is-winner-name,
.market-row-action-btn.is-winner-name:disabled,
.market-row-action-btn.is-settled.is-winner-name,
.market-row-action-btn.is-settled.is-winner-name:disabled {
    background: #e8f5e9;
    color: #064b12;
    border-color: #b7d7b9;
    font-weight: 600;
}

/* v1.9.8j: 得標隊名是靜態資訊標籤；hover 保留 title，但不顯示禁止符號或問號游標 */
.market-row-action-btn.is-winner-name,
.market-row-action-btn.is-winner-name:disabled,
.market-row-action-btn.is-winner-name[aria-disabled="true"],
.market-row-action-btn.is-settled.is-winner-name,
.market-row-action-btn.is-settled.is-winner-name:disabled,
.market-row-action-btn.is-settled.is-winner-name[aria-disabled="true"] {
    cursor: default;
}

.market-row-action-btn.market-static-action.is-winner-name:hover,
.market-row-action-btn.market-static-action.is-winner-name:focus {
    filter: brightness(0.98);
}



/* v1.9.8l: 無法新增出價時按鈕文字維持「出價」，原因只放 hover title */
.market-row-action-btn.market-static-action.is-disabled-by-rule,
.market-row-action-btn.market-static-action.is-disabled-by-rule[aria-disabled="true"] {
    cursor: default;
    max-width: 82px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-row-action-btn.market-static-action.is-disabled-by-rule:hover,
.market-row-action-btn.market-static-action.is-disabled-by-rule:focus {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #e5e7eb;
    filter: brightness(0.98);
}

.market-row-action-btn.is-daily-bid-used,
.market-row-action-btn.is-bid-limit-reached {
    font-weight: 900;
}

/* v1.9.8m: 補回狀態欄「已結標 / 已到期 / 已取消」膠囊底色，避免只剩純文字 */
.market-status-badge.market-status-settled {
    background: #e8f5e9;
    color: #064b12;
    border: 1px solid #b7d7b9;
}

.market-status-badge.market-status-closed {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.market-status-badge.market-status-cancelled {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* v1.9.9b: 守位欄加寬、姓名欄收窄；維持桌機版不出現橫向捲軸 */
@media (min-width: 769px) {
    .market-table-wrap {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .market-table {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        table-layout: fixed;
    }

    .market-table th,
    .market-table td {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .market-table th {
        padding-left: 3px;
        padding-right: 3px;
    }

    .market-table td {
        padding-left: 4px;
        padding-right: 4px;
    }

    .market-name-cell {
        padding-left: 8px !important;
    }

    .market-sort-btn {
        padding-left: 2px;
        padding-right: 2px;
        gap: 2px;
        min-width: 0;
    }

    .market-sort-indicator {
        min-width: 7px;
        font-size: 9px;
    }

    .market-action-group {
        max-width: 100%;
        overflow: hidden;
        gap: 4px;
    }

    .market-row-action-btn {
        min-width: 0;
        padding-left: 8px;
        padding-right: 8px;
        flex: 0 1 auto;
    }

    .market-row-action-btn.is-winner-name,
    .market-row-action-btn.is-winner-name:disabled,
    .market-row-action-btn.market-static-action.is-disabled-by-rule,
    .market-row-action-btn.market-static-action.is-disabled-by-rule[aria-disabled="true"] {
        max-width: 100%;
    }

    .market-table th:nth-child(1),
    .market-table td:nth-child(1) { width: 6.2%; }

    .market-table th:nth-child(2),
    .market-table td:nth-child(2) { width: 7.6%; }

    .market-table th:nth-child(3),
    .market-table td:nth-child(3) { width: 8.1%; }

    .market-table th:nth-child(4),
    .market-table td:nth-child(4) { width: 4.2%; }

    .market-table th:nth-child(5),
    .market-table td:nth-child(5) { width: 4.0%; }

    .market-table th:nth-child(6),
    .market-table td:nth-child(6) { width: 4.2%; }

    .market-table th:nth-child(7),
    .market-table td:nth-child(7),
    .market-table th:nth-child(8),
    .market-table td:nth-child(8),
    .market-table th:nth-child(9),
    .market-table td:nth-child(9),
    .market-table th:nth-child(10),
    .market-table td:nth-child(10),
    .market-table th:nth-child(11),
    .market-table td:nth-child(11),
    .market-table th:nth-child(12),
    .market-table td:nth-child(12) { width: 4.6%; }

    .market-table th:nth-child(13),
    .market-table td:nth-child(13) { width: 4.7%; }

    .market-table th:nth-child(14),
    .market-table td:nth-child(14) { width: 9.2%; }

    .market-table th:nth-child(15),
    .market-table td:nth-child(15) { width: 4.0%; }

    .market-table th:nth-child(16),
    .market-table td:nth-child(16) { width: 9.7%; }

    .market-table th:nth-child(17),
    .market-table td:nth-child(17) { width: 13.5%; }
}
