/* EDM 表格樣式 - 基於 restaurant.css */

/* 新版欄位寬度設定 */
.edm-col-edit {
    width: 5% !important;
    min-width: 5% !important;
    max-width: 5% !important;
}

.edm-col-checkbox {
    width: 5% !important;
    min-width: 5% !important;
    max-width: 5% !important;
}

.edm-col-type {
    width: 10% !important;
    min-width: 10% !important;
    max-width: 10% !important;
}

.edm-col-version {
    width: 20% !important;
    min-width: 20% !important;
    max-width: 20% !important;
}

.edm-col-subject {
    width: 27% !important;
    min-width: 27% !important;
    max-width: 27% !important;
}

.edm-col-location {
    width: 20% !important;
    min-width: 20% !important;
    max-width: 20% !important;
}

.edm-col-tag {
    width: 10% !important;
    min-width: 10% !important;
    max-width: 10% !important;
}

/* EDM 類型切換標籤 */
.edm-filter {
    cursor: pointer;
    color: #0d6efd;
    user-select: none;
    text-decoration: underline;
    font-weight: 400;
}

.edm-filter.active {
    color: #6c757d;
    text-decoration: none;
}

.edm-filter:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* 表格容器樣式 */
#tableContainer {
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* 靜態標題列圓角樣式 */
.row.border-top {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    background-color: #DADADA;
}

/* 高亮單元格樣式（保留供未來使用） */
.table tbody tr td.highlight-cell {
    background-color: #f1f1f1 !important;
}

/* EDM 編輯頁面樣式 */

/* 資訊區塊樣式 */
.info-box {
    background-color: #f3f3f3;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
}

.info-box h2 {
    font-size: 1rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    text-align: center;
}

.info-box p {
    font-size: 1.8rem;
    font-weight: bold;
    color: #212529;
    margin-bottom: 0;
    text-align: center;
}

.info-box.large p {
    font-size: 2.5rem;
    text-align: center;
}

/* 統計列樣式 */
.stats-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stats-col {
    flex: 1;
    text-align: center;
}

.chart-container {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 按鈕懸停效果 */
.edm-actions .btn:hover {
    transform: translateY(-1px);
}

/* 表格樣式 */
#tableContainer {
    max-height: 600px;
    overflow-y: auto;
}

.table {
    margin-bottom: 0;
}

.table th,
.table td {
    border: none;
    padding: 0.75rem;
    vertical-align: middle;
}

.table tbody tr {
    border-bottom: 1px solid #dee2e6;
}

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

/* 列表內容左右置中 */
#tableBody td {
    text-align: center;
}

/* 欄位寬度設定 */
.name-col {
    width: 20%;
}

.description-col {
    width: 35%;
}

.status-col {
    width: 10%;
}

.modified-col {
    width: 15%;
}

.actions-col {
    width: 20%;
}

/* 狀態徽章樣式 */
.badge {
    font-size: 0.75em;
    padding: 0.25em 0.5em;
}

/* 按鈕樣式 */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* 編輯表單樣式 */
.form-section {
    margin-bottom: 2rem;
}

.form-section h3 {
    color: #495057;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.preview-section {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.25rem;
    border: 1px solid #dee2e6;
}

.editor-section h4 {
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* 修正捲動問題 */
.content {
    height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 1rem;
}

.edit-form {
    background-color: #fff;
    padding: 2rem;
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 2rem;
}

/* 確保編輯器容器不會過高 */
.editor-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background-color: #f8f9fa;
}

/* CKEditor 相關樣式 */
.ck-editor__editable {
    min-height: 120px;
    max-height: 200px;
    overflow-y: auto;
}

.ck.ck-editor {
    margin-bottom: 1rem;
}

.ck.ck-editor__main {
    max-height: 200px;
}

/* EDM 編輯頁面 textarea 預設高度 */
.edit-form textarea {
    height: 80px !important;
    min-height: 80px !important;
}

/* 版本資訊顯示樣式 */
#typeVersionDisplay {
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    color: #495057;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

#typeVersionDisplay strong {
    color: #212529;
    font-weight: 600;
}

/* Release Version 按鈕樣式 */
#releaseVersionBtn {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .content {
        --mobile-table-min-width: 820px;
    }

    .content > .my-3.d-flex {
        justify-content: stretch !important;
    }

    .content > .my-3.d-flex .btn {
        flex: 1 1 160px;
    }

    .content > .row.border-top .edm-col-edit,
    #tableContainer .edm-col-edit,
    .content > .row.border-top .edm-col-checkbox,
    #tableContainer .edm-col-checkbox {
        flex-basis: 72px !important;
        width: 72px !important;
        min-width: 72px !important;
        max-width: none !important;
    }

    .content > .row.border-top .edm-col-type,
    #tableContainer .edm-col-type,
    .content > .row.border-top .edm-col-tag,
    #tableContainer .edm-col-tag {
        flex-basis: 100px !important;
        width: 100px !important;
        min-width: 100px !important;
        max-width: none !important;
    }

    .content > .row.border-top .edm-col-version,
    #tableContainer .edm-col-version,
    .content > .row.border-top .edm-col-subject,
    #tableContainer .edm-col-subject,
    .content > .row.border-top .edm-col-location,
    #tableContainer .edm-col-location {
        flex-basis: 180px !important;
        width: 180px !important;
        min-width: 180px !important;
        max-width: none !important;
    }

    #tableContainer td {
        white-space: normal;
        word-break: break-word;
    }
}
