/**
 * Tender Countdown RWD Styles
 *
 * 台電通知倒數彈窗響應式樣式
 * 採用獨立 .tcr-* namespace，不與專案既有 RWD 樣板耦合
 *
 * Breakpoints:
 *   mobile:  0   - 575px   → Card 直列、T1 顯示、T2/T3 收合
 *   tablet:  576 - 991px   → Card 直列/雙欄、T1+T2 顯示、T3 收合
 *   desktop: ≥ 992px       → Table 並排、全部欄位顯示
 *
 * @since 2026-04-17
 * @see docs/TenderNotification/CountdownPopup-RWD/03-RWD-Design-Spec.md
 */

/* ========================================================================
 * Mobile-first base：預設顯示 card，隱藏 table
 * ======================================================================== */
.tcr-root {
    box-sizing: border-box;
}

.tcr-root *,
.tcr-root *::before,
.tcr-root *::after {
    box-sizing: border-box;
}

.tcr-desktop-view { display: none; }
.tcr-mobile-view  { display: block; }

/* ------------------------------------------------------------------------
 * Card 視覺
 * ------------------------------------------------------------------------ */
.tcr-card {
    background: #1a1d23;
    border: 1px solid #2c313a;
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 14px;
    color: #e0e0e0;
}

.tcr-card:last-child { margin-bottom: 0; }

/* T1 標題列 */
.tcr-card-header {
    border-bottom: 1px solid #2c313a;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.tcr-code {
    font-size: 18px;
    font-weight: 700;
    color: #00d4ff;
    line-height: 1.2;
}

.tcr-code .tcr-graph-link {
    color: #00d4ff;
    margin-left: 6px;
    font-size: 14px;
}

.tcr-name {
    font-size: 13px;
    color: #9ba3af;
    margin-top: 4px;
    word-break: break-all;
}

/* T1 倒數 */
.tcr-clock {
    text-align: center;
    padding: 14px 0;
}

.tcr-clock-value {
    font-size: 32px;
    font-weight: 700;
    color: #ff4757;
    font-family: 'Courier New', monospace;
    line-height: 1.2;
}

.tcr-clock-label {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
    letter-spacing: 0.05em;
}

/* T2 啟動/可結束時間軸 */
.tcr-timeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 8px;
    border-top: 1px solid #2c313a;
    border-bottom: 1px solid #2c313a;
    font-size: 12px;
}

.tcr-timeline-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.tcr-timeline-label {
    color: #6b7280;
    font-size: 10px;
    margin-bottom: 2px;
}

.tcr-timeline-value {
    color: #d1d5db;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    word-break: break-all;
    text-align: center;
}

.tcr-timeline-arrow {
    color: #4b5563;
    padding: 0 8px;
    flex-shrink: 0;
}

/* T3 收合區 */
.tcr-details-toggle {
    margin-top: 10px;
}

.tcr-toggle-btn {
    width: 100%;
    background: transparent;
    border: 1px solid #2c313a;
    color: #9ba3af;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.tcr-toggle-btn:hover {
    background: #22262e;
    color: #e0e0e0;
}

.tcr-toggle-btn .tcr-toggle-icon {
    transition: transform 0.3s ease;
    font-size: 10px;
}

.tcr-toggle-btn.expanded .tcr-toggle-icon {
    transform: rotate(180deg);
}

.tcr-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 4px;
}

.tcr-details.expanded {
    max-height: 800px;
    padding: 12px 4px 4px 4px;
}

.tcr-detail-list {
    margin: 0;
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 6px 12px;
    font-size: 12px;
}

.tcr-detail-list dt {
    color: #6b7280;
    font-weight: 400;
    margin: 0;
}

.tcr-detail-list dd {
    color: #d1d5db;
    margin: 0;
    word-break: break-all;
}

.tcr-resource-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tcr-resource-list li {
    padding: 2px 0;
}

.tcr-resource-name {
    color: #d1d5db;
}

.tcr-resource-value {
    color: #ff6b35;
    font-family: 'Courier New', monospace;
}

/* T1 自主結束按鈕 */
.tcr-actions {
    margin-top: 12px;
}

.tcr-self-end {
    width: 100%;
    background: #ff4757;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}

.tcr-self-end:hover:not(:disabled) {
    background: #e63946;
}

.tcr-self-end:disabled {
    background: #4b5563;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ========================================================================
 * Tablet (576-991px)：T2 永遠展開，多筆通知 2 欄 grid
 * ======================================================================== */
@media (min-width: 576px) and (max-width: 991px) {
    .tcr-mobile-view {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 12px;
    }

    .tcr-card { margin-bottom: 0; }

    .tcr-clock-value { font-size: 36px; }
}

/* ========================================================================
 * Desktop (≥ 992px)：Table 模式
 * ======================================================================== */
@media (min-width: 992px) {
    .tcr-desktop-view { display: block; }
    .tcr-mobile-view  { display: none; }

    /* Table 模式下的視覺微調 */
    .tcr-table {
        margin-bottom: 0;
    }

    .tcr-table thead th {
        white-space: nowrap;
        font-size: 13px;
    }

    .tcr-table tbody td {
        vertical-align: middle;
        font-size: 13px;
    }

    /* 桌面下的容量清單採用更精簡呈現 */
    .tcr-table .list-group {
        margin: 0;
    }

    .tcr-table .list-group-item {
        padding: 4px 8px;
        background: transparent;
        border: none;
        border-bottom: 1px dashed #2c313a;
        font-size: 12px;
    }

    .tcr-table .list-group-item:last-child {
        border-bottom: none;
    }
}
