/* ============================================
   新藥研發進度追蹤器 - 前台樣式
   ============================================ */

/* Wrapper */
.ddt-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "微軟正黑體", sans-serif;
    color: #333;
}

/* 標題 */
.ddt-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #1a1a1a;
}

/* 說明文字 */
.ddt-description {
    font-size: 15px;
    line-height: 1.8;
    color: #555;
    margin-bottom: 20px;
}

.ddt-description p {
    margin-bottom: 8px;
}

/* 圖例 */
.ddt-legend {
    display: flex;
    gap: 24px;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.ddt-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

/* ============================================
   桌面版表格
   ============================================ */
.ddt-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.ddt-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 14px;
}

.ddt-table thead th {
    padding: 14px 16px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    border: none;
}

.ddt-table thead th:first-child {
    border-radius: 8px 0 0 0;
}

.ddt-table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.ddt-table tbody tr {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.ddt-table tbody tr:hover {
    background-color: #fafafa;
}

.ddt-table tbody tr:last-child {
    border-bottom: none;
}

.ddt-table tbody td {
    padding: 14px 16px;
    text-align: center;
    vertical-align: middle;
    border: none;
}

.ddt-cell-code {
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
}

.ddt-cell-status {
    text-align: center !important;
}

.ddt-cell-detail {
    text-align: center !important;
}

/* 詳情按鈕 */
.ddt-detail-btn {
    background: none;
    border: 2px solid #F5A623;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #F5A623;
    transition: all 0.2s;
    padding: 0;
}

.ddt-detail-btn:hover {
    background: #F5A623;
    color: #fff;
}

.ddt-detail-btn svg {
    width: 16px;
    height: 16px;
}

/* 狀態圖示 */
.ddt-status-icon {
    vertical-align: middle;
}

/* ============================================
   手機版卡片（預設隱藏）
   ============================================ */
.ddt-cards-wrapper {
    display: none;
}

/* ============================================
   Modal 彈窗
   ============================================ */
.ddt-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.ddt-modal-overlay.ddt-modal-active {
    opacity: 1;
}

.ddt-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 680px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.ddt-modal-overlay.ddt-modal-active .ddt-modal {
    transform: translateY(0);
}

.ddt-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
    z-index: 10;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.ddt-modal-close:hover {
    color: #333;
    background: #f0f0f0;
}

.ddt-modal-content {
    padding: 32px;
}

.ddt-modal-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 24px 0;
    color: #1a1a1a;
    padding-right: 40px;
}

.ddt-modal-body {
    font-size: 15px;
    line-height: 1.7;
}

.ddt-modal-loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Modal 內容區塊 */
.ddt-modal-section {
    margin-bottom: 24px;
}

.ddt-modal-section:last-child {
    margin-bottom: 0;
}

.ddt-modal-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #F5A623;
    display: inline-block;
}

.ddt-modal-section-content {
    color: #555;
    font-size: 14px;
    line-height: 1.8;
}

.ddt-modal-section-content p {
    margin-bottom: 8px;
}

.ddt-modal-section-content p:last-child {
    margin-bottom: 0;
}

/* Modal 開發進展 */
.ddt-modal-progress {
    display: flex;
    gap: 0;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.ddt-modal-progress-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 80px;
    position: relative;
    padding: 12px 8px;
}

.ddt-modal-progress-label {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    font-weight: 500;
}

.ddt-modal-progress-item .ddt-status-icon {
    margin: 0;
}

/* 進度條連接線 */
.ddt-modal-progress-bar {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 16px;
    margin-bottom: 8px;
}

.ddt-modal-progress-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.ddt-modal-progress-stage::after {
    content: '';
    position: absolute;
    top: 12px;
    left: calc(50% + 14px);
    right: calc(-50% + 14px);
    height: 2px;
    background: #e0e0e0;
}

.ddt-modal-progress-stage:last-child::after {
    display: none;
}

/* ============================================
   RWD 響應式
   ============================================ */
@media (max-width: 768px) {
    .ddt-table-wrapper {
        display: none;
    }

    .ddt-cards-wrapper {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .ddt-card {
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    }

    .ddt-card-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
    }

    .ddt-card-code {
        font-weight: 700;
        font-size: 16px;
    }

    .ddt-card-header .ddt-detail-btn {
        border-color: rgba(255, 255, 255, 0.5);
        color: rgba(255, 255, 255, 0.9);
    }

    .ddt-card-header .ddt-detail-btn:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .ddt-card-body {
        padding: 16px;
    }

    .ddt-card-info {
        margin-bottom: 16px;
        font-size: 14px;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .ddt-card-stages {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .ddt-card-stage {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

    .ddt-card-stage-label {
        font-size: 12px;
        color: #888;
    }

    .ddt-title {
        font-size: 22px;
    }

    .ddt-modal-content {
        padding: 24px 20px;
    }

    .ddt-modal {
        max-height: 90vh;
        margin: 10px;
        border-radius: 8px;
    }

    .ddt-modal-progress-item {
        min-width: 60px;
        padding: 8px 4px;
    }

    .ddt-modal-progress-label {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .ddt-card-stages {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Elementor 相容性修正
   ============================================ */
.elementor-widget-container .ddt-wrapper {
    width: 100%;
}

.elementor-widget-container .ddt-table {
    margin: 0;
}

/* 防止 Elementor 覆蓋表格樣式 */
.elementor-widget-container .ddt-table thead th,
.elementor-widget-container .ddt-table tbody td {
    border: none;
}
