﻿.dcat-export-dialog[hidden] {
    display: none !important;
}

.dcat-export-dialog {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.dcat-export-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(30, 41, 59, 0.48);
}

.dcat-export-panel {
    position: relative;
    width: min(680px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    color: #334155;
    background: #ffffff;
    border: 1px solid #dbe4ea;
    border-radius: 10px;
    box-shadow: 0 18px 48px rgba(30, 41, 59, 0.22);
}

.dcat-export-header {
    min-height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 22px;
    background: #f8fafb;
    border-bottom: 1px solid #e5edf2;
}

.dcat-export-header h2 {
    margin: 0;
    color: #334155;
    font-size: 20px;
    font-weight: 600;
}

.dcat-export-icon-button,
.dcat-export-copy-icon {
    border: 0;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #475569;
}

.dcat-export-icon-button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 17px;
}

.dcat-export-icon-button:hover,
.dcat-export-copy-icon:hover {
    color: #1f7f66;
    background: #e8f7f1;
}

.dcat-export-body {
    padding: 22px;
}

.dcat-export-dataset-title {
    margin: 0 0 18px;
    color: #475569;
    line-height: 1.6;
    font-weight: 500;
}

.dcat-export-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 22px;
    border: 1px solid #dbe4ea;
    border-radius: 8px;
    overflow: hidden;
}

.dcat-export-tab {
    min-height: 46px;
    border: 0;
    border-right: 1px solid #dbe4ea;
    background: #ffffff;
    color: #475569;
    font-weight: 600;
    cursor: pointer;
}

.dcat-export-tab:last-child {
    border-right: 0;
}

.dcat-export-tab:hover {
    color: #1f7f66;
    background: #f4fbf8;
}

.dcat-export-tab.is-active {
    color: #1f7f66;
    background: #e8f7f1;
    box-shadow: inset 0 -3px 0 #3db28c;
}

.dcat-export-tab i {
    margin-right: 7px;
}

.dcat-export-field {
    margin-bottom: 17px;
}

.dcat-export-label {
    display: block;
    margin-bottom: 7px;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}

.dcat-export-select-like,
.dcat-export-input-group {
    min-height: 49px;
    border: 1px solid #dbe4ea;
    border-radius: 7px;
    background: #ffffff;
}

.dcat-export-select-like {
    display: flex;
    align-items: center;
    padding: 0 14px;
    color: #334155;
}

.dcat-export-input-group {
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.dcat-export-input-group input {
    flex: 1;
    min-width: 0;
    border: 0;
    padding: 0 14px;
    color: #334155;
    background: #ffffff;
}

.dcat-export-input-group input:focus {
    outline: 2px solid #3db28c;
    outline-offset: -2px;
}

.dcat-export-copy-icon {
    width: 52px;
    border-left: 1px solid #dbe4ea;
    border-radius: 0;
    font-size: 17px;
}

.dcat-export-message {
    margin-bottom: 17px;
    padding: 11px 13px;
    border-radius: 6px;
    line-height: 1.5;
}

.dcat-export-message-error {
    color: #9b1c1c;
    background: #fff6f6;
    border-left: 4px solid #d64545;
}

.dcat-export-status {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 8px 0 18px;
    color: #64748b;
}

.dcat-export-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #dbe4ea;
    border-top-color: #3db28c;
    border-radius: 50%;
    animation: dcat-spin 0.8s linear infinite;
}

@keyframes dcat-spin {
    to {
        transform: rotate(360deg);
    }
}

.dcat-export-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 22px;
    background: #f8fafb;
    border-top: 1px solid #e5edf2;
}

.dcat-export-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

/* 取消按鈕沿用原本白底深色文字，避免被全站按鈕樣式覆蓋。 */
.dcat-export-button-secondary {
    min-width: 86px;
    color: #475569 !important;
    background: #ffffff !important;
    border: 1px solid #cfdbe4 !important;
    box-shadow: none;
}

.dcat-export-button-secondary:hover,
.dcat-export-button-secondary:focus-visible {
    color: #1f7f66 !important;
    background: #f4fbf8 !important;
    border-color: #3db28c !important;
    text-decoration: none;
    outline: none;
}

.dcat-export-button-secondary span {
    color: inherit !important;
}

.dcat-export-button-primary {
    color: #ffffff;
    background: #3db28c;
    border: 1px solid #3db28c;
}

.dcat-export-button-primary:hover {
    color: #ffffff;
    background: #2f9978;
    border-color: #2f9978;
    text-decoration: none;
}

body.dcat-export-open {
    overflow: hidden;
}

@media (max-width: 576px) {
    .dcat-export-dialog {
        padding: 12px;
        align-items: flex-end;
    }

    .dcat-export-panel {
        max-height: calc(100vh - 12px);
        border-radius: 10px 10px 0 0;
    }

    .dcat-export-footer {
        flex-wrap: wrap;
    }

    .dcat-export-button {
        flex: 1;
    }
}

/* 資料集標題與匯出語言切換按鈕同行顯示。 */
.dcat-export-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.dcat-export-title-row .dcat-export-dataset-title {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.dcat-export-language-toggle {
    flex: 0 0 auto;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 12px;
    color: #1f7f66;
    background: #ffffff;
    border: 1px solid #b9ded1;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.dcat-export-language-toggle:hover,
.dcat-export-language-toggle:focus-visible {
    color: #176650;
    background: #e8f7f1;
    border-color: #3db28c;
    outline: none;
}

@media (max-width: 575px) {
    .dcat-export-title-row {
        align-items: stretch;
        flex-direction: column;
    }

    .dcat-export-language-toggle {
        align-self: flex-end;
    }
}

/* 語言切換時固定彈窗頂部位置，避免內容高度變化後重新垂直置中。 */
.dcat-export-dialog {
    align-items: flex-start;
    padding-top: 5vh;
    overflow-y: auto;
}

/* 固定彈窗基本高度，中文與英文內容長度不同時外框仍保持穩定。 */
.dcat-export-panel {
    min-height: 620px;
    display: flex;
    flex-direction: column;
}

.dcat-export-body {
    flex: 1 1 auto;
}

/* 標題區預留兩行高度，避免中英文標題行數不同導致版面跳動。 */
.dcat-export-title-row {
    min-height: 58px;
    align-items: flex-start;
}

.dcat-export-title-row .dcat-export-dataset-title {
    min-height: 48px;
    line-height: 24px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    word-break: break-word;
}

/* 固定語言按鈕尺寸，中文與 English 不會改變標題可用寬度。 */
.dcat-export-language-toggle {
    flex: 0 0 96px;
    width: 96px;
    min-width: 96px;
    height: 38px;
    white-space: nowrap;
}

/* 背景載入時保留所有原內容與尺寸，只降低按鈕互動，不隱藏區塊。 */
.dcat-export-dialog.is-language-loading .dcat-export-language-toggle {
    cursor: wait;
    opacity: 0.72;
}

/* endpoint 欄位尺寸固定，網址長度不同也不改變版面。 */
.dcat-export-input-group,
.dcat-export-input-group input,
.dcat-export-copy-icon {
    height: 49px;
}

@media (max-width: 576px) {
    .dcat-export-dialog {
        padding-top: 12px;
    }

    .dcat-export-panel {
        min-height: 0;
    }

    .dcat-export-title-row {
        min-height: 0;
    }
}
