/* 新藥開發進度追蹤系統 - 前台樣式 */

/* 容器 */
.dpt-container {
    max-width: 100%;
    margin: 20px 0;
    font-family: inherit;
}

/* 標題區域 */
.dpt-header {
    margin-bottom: 25px;
    text-align: center;
}

/* 表格容器 */
.dpt-table-container {
    position: relative;
}

/* 進度狀態圖示說明 */
.dpt-legend {
    position: absolute;
    top: -60px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 15px;
    background-color: #f8f9fa;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    font-size: 13px;
    z-index: 5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dpt-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.dpt-legend-text {
    color: #2c3e50;
    font-weight: 500;
}

.dpt-project-title {
    font-size: 28px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 8px 0;
}

.dpt-project-code {
    font-size: 14px;
    color: #646970;
    margin: 0;
}

/* 表格包裝器 */
.dpt-table-wrapper {
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 25px;
}

/* 進度表格 */
.dpt-progress-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: #fff;
    table-layout: auto;
}

.dpt-progress-table th,
.dpt-progress-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e1e1e1;
    border-right: 1px solid #f1f1f1;
    vertical-align: middle;
}

.dpt-progress-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 橫式布局特定樣式 */
.dpt-horizontal-progress .dpt-col-code {
    width: 100px;
    min-width: 80px;
}

.dpt-horizontal-progress .dpt-col-therapy {
    width: 120px;
    min-width: 100px;
}

.dpt-horizontal-progress .dpt-col-indication {
    width: 180px;
    min-width: 100px;
}

.dpt-horizontal-progress .dpt-col-region {
    width: 150px;
    min-width: 120px;
    background-color: #f8f9fa;
    font-weight: 600;
    border-right: 2px solid #ddd;
    text-align: left;
}

.dpt-horizontal-progress .dpt-col-stage {
    width: 100px;
    min-width: 50px;
    text-align: center;
    background-color: #fdfdfd;
    border-right: 1px solid #e1e1e1 !important;
}

.dpt-horizontal-progress .dpt-col-detail {
    width: 100px;
    min-width: 90px;
    text-align: center;
}

/* 表格行 */
.dpt-product-row:hover {
    background-color: #f8f9fa;
}

.dpt-product-row td {
    border-right: 1px solid #f1f1f1;
}

/*.dpt-product-row td:last-child {*/
/*    border-right: none;*/
/*}*/

/* 地區行樣式 */
.dpt-region-row {
    border-bottom: 1px solid #ddd;
}

.dpt-region-row:hover {
    background-color: #f9f9f9;
}

.dpt-region-row td {
    border-right: 1px solid #e1e1e1;
    vertical-align: middle;
}

.dpt-region-row td:last-child {
    border-right: none;
}

/* 地區標籤樣式 */
.dpt-region-label {
    font-weight: 400;
    color: #333;
    font-size: 14px;
    display: inline-block;
    min-width: 80px;
}

/* 舊的地區名稱樣式 (保留向後兼容性) */
.dpt-region-name {
    font-weight: 600;
    color: #2271b1;
    margin-bottom: 5px;
    font-size: 13px;
}

/* 階段指示器 */
.dpt-stage-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    position: relative;
}

.dpt-stage-line {
    display: block;
    width: 14px;
    height: 14px;
    border-radius: 14px;
    position: relative;
}

/* 進度狀態樣式 */
.dpt-status-pending .dpt-stage-line {
    background-color: #dcdcde;
    border: 1px solid #c3c4c7;
}

/* 全部未開始狀態時隱藏階段標題 */
.dpt-all-pending .dpt-col-stage .dpt-stage-title {
    visibility: hidden;
    opacity: 0.3;
}

.dpt-all-pending .dpt-col-stage {
    color: #c3c4c7;
    font-weight: normal;
}

/* 未開始階段的特殊樣式 */
.dpt-pending-stage {
    position: relative;
}

.dpt-pending-stage::before {
    content: '—';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    color: #c3c4c7;
    z-index: 1;
}

/* 當有進度時顯示階段標題 */
.dpt-product-row:not(.dpt-all-pending) .dpt-col-stage .dpt-stage-title {
    visibility: visible;
    opacity: 1;
}

.dpt-status-ongoing .dpt-stage-line {
    background: linear-gradient(90deg, #708bd2 0%, #708bd2 50%, transparent 50%);
    background-size: 8px 4px;
    animation: dpt-progress-animation 2s linear infinite;
    border: 1px solid #2271b1;
}

.dpt-status-completed .dpt-stage-line {
    background-color: #3890ff;
    position: relative;
}

.dpt-status-completed .dpt-stage-line::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* 不適用狀態 */
.dpt-status-not_applicable {
    opacity: 0.3;
}

.dpt-status-not_applicable .dpt-na {
    color: #c3c4c7;
    font-size: 16px;
    font-weight: bold;
    display: block;
    text-align: center;
    line-height: 1;
}

/* 刪除狀態 */
.dpt-status-deleted {
    opacity: 0.1;
    display: none; /* 完全隱藏 */
}

.dpt-status-deleted .dpt-deleted {
    color: #d63638;
    font-size: 16px;
    font-weight: bold;
    display: block;
    text-align: center;
    line-height: 1;
}

/* 整個欄位被刪除時完全隱藏 */
.dpt-column-deleted {
    display: none !important;
}

/* 個別階段被刪除時隱藏 */
.dpt-stage-deleted {
    display: none !important;
}

/* 針對不支援 :has() 的瀏覽器的回退方案 */
.dpt-col-stage:has(.dpt-status-deleted) {
    display: none;
}

/* 進度動畫 */
@keyframes dpt-progress-animation {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 16px 0;
    }
}

/* 詳情按鈕 */
.dpt-detail-btn {
    background-color: #e40069;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s ease;
}

.dpt-detail-btn:hover {
    background-color: #c3198b;
    color: white;
}

/* 沒有資料時的顯示 */
.dpt-no-data {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
    font-size: 16px;
    background: #f8f9fa;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
}

/* 彈窗樣式 */
.dpt-modal {
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: dpt-fadeIn 0.3s ease;
}

.dpt-modal-content {
    background-color: #fff;
    margin: 5% auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    animation: dpt-slideIn 0.3s ease;
}

.dpt-modal-header {
    padding: 20px 25px 15px;
    border-bottom: 1px solid #e1e1e1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
}

.dpt-modal-header h4 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
}

.dpt-modal-close {
    color: #666;
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.dpt-modal-close:hover {
    background-color: #e1e1e1;
    color: #333;
}

.dpt-modal-body {
    padding: 25px;
    line-height: 1.6;
}

.dpt-modal-body h5 {
    color: #2c3e50;
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.dpt-modal-body p {
    margin: 0 0 15px 0;
    color: #555;
}

.dpt-modal-body .dpt-product-detail {
    margin-bottom: 20px;
}

.dpt-modal-body .dpt-product-introduction {
    border-top: 1px solid #e1e1e1;
    padding-top: 20px;
    margin-top: 20px;
}

/* 彈窗動畫 */
@keyframes dpt-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dpt-slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .dpt-progress-table {
        font-size: 14px;
        min-width: 900px; /* 增加以適應橫式布局 */
    }
    
    .dpt-progress-table th,
    .dpt-progress-table td {
        padding: 8px 4px;
    }
    
    /* 橫式布局響應式調整 */
    .dpt-horizontal-progress .dpt-col-code {
        min-width: 60px;
    }
    
    .dpt-horizontal-progress .dpt-col-therapy {
        min-width: 80px;
    }
    
    .dpt-horizontal-progress .dpt-col-indication {
        min-width: 100px;
    }
    
    .dpt-horizontal-progress .dpt-col-region {
        min-width: 100px;
        font-size: 12px;
    }
    
    .dpt-horizontal-progress .dpt-col-stage {
        font-size: 12px;
        min-width: 90px;
        width: 100%;
    }
    
    .dpt-region-label {
        font-size: 12px;
        padding: 3px 6px;
        min-width: 60px;
    }
    
    .dpt-stage-line {
        width: 30px;
        height: 3px;
    }
    
    .dpt-detail-btn {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .dpt-modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .dpt-modal-header {
        padding: 15px 20px 10px;
    }
    
    .dpt-modal-body {
        padding: 20px;
    }
    
    /* 移動版本特殊處理 */
    .dpt-table-wrapper {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 圖示說明響應式調整 */
    .dpt-legend {
        position: relative;
        top: 0;
        right: auto;
        justify-content: center;
        margin-bottom: 15px;
        gap: 15px;
        padding: 10px;
        font-size: 12px;
    }
    
    .dpt-legend-item {
        gap: 5px;
    }
    
    .dpt-table-wrapper {
        margin-top: 0;
    }
}

@media (max-width: 480px) {
    .dpt-project-title {
        font-size: 22px;
    }
    
    .dpt-progress-table {
        font-size: 12px;
        min-width: 700px; /* 增加以適應橫式布局 */
    }
    
    .dpt-progress-table th,
    .dpt-progress-table td {
        padding: 6px 3px;
    }
    
    /* 橫式布局移動端調整 */
    .dpt-horizontal-progress .dpt-col-region {
        min-width: 80px;
        font-size: 11px;
    }
    
    .dpt-horizontal-progress .dpt-col-stage {
        font-size: 11px;
        min-width: 60px;
        width: 70px;
    }
    
    .dpt-region-label {
        font-size: 11px;
        padding: 2px 4px;
        min-width: 50px;
    }
    
    .dpt-stage-line {
        width: 25px;
        height: 3px;
    }
    
    .dpt-status-completed .dpt-stage-line::after {
        font-size: 10px;
    }
    
    .dpt-status-not_applicable .dpt-na {
        font-size: 14px;
    }
    
    /* 保持舊樣式的兼容性 */
    .dpt-region-name {
        font-size: 11px;
    }
    
    /* 極小螢幕的圖示說明調整 */
    .dpt-legend {
        position: relative;
        top: 0;
        right: auto;
        justify-content: center;
        margin-bottom: 10px;
        gap: 10px;
        padding: 8px;
        font-size: 11px;
    }
    
    .dpt-legend-item {
        gap: 4px;
    }
    
    .dpt-table-wrapper {
        margin-top: 0;
    }
}

/* 列印樣式 */
@media print {
    .dpt-detail-btn {
        display: none;
    }
    
    .dpt-modal {
        display: none !important;
    }
    
    .dpt-progress-table {
        border-collapse: collapse;
    }
    
    .dpt-progress-table th,
    .dpt-progress-table td {
        border: 1px solid #000;
        padding: 8px;
    }
    
    .dpt-status-ongoing .dpt-stage-line {
        background: #2271b1;
        animation: none;
    }
}

/* 防止背景滾動的 CSS */
body.dpt-modal-open {
    overflow: hidden;
}

/* 產品代碼樣式 */
.dpt-product-code {
    font-family:Arial, Helvetica, sans-serif;
    font-size: 16px;
    color: #ffffff;
    font-weight: 600;
}

.dpt-modal .dpt-modal-header h4 {
   margin-bottom: initial;
}