/* static/css/main.css - 主要樣式（基礎+佈局+表單） */

/* ============ 基礎重置和全域樣式 ============ */

/* ============ AI 模型分層設定樣式 ============ */
.ai-models-section {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.ai-models-section h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.1em;
}

.ai-model-config {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.ai-model-config h5 {
    margin: 0 0 10px 0;
    color: #6c757d;
    font-size: 1em;
}

.model-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.model-row label {
    min-width: 80px;
    font-weight: 500;
    color: #495057;
}

.model-row select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.ai-info {
    margin-top: 15px;
    padding: 12px;
    background: #e3f2fd;
    border-radius: 6px;
    border-left: 4px solid #2196f3;
}

.ai-info small {
    color: #0d47a1;
    line-height: 1.4;
}

/* ============ AI 審查系統專用樣式 ============ */
.prompt-editor {
    margin: 15px 0;
}

.prompt-editor label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
}

.prompt-editor textarea {
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 12px;
    resize: vertical;
    min-height: 200px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.button-group .button {
    margin: 0;
}

/* 拒絕文章樣式 */
.article-item.rejected {
    border-left: 4px solid #dc3545;
    background: #f8f9fa;
}

.article-item.rejected .article-status.status-rejected {
    background: #dc3545;
    color: white;
}

.rejection-reason {
    margin-top: 10px;
    padding: 8px 12px;
    background: #f5c6cb;
    border: 1px solid #f1b0b7;
    border-radius: 4px;
    font-size: 14px;
}

.rejection-reason .reason-text {
    color: #721c24;
    font-weight: 500;
}

/* Prompt 儲存結果樣式 */
#prompt-save-result .success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

#prompt-save-result .error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

/* ============ 基礎重置和全域樣式 ============ */
* { 
    box-sizing: border-box; 
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; 
    padding: 20px; 
    background: #f0f2f5; 
    color: #333; 
    font-size: 15px; 
}

.container { 
    max-width: 1300px; 
    margin: 20px auto; 
    background: white; 
    padding: 25px; 
    border-radius: 10px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
}

/* ============ 頁首樣式 ============ */
.header { 
    text-align: center; 
    margin-bottom: 35px; 
    position: relative;
}

.header h1 { 
    color: #005a87; 
}

.version { 
    font-size: 0.8em; 
    color: #6c757d; 
    margin-top: 5px; 
}

.last-modified { 
    font-size: 0.75em; 
    color: #28a745; 
    margin-top: 3px; 
    font-weight: 500;
}

.header-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logout-button, 
.automation-toggle-button { 
    color: white; 
    padding: 8px 15px; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    font-size: 14px; 
    transition: background-color 0.2s ease, opacity 0.2s ease; 
}

.logout-button { 
    background: #dc3545; 
}

.logout-button:hover { 
    background: #c82333; 
}

.automation-toggle-button { 
    background: #28a745; 
}

.automation-toggle-button:hover { 
    background: #218838; 
}

.automation-toggle-button.running { 
    background: #6c757d; 
}

.automation-toggle-button.running:hover { 
    background: #5a6268; 
}

.automation-toggle-button.loading { 
    opacity: 0.75; 
    cursor: default; 
    pointer-events: none;
}

/* ============ 標題樣式 ============ */
h3 { 
    border-bottom: 2px solid #007bff; 
    padding-bottom: 12px; 
    margin-top: 0; 
    color: #0056b3; 
}

/* ============ 按鈕樣式 ============ */
.button { 
    background: #007bff; 
    color: white; 
    padding: 10px 18px; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    margin: 8px 5px 8px 0; 
    font-size: 15px; 
    transition: background-color 0.2s ease; 
}

.button:hover { 
    background: #0056b3; 
}

.button:disabled { 
    background: #d1d5db; 
    cursor: not-allowed; 
}

.button.secondary { 
    background: #6c757d; 
}

.button.secondary:hover { 
    background: #545b62; 
}

.button.danger { 
    background: #dc3545; 
}

.button.danger:hover { 
    background: #c82333; 
}

/* ============ 區塊和章節 ============ */
.section { 
    margin-bottom: 35px; 
    padding: 25px; 
    border: 1px solid #e0e0e0; 
    border-radius: 8px; 
    background-color: #fff; 
}

/* ============ 頁籤系統 ============ */
.tabs { 
    display: flex; 
    border-bottom: 1px solid #ccc; 
    margin-bottom: 20px; 
}

.tab-button { 
    background-color: #f1f1f1; 
    border: 1px solid #ccc; 
    border-bottom: none; 
    padding: 10px 15px; 
    cursor: pointer; 
    border-radius: 5px 5px 0 0; 
    margin-right: 5px; 
}

.tab-button.active { 
    background-color: #fff; 
    border-bottom: 1px solid #fff; 
}

.tab-content { 
    display: none; 
}

.tab-content.active { 
    display: block; 
}

/* ============ 設定頁面內的子標籤 ============ */
/* Main Settings Category Tabs */
.main-settings-tabs {
    display: flex;
    border-bottom: 2px solid #007bff;
    margin-bottom: 15px;
    margin-top: 10px;
}

.main-settings-tab-button {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-bottom: none;
    padding: 12px 20px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    margin-right: 5px;
    font-size: 16px;
    font-weight: 600;
    color: #6c757d;
    transition: all 0.2s ease;
}

.main-settings-tab-button:hover {
    background-color: #e9ecef;
    color: #495057;
}

.main-settings-tab-button.active {
    background-color: #007bff;
    border-color: #007bff;
    color: #fff;
    border-bottom: 2px solid #007bff;
}

.main-settings-content {
    display: none;
}

.main-settings-content.active {
    display: block;
}

.settings-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    margin-top: 10px;
}

.settings-tab-button {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-bottom: none;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    margin-right: 3px;
    font-size: 14px;
    color: #6c757d;
    transition: all 0.2s ease;
}

.settings-tab-button:hover {
    background-color: #e9ecef;
    color: #495057;
}

.settings-tab-button.active {
    background-color: #fff;
    border-bottom: 1px solid #fff;
    color: #007bff;
    font-weight: 500;
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
}

/* ============ 表單樣式 ============ */
.form-row { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 12px; 
    align-items: center; 
    margin-bottom: 15px; 
}

.form-row input[type="text"], 
.form-row input[type="url"], 
.form-row input[type="text"]#rss-category { 
    flex: 1; 
    min-width: 200px; 
    padding: 12px; 
    border: 1px solid #ced4da; 
    border-radius: 5px;
}

.config-form label, 
.extractor-form label { 
    font-weight: 600; 
    margin-bottom: 5px; 
    display: block; 
}

.config-form input, 
.config-form textarea, 
.config-form select, 
.extractor-form input, 
.extractor-form select, 
.extractor-form textarea { 
    padding: 12px; 
    border: 1px solid #ced4da; 
    border-radius: 5px; 
    font-size: 15px; 
    width: 100%; 
    margin-bottom: 10px; 
    box-sizing: border-box; 
}

.config-form textarea#gemini-prompt { 
    min-height: 200px; 
    white-space: pre-wrap; 
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 
    resize: vertical; 
}

/* ============ 控制列 ============ */
.controls-row { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
    align-items: center; 
    margin-bottom: 15px; 
    padding: 10px; 
    background: #f8f9fa; 
    border-radius: 6px; 
    border: 1px solid #e9ecef; 
}

.controls-row label, 
.controls-row select, 
.controls-row input[type="number"] {
    padding: 6px 10px; 
    margin: 0 5px; 
    border: 1px solid #ced4da; 
    border-radius: 4px; 
    font-size: 14px;
}

.controls-row input[type="number"] { 
    width: 80px; 
}

.controls-row button { 
    margin-left: auto; 
}

/* ============ 狀態和結果顯示 ============ */
.loading { 
    display: none; 
    position: fixed;
    top: 10px;
    right: 10px;
    background: #007bff;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.9em;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: pulse 1.5s infinite;
    border: 2px solid #fff;
    min-width: 120px;
    text-align: center;
    backdrop-filter: blur(3px);
}

/* 移動裝置優化 */
@media (max-width: 768px) {
    .loading {
        top: 20px;
        right: 20px;
        left: 20px;
        right: 20px;
        max-width: calc(100% - 40px);
        font-size: 0.85em;
        padding: 8px 16px;
    }
}

/* 確保在深色模式下也清楚可見 */
@media (prefers-color-scheme: dark) {
    .loading {
        background: #28a745;
        border-color: #000;
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ============ Notification Bubble 樣式 ============ */
.notification-bubble {
    position: fixed;
    top: 60px;
    right: 10px;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9em;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 400px;
    word-wrap: break-word;
}

.notification-bubble.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-bubble.hide {
    transform: translateX(100%);
    opacity: 0;
}

.notification-bubble.success {
    background: #d1e7dd;
    color: #0f5132;
    border-left: 4px solid #198754;
}

.notification-bubble.error {
    background: #f8d7da;
    color: #842029;
    border-left: 4px solid #dc3545;
}

.notification-bubble.info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.notification-bubble.warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.result { 
    margin-top: 15px; 
    padding: 12px; 
    border-radius: 6px; 
    border: 1px solid transparent; 
}

.result.success { 
    background: #d1e7dd; 
    color: #0f5132; 
    border-color: #badbcc; 
}

.result.error {
    background: #f8d7da;
    color: #842029;
    border-color: #f5c2c7;
}

/* ============ Result Messages (Account Settings) ============ */
.result-message {
    padding: 12px 15px;
    margin: 10px 0;
    border-radius: 5px;
    font-size: 14px;
    border: 1px solid transparent;
}

.result-message.success {
    background: #d1e7dd;
    color: #0f5132;
    border-color: #badbcc;
}

.result-message.error {
    background: #f8d7da;
    color: #842029;
    border-color: #f5c2c7;
}

.result-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* ============ Flash 訊息 ============ */
.flash-message { 
    padding: 10px; 
    margin-bottom: 15px; 
    border-radius: 5px; 
    font-weight: bold; 
    text-align: center; 
}

.flash-message.error { 
    background-color: #f8d7da; 
    color: #721c24; 
    border: 1px solid #f5c6cb; 
}

.flash-message.success { 
    background-color: #d4edda; 
    color: #155724; 
    border: 1px solid #c3e6cb; 
}

.flash-message.info { 
    background-color: #d1ecf1; 
    color: #0c5460; 
    border: 1px solid #bee5eb; 
}

/* ============ 彈窗樣式 ============ */
.modal { 
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.4); 
}

.modal-content { 
    background-color: #fefefe; 
    margin: 10% auto; 
    padding: 25px; 
    border: 1px solid #888; 
    border-radius: 8px; 
    width: 80%; 
    max-width: 600px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); 
}

.close-button { 
    color: #aaa; 
    float: right; 
    font-size: 28px; 
    font-weight: bold; 
}

.close-button:hover, 
.close-button:focus { 
    color: black; 
    text-decoration: none; 
    cursor: pointer; 
}

/* ============ 互動元素 ============ */
.toggle-icon { 
    font-family: monospace; 
    font-size: 14px; 
    color: #6c757d; 
    transition: transform 0.2s ease; 
}

.bulk-controls button:hover { 
    transform: translateY(-1px); 
}

/* ============ SEO 連結管理樣式 ============ */
.seo-form {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.seo-form h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #495057;
}

.seo-links h4 {
    margin-bottom: 15px;
    color: #495057;
}

.seo-link-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 10px;
    background: white;
    transition: box-shadow 0.2s ease;
}

.seo-link-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.seo-link-info {
    flex: 1;
}

.seo-keyword {
    font-size: 16px;
    margin-bottom: 8px;
}

.seo-keyword strong {
    color: #007bff;
}

.seo-url {
    font-size: 14px;
    color: #6c757d;
}

.seo-url a {
    color: #28a745;
    text-decoration: none;
    word-break: break-all;
}

.seo-url a:hover {
    text-decoration: underline;
}

.seo-link-actions {
    display: flex;
    gap: 10px;
    margin-left: 15px;
}

.button.small {
    padding: 6px 12px;
    font-size: 13px;
    min-width: auto;
}

.btn-add {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.btn-add:hover {
    background: #0056b3;
}

/* ============ 關聯圖庫管理樣式 ============ */
.related-images-form {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.related-images-form h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #495057;
}

.related-images-filter {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 25px;
}

.related-images-filter h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #495057;
}

.related-images-list h4 {
    margin-bottom: 15px;
    color: #495057;
}

.related-image-item {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 15px;
    background: white;
    transition: box-shadow 0.2s ease;
    gap: 15px;
}

.related-image-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.related-image-item.inactive {
    opacity: 0.6;
    background: #f8f9fa;
}

.image-preview {
    flex-shrink: 0;
}

.image-preview img {
    border: 1px solid #dee2e6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.image-info {
    flex: 1;
    min-width: 0;
}

.image-keyword {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.image-keyword strong {
    color: #007bff;
    font-size: 16px;
}

.status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

.image-description {
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.4;
}

.image-url {
    margin-bottom: 8px;
}

.image-url a {
    color: #28a745;
    text-decoration: none;
    font-size: 13px;
}

.image-url a:hover {
    text-decoration: underline;
}

.image-meta {
    color: #6c757d;
    font-size: 12px;
}

.image-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-left: 15px;
    flex-shrink: 0;
}

.image-actions .button {
    white-space: nowrap;
    min-width: 60px;
}

.text-small {
    font-size: 13px;
}

.checkbox-row {
    margin: 15px 0;
}

.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
}

.checkbox-row input[type="checkbox"] {
    margin: 0;
}

/* ============ RSS 來源管理 ============ */
.rss-source-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.rss-source-details {
    flex: 1;
    margin-right: 15px;
}

.rss-source-details strong {
    color: #2c3e50;
    font-size: 16px;
}

.rss-source-details small {
    color: #6c757d;
    font-size: 13px;
}

.rss-source-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.rss-source-actions .button {
    padding: 6px 12px;
    font-size: 13px;
    min-width: auto;
}

.category-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 12px;
    color: white;
    background: #007bff;
    margin-right: 5px;
}

/* ============ 自動操作系統樣式 ============ */

/* 新功能徽章 */
.new-feature-badge {
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 自動操作控制面板 */
.automatic-operation-controls {
    margin-top: 15px;
}

.automatic-operation-controls .button {
    margin-right: 10px;
    margin-bottom: 10px;
}

/* 操作狀態顯示 */
.operation-status {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.status-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    font-weight: 600;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    animation: blink 1.5s infinite;
}

.status-dot.running {
    background: #28a745;
}

.status-dot.stopped {
    background: #6c757d;
}

.status-dot.error {
    background: #dc3545;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.status-text {
    font-size: 14px;
    color: #495057;
}

/* 操作統計 */
.operation-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.operation-stats .stat-item {
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: 10px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.operation-stats .stat-label {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 500;
}

.operation-stats .stat-value {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
}

/* 按鈕樣式增強 */
.button.success {
    background: #28a745;
    color: white;
    border: 1px solid #28a745;
}

.button.success:hover {
    background: #218838;
    border-color: #1e7e34;
}

.button.danger {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
}

.button.danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

/* ============ 科技關鍵字管理樣式 ============ */

.tech-keywords-form, .tech-keywords-filter {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.tech-keywords-form h4, .tech-keywords-filter h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 16px;
    font-weight: 600;
}

/* 緊密分類管理樣式 */
.category-management-compact {
    margin-top: 20px;
    padding: 15px;
    background: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.category-management-compact h5 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 14px;
    font-weight: 600;
}

.form-row-compact {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.form-row-compact select,
.form-row-compact input {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    min-width: 120px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-sm.btn-primary {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.btn-sm.btn-primary:hover {
    background: #0056b3;
    border-color: #004085;
}

.btn-sm.btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
}

.btn-sm.btn-secondary:hover {
    background: #5a6268;
    border-color: #545b62;
}

.btn-sm.btn-danger {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-sm.btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

.divider {
    color: #6c757d;
    margin: 0 5px;
    font-weight: normal;
}


.category-stats {
    margin-top: 20px;
}

.category-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #ffffff;
    transition: all 0.2s ease;
}

.category-stat-item:hover {
    border-color: #adb5bd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.category-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.keyword-count {
    color: #6c757d;
    font-size: 12px;
}

.category-actions {
    display: flex;
    gap: 6px;
}

.category-actions .btn {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 3px;
}

.tech-keywords-stats {
    background: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.stats-row {
    display: flex;
    gap: 30px;
    align-items: center;
}

.stats-row span {
    color: #495057;
    font-size: 14px;
}

.tech-keyword-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #ffffff;
    transition: all 0.2s ease;
}

.tech-keyword-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0,123,255,0.1);
}

.tech-keyword-item.inactive {
    background: #f8f9fa;
    opacity: 0.7;
}

.keyword-info {
    flex: 1;
    margin-right: 15px;
}

.keyword-main {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.keyword-text {
    font-size: 16px;
    color: #212529;
}

.category-badge {
    background: #6c757d;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.priority-badge {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    min-width: 20px;
    text-align: center;
}

.priority-badge.priority-10,
.priority-badge.priority-9 { background: #dc3545; }
.priority-badge.priority-8,
.priority-badge.priority-7 { background: #fd7e14; }
.priority-badge.priority-6,
.priority-badge.priority-5 { background: #ffc107; color: #212529; }
.priority-badge.priority-4,
.priority-badge.priority-3 { background: #20c997; }
.priority-badge.priority-2,
.priority-badge.priority-1 { background: #6c757d; }

.status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active {
    background: #d1edff;
    color: #0c63e4;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

.keyword-description {
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 6px;
    line-height: 1.4;
}

.keyword-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
}

.keyword-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.keyword-actions .btn {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.keyword-actions .btn-outline-primary {
    color: #007bff;
    border-color: #007bff;
}

.keyword-actions .btn-outline-primary:hover {
    background: #007bff;
    color: white;
}

.keyword-actions .btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
}

.keyword-actions .btn-outline-danger:hover {
    background: #dc3545;
    color: white;
}

/* 模態框樣式改進 */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-dialog {
    position: relative;
    margin: 50px auto;
    max-width: 500px;
    width: 90%;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-header {
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #212529;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
}

.btn-close:hover {
    color: #212529;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check-input {
    margin: 0;
}

.modal-footer {
    padding: 15px 20px 20px 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn {
    padding: 8px 16px;
    border: 1px solid;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    border-color: #545b62;
}

.btn-primary {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    border-color: #004085;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .operation-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .automatic-operation-controls .button {
        width: 100%;
        margin-right: 0;
    }
    
    .new-feature-badge {
        display: block;
        margin: 5px 0 0 0;
        text-align: center;
        width: fit-content;
    }
    
    .tech-keyword-item {
        flex-direction: column;
        gap: 15px;
    }
    
    .keyword-actions {
        align-self: stretch;
        justify-content: flex-end;
    }
    
    .keyword-main {
        flex-wrap: wrap;
    }
    
    .modal-dialog {
        margin: 20px auto;
        width: 95%;
    }
}

/* ============ 備份管理專用樣式 ============ */

.backup-actions {
    margin-bottom: 20px;
}

.backup-statistics {
    background: #f5f5f5;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
}

.backup-statistics h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #495057;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.stat-label {
    font-weight: 600;
    color: #6c757d;
}

.backup-list-container h4 {
    margin-bottom: 15px;
    color: #495057;
}

.filter-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.filter-controls select,
.filter-controls input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.backup-table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

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

.backup-table thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.backup-table th,
.backup-table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: middle;
}

.backup-table th {
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
}

.backup-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.backup-table tbody tr:hover {
    background: #e9ecef;
}

.backup-type {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.backup-type.type-system {
    background: #d4edda;
    color: #155724;
}

.backup-type.type-database {
    background: #cce5ff;
    color: #004085;
}

.backup-type.type-config {
    background: #fff3cd;
    color: #856404;
}

.backup-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
    min-width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-small:hover {
    opacity: 0.8;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.button.danger {
    background: #dc3545;
    color: white;
}

.button.danger:hover {
    background: #c82333;
}

.button.secondary {
    background: #6c757d;
    color: white;
}

.button.secondary:hover {
    background: #5a6268;
}

.message {
    padding: 12px 16px;
    border-radius: 4px;
    margin: 10px 0;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

/* ============ 自動備份設定專用樣式 ============ */

.auto-backup-settings {
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    padding: 20px;
    margin-bottom: 25px;
}

.auto-backup-settings h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #495057;
}

.button-toggle {
    float: right;
    font-size: 12px;
    padding: 2px 8px;
    border: 1px solid #ced4da;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.button-toggle:hover {
    background: #e9ecef;
}

.auto-backup-section {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.auto-backup-section h5 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
}

.backup-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.backup-status:contains('啟用'), .backup-status[data-status='enabled'] {
    background: #d4edda;
    color: #155724;
}

.backup-status:contains('停用'), .backup-status[data-status='disabled'] {
    background: #f8d7da;
    color: #721c24;
}

.backup-status:contains('執行中'), .backup-status[data-status='running'] {
    background: #fff3cd;
    color: #856404;
}

.auto-backup-section input[type="time"],
.auto-backup-section input[type="number"],
.auto-backup-section select {
    width: 100%;
    padding: 5px;
    font-size: 12px;
    border: 1px solid #ced4da;
    border-radius: 3px;
}

.auto-backup-section label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 600;
    margin-bottom: 3px;
    display: block;
}

.auto-backup-section input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.1);
}

#auto-backup-result {
    margin-top: 10px;
}

@media (max-width: 768px) {
    .auto-backup-section > div:first-child {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .auto-backup-section > div > div:nth-child(2) {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* ============ Movie Review 系統樣式 ============ */

.movie-region-tab-content {
    display: none;
}

.movie-region-tab-content.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    margin: 0;
}

.movie-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
}

.controls-row {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.movie-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.movie-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.movie-card.selected {
    border-color: #007bff;
    background: #f0f8ff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.movie-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

.movie-poster {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.movie-info {
    flex: 1;
}

.movie-rank {
    background: #6c757d;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 5px;
}

.movie-title {
    font-size: 16px;
    font-weight: bold;
    margin: 5px 0;
    color: #333;
}

.movie-price {
    font-size: 18px;
    font-weight: bold;
    color: #28a745;
    margin: 5px 0;
}

.movie-selection {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.movie-selection input[type="checkbox"] {
    transform: scale(1.2);
}

.movie-selection label {
    margin: 0;
    font-weight: 500;
    cursor: pointer;
}

.articles-grid {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.article-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background: white;
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.article-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.article-meta {
    display: flex;
    gap: 15px;
    align-items: center;
    color: #6c757d;
    font-size: 14px;
    margin: 10px 0;
}

.article-content-preview {
    color: #666;
    line-height: 1.5;
    margin: 15px 0;
}

.article-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.draft {
    background: #6c757d;
    color: white;
}

.status-badge.published {
    background: #28a745;
    color: white;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .movies-grid {
        grid-template-columns: 1fr;
    }
    
    .movie-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls-row {
        justify-content: center;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .movie-header {
        flex-direction: column;
        text-align: center;
    }
    
    .article-header {
        flex-direction: column;
        gap: 10px;
    }
}

/* ============ 暫存關鍵字管理樣式 ============ */

.temp-keywords-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.temp-keywords-section h3 {
    color: #495057;
    margin-bottom: 10px;
}

.temp-keywords-section h4 {
    color: #6c757d;
    margin-bottom: 15px;
    margin-top: 25px;
}

.temp-keywords-stats {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.temp-keywords-stats .stats-row {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.temp-keywords-stats .stats-row span {
    font-size: 14px;
    color: #6c757d;
}

.temp-keywords-stats .stats-row strong {
    color: #495057;
    font-weight: 600;
}

.temp-keywords-controls,
.temp-keywords-batch-operations {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.temp-keywords-controls .form-row,
.temp-keywords-batch-operations .form-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.temp-keywords-controls select,
.temp-keywords-batch-operations select,
.temp-keywords-batch-operations input[type="number"] {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.temp-keywords-list {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    overflow: hidden;
}

.temp-keywords-list h4 {
    margin: 0;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    color: #495057;
}

.temp-keyword-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.temp-keyword-item:last-child {
    border-bottom: none;
}

.temp-keyword-item:hover {
    background: #f8f9fa;
}

.temp-keyword-item.selected {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.temp-keyword-item .keyword-checkbox {
    margin-right: 15px;
}

.temp-keyword-item .keyword-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.temp-keyword-item .keyword-info {
    flex: 1;
    margin-right: 15px;
}

.temp-keyword-item .keyword-main {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 5px;
}

.temp-keyword-item .keyword-text {
    font-weight: 600;
    color: #495057;
    font-size: 16px;
}

.temp-keyword-item .occurrence-count {
    background: #17a2b8;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.temp-keyword-item .keyword-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #6c757d;
}

.temp-keyword-item .source-title {
    font-style: italic;
}

.temp-keyword-item .time-info {
    font-size: 11px;
}

.temp-keyword-item .suggested-category {
    font-weight: 500;
    color: #28a745;
}

.temp-keyword-item .keyword-actions {
    display: flex;
    gap: 8px;
}

.temp-keyword-item .keyword-actions .btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.temp-keyword-item .keyword-actions .btn-sm.btn-success {
    background: #28a745;
    color: white;
}

.temp-keyword-item .keyword-actions .btn-sm.btn-success:hover {
    background: #218838;
}

.temp-keyword-item .keyword-actions .btn-sm.btn-danger {
    background: #dc3545;
    color: white;
}

.temp-keyword-item .keyword-actions .btn-sm.btn-danger:hover {
    background: #c82333;
}

.temp-keyword-item .keyword-actions .btn-sm i {
    margin-right: 4px;
}

/* 信心度和來源標記 */
.temp-keyword-item .badge {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.temp-keyword-item .badge.badge-success {
    background: #28a745;
    color: white;
}

.temp-keyword-item .badge.badge-warning {
    background: #ffc107;
    color: #212529;
}

.temp-keyword-item .badge.badge-danger {
    background: #dc3545;
    color: white;
}

.temp-keyword-item .badge.badge-primary {
    background: #007bff;
    color: white;
}

.temp-keyword-item .badge.badge-info {
    background: #17a2b8;
    color: white;
}

.temp-keyword-item .badge.badge-secondary {
    background: #6c757d;
    color: white;
}

/* 空狀態和載入狀態 */
.temp-keywords-list .empty-message,
.temp-keywords-list .loading-message {
    padding: 40px 20px;
    text-align: center;
    color: #6c757d;
}

.temp-keywords-list .empty-message i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #dee2e6;
}

.temp-keywords-list .empty-message p {
    margin: 15px 0 5px 0;
    font-size: 16px;
    font-weight: 500;
}

.temp-keywords-list .empty-message small {
    font-size: 14px;
    color: #868e96;
}

.temp-keywords-list .loading-message i {
    margin-right: 8px;
}

/* 按鈕樣式 */
.btn-primary {
    background: #007bff;
    border: 1px solid #007bff;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    border: 1px solid #6c757d;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-success {
    background: #28a745;
    border: 1px solid #28a745;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    border: 1px solid #dc3545;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-danger:hover {
    background: #c82333;
}

/* 結果訊息樣式 */
#temp-keywords-result .result-message {
    padding: 12px 16px;
    border-radius: 4px;
    margin-top: 15px;
    font-size: 14px;
}

#temp-keywords-result .result-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

#temp-keywords-result .result-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

#temp-keywords-result .result-message.warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

#temp-keywords-result .result-message.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .temp-keywords-controls .form-row,
    .temp-keywords-batch-operations .form-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .temp-keywords-stats .stats-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .temp-keyword-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .temp-keyword-item .keyword-checkbox {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .temp-keyword-item .keyword-info {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .temp-keyword-item .keyword-main {
        flex-wrap: wrap;
    }
    
    .temp-keyword-item .keyword-meta {
        flex-direction: column;
        gap: 6px;
    }
    
    .temp-keyword-item .keyword-actions {
        justify-content: center;
    }
}

/* ============ 社交媒體引言生成專用樣式 ============ */

/* 社交媒體引言模態框 */
.social-intro-modal {
    max-width: 900px;
    width: 90%;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #495057;
    font-size: 1.3em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.modal-close:hover {
    color: #495057;
}

.modal-body {
    padding: 25px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 文章參考區域 */
.article-reference {
    margin-bottom: 20px;
    padding: 15px;
    background: #e3f2fd;
    border-radius: 6px;
    border-left: 4px solid #2196f3;
}

.article-reference h4 {
    margin: 0 0 5px 0;
    color: #1976d2;
}

/* 引言預覽區域 */
.intro-preview-section {
    margin-bottom: 25px;
}

.intro-preview-section h4 {
    margin: 0 0 15px 0;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.intro-preview-container {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.intro-preview-text {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: none;
    background: #f8f9fa;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.intro-preview-text:focus {
    outline: none;
    background: #fff;
    box-shadow: inset 0 0 0 2px #007bff;
}

.intro-actions {
    padding: 12px 15px;
    background: #ffffff;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.intro-actions .button {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Facebook 預覽樣式 */
.social-platform-preview {
    margin-bottom: 25px;
}

.social-platform-preview h4 {
    margin: 0 0 15px 0;
    color: #495057;
}

.facebook-preview {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    padding: 16px;
    max-width: 500px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.fb-post-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.fb-avatar {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    background: #1877f2;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 10px;
}

.fb-user-info {
    flex: 1;
}

.fb-user-name {
    font-weight: 600;
    color: #1c1e21;
    font-size: 15px;
}

.fb-post-time {
    font-size: 13px;
    color: #65676b;
}

.fb-post-content {
    color: #1c1e21;
    line-height: 1.5;
    font-size: 15px;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.fb-post-actions {
    border-top: 1px solid #e4e6ea;
    padding-top: 8px;
    display: flex;
    justify-content: space-around;
    color: #65676b;
    font-size: 14px;
}

.fb-post-actions span {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.fb-post-actions span:hover {
    background-color: #f2f3f5;
}

/* 使用建議區域 */
.usage-tips {
    margin-bottom: 20px;
}

.usage-tips h4 {
    margin: 0 0 15px 0;
    color: #495057;
}

.usage-tips ul {
    margin: 0;
    padding-left: 20px;
}

.usage-tips li {
    margin-bottom: 8px;
    line-height: 1.5;
    color: #6c757d;
}

/* 批次處理樣式 */
.batch-summary {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.summary-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-item {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
}

.stat-item.success {
    background: #d4edda;
    color: #155724;
}

.stat-item.error {
    background: #f8d7da;
    color: #721c24;
}

.batch-results {
    max-height: 400px;
    overflow-y: auto;
}

.batch-result-item {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.batch-result-item.success {
    background: #f8fff9;
    border-color: #c3e6cb;
}

.batch-result-item.error {
    background: #fff5f5;
    border-color: #f5c6cb;
}

.result-header {
    font-weight: 600;
    margin-bottom: 8px;
}

.result-preview {
    font-size: 13px;
    color: #6c757d;
    line-height: 1.4;
}

.result-error {
    font-size: 13px;
    font-weight: 500;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .social-intro-modal {
        width: 95%;
        margin: 20px auto;
    }
    
    .modal-body {
        padding: 20px;
        max-height: 60vh;
    }
    
    .facebook-preview {
        max-width: 100%;
    }
    
    .summary-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .intro-actions {
        flex-direction: column;
    }
    
    .intro-actions .button {
        justify-content: center;
    }
}

/* ============ 標題建議功能樣式 ============ */

/* 標題建議區域 */
.title-suggestions-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.title-suggestions-section h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.1em;
}

.button-small {
    padding: 6px 12px;
    font-size: 0.85em;
    border: 1px solid #007bff;
    background: #007bff;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button-small:hover:not(:disabled) {
    background: #0056b3;
    border-color: #0056b3;
}

.button-small:disabled {
    background: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
}

/* 標題建議容器 */
.title-suggestions-container {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
}

/* 載入動畫 */
.loading-spinner-small {
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

/* 標題建議列表 */
.title-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 單個標題建議項目 */
.title-suggestion-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.title-suggestion-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.title-suggestion-content {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    gap: 12px;
}

/* 標題編號 */
.title-number {
    width: 24px;
    height: 24px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 600;
    flex-shrink: 0;
}

/* 標題文字 */
.title-text {
    flex: 1;
    font-size: 0.95em;
    line-height: 1.4;
    color: #212529;
    font-weight: 500;
}

/* 複製按鈕 */
.title-copy-btn {
    padding: 6px 12px;
    font-size: 0.8em;
    background: #28a745;
    color: white;
    border: 1px solid #28a745;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.title-copy-btn:hover {
    background: #218838;
    border-color: #1e7e34;
}

.title-copy-btn:active {
    transform: translateY(1px);
}

/* 響應式設計 - 標題建議 */
@media (max-width: 768px) {
    .title-suggestions-section h4 {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .title-suggestion-content {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
        gap: 10px;
    }
    
    .title-number {
        align-self: flex-start;
    }
    
    .title-text {
        font-size: 0.9em;
    }
    
    .title-copy-btn {
        align-self: flex-end;
        width: 100%;
        text-align: center;
    }
}

/* ============ 動畫效果 ============ */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* ============ API Key 管理樣式 ============ */
.api-keys-management-section {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.api-keys-management-section h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-new {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: normal;
}

.api-keys-management-section .hint {
    margin: 0 0 15px 0;
    color: #6c757d;
    font-size: 0.9em;
    line-height: 1.5;
}

/* API Key 自動切換開關 */
.api-key-auto-switch-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s ease;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s ease;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #28a745;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-weight: 500;
    color: #495057;
    cursor: pointer;
}

.toggle-hint {
    font-size: 0.85em;
    color: #6c757d;
}

#api-keys-container {
    margin-bottom: 15px;
}

.api-key-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.api-key-row:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.api-key-row.is-current {
    border-color: #28a745;
    background: #f0fff4;
}

.api-key-row.is-exhausted {
    border-color: #dc3545;
    background: #fff5f5;
    opacity: 0.7;
}

.api-key-input-group {
    flex: 1;
    display: flex;
    gap: 10px;
}

.api-key-input-group input[type="text"] {
    flex: 2;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9em;
}

.api-key-input-group input[type="password"] {
    flex: 3;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.api-key-input-group input[type="password"]::placeholder {
    font-family: system-ui, -apple-system, sans-serif;
}

.api-key-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.api-key-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.api-key-status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 500;
    white-space: nowrap;
}

.status-badge-current {
    background: #28a745;
    color: white;
}

.status-badge-available {
    background: #17a2b8;
    color: white;
}

.status-badge-exhausted {
    background: #dc3545;
    color: white;
}

.api-key-actions {
    display: flex;
    gap: 5px;
}

.btn-key-action {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s ease;
}

.btn-key-switch {
    background: #007bff;
    color: white;
}

.btn-key-switch:hover {
    background: #0056b3;
}

.btn-key-switch:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-key-reset {
    background: #ffc107;
    color: #212529;
}

.btn-key-reset:hover {
    background: #e0a800;
}

.btn-key-reset:disabled {
    background: #6c757d;
    color: white;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-key-delete {
    background: #dc3545;
    color: white;
}

.btn-key-delete:hover {
    background: #c82333;
}

.btn-add-key {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.btn-add-key:hover {
    background: #218838;
}

.api-key-status-section {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.api-key-status-section h5 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 1em;
}

.status-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.status-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    text-align: center;
}

.status-item .label {
    font-size: 0.85em;
    color: #6c757d;
    margin-bottom: 5px;
}

.status-item .value {
    font-size: 1.2em;
    font-weight: 600;
    color: #495057;
}

.status-item .value.success {
    color: #28a745;
}

.status-item .value.warning {
    color: #ffc107;
}

.status-item .value.danger {
    color: #dc3545;
}

.api-key-empty-state {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-size: 0.9em;
}

.loading-spinner-inline {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 5px;
}

/* ==================== Limited Time Offers Styles ==================== */

.lto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.lto-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.lto-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.lto-card-thumbnail {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: #f8f9fa;
    background-repeat: no-repeat;
}

.lto-card-content {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.lto-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.lto-card-date {
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
}

.lto-card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #212529;
    line-height: 1.4;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.lto-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.lto-card-actions .button {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 4px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .lto-grid {
        grid-template-columns: 1fr;
    }

    .lto-card-actions {
        flex-direction: column;
    }

    .lto-card-actions .button {
        width: 100%;
    }
}

.text-muted {
    color: #6c757d;
}

.lto-subtabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.lto-subtab-button {
    border: none;
    background: none;
    padding: 8px 14px;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.lto-subtab-button.active {
    color: #0056b3;
    border-bottom-color: #0056b3;
}

.lto-subtab-content {
    display: none;
}

.lto-subtab-content.active {
    display: block;
}

.lto-inline-stats {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 14px;
}

.lto-loading,
.lto-empty {
    text-align: center;
    padding: 40px;
}

.lto-error {
    padding: 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
    margin-bottom: 15px;
}

.lto-auto-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.lto-auto-actions {
    display: flex;
    gap: 10px;
}

.lto-auto-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.lto-auto-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lto-auto-card .card-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6c757d;
}

.lto-auto-card .card-value {
    font-size: 22px;
    font-weight: 700;
    color: #212529;
}

.lto-auto-card .card-meta {
    font-size: 13px;
    color: #495057;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lto-auto-toggle {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.lto-auto-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.lto-auto-form label {
    font-size: 14px;
    color: #495057;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
}

.lto-auto-form input[type="text"],
.lto-auto-form input[type="number"],
.lto-auto-form select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ced4da;
    font-size: 14px;
}

.lto-auto-form input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.lto-auto-form .form-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lto-auto-runs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lto-auto-run-item {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.lto-auto-run-item .run-title {
    font-weight: 600;
    color: #212529;
}

.lto-auto-run-item .run-meta {
    font-size: 13px;
    color: #6c757d;
}

.run-status-pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.run-status-pill.completed {
    background: #e1f5ea;
    color: #0f8b46;
}

.run-status-pill.failed {
    background: #fdecea;
    color: #b02a37;
}

.run-status-pill.processing {
    background: #fff3cd;
    color: #a07910;
}

.run-status-pill.skipped {
    background: #e2e3e5;
    color: #5c636a;
}

.lto-auto-pill {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.lto-auto-pill.success {
    background: #e1f5ea;
    color: #0f8b46;
}

.lto-auto-pill.warning {
    background: #fff3cd;
    color: #a07910;
}

.lto-auto-pill.danger {
    background: #fdecea;
    color: #b02a37;
}

.lto-auto-pill.muted {
    background: #e2e3e5;
    color: #5c636a;
}
