/* SDS_Site 統一樣式表 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 全域平滑滾動 */
html {
    scroll-behavior: smooth;
}

/* 輔助功能類別 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    
    /* 新增特殊區域色彩變量 */
    --hero-bg-start: #667eea;
    --hero-bg-end: #764ba2;
    --hero-card-bg: rgba(255, 255, 255, 0.95);
    --hero-card-border: rgba(102, 126, 234, 0.2);
    --hero-title-color: #4c1d95;
    --hero-text-color: #5b21b6;
    --hero-text-light: #7c3aed;
    --hero-highlight-bg: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(139, 92, 246, 0.15));
    --hero-highlight-border: rgba(124, 58, 237, 0.25);
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* Navigation colors */
    --nav-bg: var(--bg-primary);
    --nav-text: var(--text-primary);
    --nav-link-hover: var(--primary-color);
    --nav-active: var(--primary-color);
    --nav-separator: var(--border-color);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden; /* 防止水平滾動 */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
}

/* 有sidebar時的container調整 - 保持置中 */
body.has-sidebar-nav .container {
    max-width: 1200px;
    /* Sidebar 隱藏時，container 完全置中 */
    margin: 0 auto;
    padding: 20px;
}

/* 移除舊的 collapsed 相關設定 */

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Main Card */
.main-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 30px;
}

/* 首頁專用卡片 */
.home-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.home-card h2 {
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
}

.home-card p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 32px;
}

/* 工具列表 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.tool-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-primary);
    display: block;
}

.tool-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.tool-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.tool-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
}

.tool-item h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.tool-item p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

/* 按鈕樣式 */
.btn {
    height: 44px;
    padding: 0 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: white;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    font-weight: 500;
}

.btn-secondary:hover {
    background: #f9fafb;
    color: #374151;
    border-color: #d1d5db;
}

.btn-success {
    background: var(--success-color);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.button {
    display: inline-block;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 8px;
}

.button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Toolbar */
.toolbar {
    background: var(--bg-secondary);
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

/* 工具列分組 */
.toolbar-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.toolbar-group.primary {
    gap: 16px;
}

.toolbar-group.secondary {
    gap: 8px;
    padding-left: 8px;
    border-left: 1px solid #e5e7eb;
}

.toolbar-divider {
    width: 1px;
    height: 32px;
    background: #e5e7eb;
    margin: 0 4px;
}

/* Toggle Switch 樣式 */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 24px;
    background: #d1d5db;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    top: 2px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked ~ .toggle-slider {
    background: #3b82f6;
}

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

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}

.toggle-switch:hover .toggle-slider {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15), 0 0 0 3px rgba(59, 130, 246, 0.1);
}


/* 工具列中的複選框特殊樣式 */
.toolbar .checkbox-label {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
} 

/* Editor Container - JSON Formatter 專用 */
.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border-color);
    min-height: 500px;
}

.editor-panel {
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
}

.panel-header {
    background: var(--bg-secondary);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.editor {
    flex: 1;
    padding: 20px;
    border: none;
    outline: none;
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 400px;
    max-height: 500px;
    overflow-y: auto;
}

.editor:focus {
    background: #fafbfc;
}

.output {
    flex: 1;
    padding: 20px;
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-y: auto;
    background: var(--bg-primary);
    min-height: 400px;
    max-height: 500px;
}

.output.editable-output {
    outline: none;
    cursor: text;
}

.output.editable-output:focus {
    background: #fafbfc;
    box-shadow: inset 0 0 0 2px var(--primary-color);
}

/* Status Bar */
.status-bar {
    background: var(--bg-secondary);
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-valid {
    color: var(--success-color);
}

.status-error {
    color: var(--error-color);
}

.status-warning {
    color: var(--warning-color);
}

/* 圖片上傳區域樣式 */
.image-drop-zone {
    flex: 1;
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    margin: 20px;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

.image-drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
    transform: scale(1.02);
}

.drop-zone-content {
    text-align: center;
    padding: 20px;
}

.drop-zone-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.drop-zone-text {
    margin-bottom: 1rem;
}

.drop-zone-text p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

.drop-zone-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.drop-zone-info {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.8;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.image-preview {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    margin: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--success-color);
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    margin-bottom: 15px;
}

.image-info {
    text-align: center;
    margin-top: 10px;
}

.image-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
    word-break: break-all;
}

.image-size {
    font-size: 12px;
    color: var(--text-secondary);
}

.image-base64-output {
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    word-break: break-all;
    white-space: pre-wrap;
}

/* Loading 覆蓋層樣式 */
.image-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    border-radius: var(--radius-md);
    margin: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border: 2px solid var(--primary-color);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.loading-progress {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.4;
}

/* Toast 樣式 (如果不存在) */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-bottom: 10px;
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-in-out;
    pointer-events: auto;
    border-left: 4px solid;
}

.toast-success {
    border-left-color: var(--success-color);
}

.toast-error {
    border-left-color: var(--error-color);
}

.toast-warning {
    border-left-color: var(--warning-color);
}

.toast-info {
    border-left-color: var(--primary-color);
}

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

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

.toast-content {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 12px;
}

.toast-icon {
    flex-shrink: 0;
}

.toast-success .toast-icon {
    color: var(--success-color);
}

.toast-error .toast-icon {
    color: var(--error-color);
}

.toast-warning .toast-icon {
    color: var(--warning-color);
}

.toast-info .toast-icon {
    color: var(--primary-color);
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    opacity: 0.3;
    animation: progress linear;
}

@keyframes progress {
    from { width: 100%; }
    to { width: 0%; }
}

/* JSON Syntax Highlighting */
.json-string { color: #059669; }
.json-number { color: #dc2626; }
.json-boolean { color: #7c3aed; }
.json-null { color: #6b7280; }
.json-key { color: #1d4ed8; font-weight: 500; }
.json-punctuation { color: #374151; }

/* Error Message */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--error-color);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    user-select: text; /* 允許選擇文字但不能編輯 */
    cursor: default;
}

/* 錯誤狀態的輸出容器 */
.output.error-state {
    background: #fef7f7 !important;
    border: 2px solid #fecaca !important;
    cursor: not-allowed;
}

.output.error-state:hover {
    background: #fef7f7 !important;
    box-shadow: inset 0 0 0 2px #fecaca !important;
}

.output.error-state:focus {
    background: #fef7f7 !important;
    box-shadow: inset 0 0 0 2px #fecaca !important;
    outline: none;
}

/* Features Section */
.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 40px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: white;
    text-align: center;
}

.feature-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.5;
}

/* 使用說明區域 */
.how-to-use {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-top: 24px;
    box-shadow: var(--shadow-md);
}

.how-to-use h2 {
    text-align: center;
    color: var(--hero-title-color);
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 32px;
    background: var(--hero-highlight-bg);
    border: 1px solid var(--hero-highlight-border);
    border-radius: var(--radius-md);
    padding: 16px;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.step:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    background: rgba(255, 255, 255, 0.95);
}

.step-number {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.step h3 {
    color: var(--hero-title-color);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.step p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 280px;
}

@media (max-width: 768px) {
    .how-to-use {
        padding: 24px 20px;
    }
    
    .how-to-use h2 {
        font-size: 1.5rem;
        padding: 12px;
    }
    
    .steps {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .step {
        padding: 20px;
    }
}

/* 數據庫支援區域 */
.database-support {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-top: 24px;
    box-shadow: var(--shadow-md);
}

.database-support h2 {
    text-align: center;
    color: var(--hero-title-color);
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 32px;
    background: var(--hero-highlight-bg);
    border: 1px solid var(--hero-highlight-border);
    border-radius: var(--radius-md);
    padding: 16px;
}

.database-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.database-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.database-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--primary-color);
}

.database-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.database-card h3 {
    color: var(--hero-title-color);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.database-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 260px;
}

@media (max-width: 768px) {
    .database-support {
        padding: 24px 20px;
    }
    
    .database-support h2 {
        font-size: 1.5rem;
        padding: 12px;
    }
    
    .database-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 16px;
    }
    
    .database-card {
        padding: 20px;
    }
    
    .database-icon {
        font-size: 2rem;
        height: 50px;
    }
}

/* 導航區域 */
.navigation {
    text-align: center;
    margin-top: 24px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    margin: 0 12px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    font-weight: 500;
    display: inline-block;
}

.nav-link:hover {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .toolbar {
        padding: 16px;
        gap: 12px;
    }
    
    .toolbar-group.primary {
        width: 100%;
        gap: 12px;
    }
    
    .toolbar-group.secondary {
        width: 100%;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid #e5e7eb;
        padding-top: 12px;
    }
    
    .toolbar-divider {
        display: none;
    }
    
    .btn {
        flex: 1;
        justify-content: center;
        font-size: 13px;
        padding: 0 12px;
    }
    
    .btn svg {
        width: 14px;
        height: 14px;
    }
    
    .toggle-switch {
        width: 100%;
        justify-content: center;
        padding-top: 12px;
        border-top: 1px solid #e5e7eb;
        padding: 15px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .header p {
        font-size: 1rem;
    }

    .home-card {
        padding: 24px;
    }

    .home-card h2 {
        font-size: 1.5rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .editor-container {
        grid-template-columns: 1fr;
        grid-template-rows: 300px 300px;
    }

    .toolbar {
        padding: 15px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
        flex: 1;
        min-width: 120px;
    }

    .features {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    
    /* 圖片上傳區域響應式 */
    .image-drop-zone {
        min-height: 200px;
        margin: 15px;
    }
    
    .drop-zone-icon {
        font-size: 2rem;
    }
    
    .image-preview {
        margin: 15px;
        padding: 15px;
    }
    
    .image-preview img {
        max-height: 150px;
    }
    
    /* Loading 覆蓋層響應式 */
    .image-loading-overlay {
        margin: 15px;
        padding: 15px;
    }
    
    .loading-spinner {
        width: 30px;
        height: 30px;
        border-width: 3px;
    }
    
    .loading-text {
        font-size: 14px;
    }
    
    .loading-progress {
        font-size: 12px;
    }
    
    /* Toast 響應式 */
    .toast-container {
        right: 10px;
        top: 10px;
    }
    
    .toast {
        min-width: 250px;
        max-width: 300px;
    }
    
    /* 導航區域響應式 */
    .navigation {
        padding: 16px;
        margin-top: 20px;
    }
    
    .nav-link {
        display: block;
        margin: 8px 0;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    /* Info Card 響應式 */
    .info-card {
        padding: 20px;
        margin: 20px 0;
    }
    
    .info-card::before {
        top: 20px;
        left: 20px;
        width: 28px;
        height: 28px;
        font-size: 1.1rem;
    }
    
    .info-card-content {
        margin-left: 48px;
    }
    
    .info-card h4 {
        font-size: 1rem;
    }
    
    .info-card p {
        font-size: 0.9rem;
    }
    
    /* 首頁按鈕響應式 */
    .home-card .button {
        width: 100%;
        margin: 8px 0 !important;
        text-align: center;
    }
    
    .home-card div[style*="display: flex"] {
        flex-direction: column !important;
        align-items: center !important;
    }
    
    /* Hero CTA 響應式 */
    .hero-cta-buttons {
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px !important;
    }
    
    .hero-cta-button {
        width: 90%;
        max-width: 280px;
    }
    
    .hero-cta-section h2 {
        font-size: 1.5rem;
    }
    
    .hero-cta-section p {
        font-size: 1rem;
    }
}

/* 建置中狀態樣式 */
.coming-soon {
    color: var(--warning-color) !important;
    font-style: italic;
    position: relative;
}

.coming-soon::after {
    content: " 🚧";
    opacity: 0.7;
}

.contact-item.disabled {
    opacity: 0.7;
    position: relative;
}

.contact-item.disabled .icon {
    color: var(--warning-color);
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--warning-color);
    margin-left: 8px;
    vertical-align: middle;
}

.info-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 24px 0;
    position: relative;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.info-card:hover {
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.info-card::before {
    content: "ℹ️";
    position: absolute;
    top: 24px;
    left: 24px;
    font-size: 1.3rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.info-card-content {
    margin-left: 56px;
}

.info-card h4 {
    color: var(--hero-title-color);
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 1.1rem;
}

.info-card p {
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 0.95rem;
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .home-card {
        padding: 20px;
    }

    .tool-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .tool-icon img {
        width: 28px;
        height: 28px;
    }
    
    .features {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Toast 通知系統樣式 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    width: 100%;
    pointer-events: none;
}

.toast {
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-bottom: 12px;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    border-left: 4px solid;
    backdrop-filter: blur(10px);
}

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

.toast-hide {
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease-in;
}

.toast-content {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
    position: relative;
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-top: 2px;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    font-weight: 500;
    word-wrap: break-word;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    margin-top: -2px;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    animation: toast-progress 3s linear forwards;
    opacity: 0.7;
}

/* Toast 類型樣式 */
.toast-success {
    border-left-color: var(--success-color);
    background: #ffffff;
}

.toast-success .toast-icon {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.toast-success .toast-progress {
    color: var(--success-color);
}

.toast-error {
    border-left-color: var(--error-color);
    background: #ffffff;
}

.toast-error .toast-icon {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

.toast-error .toast-progress {
    color: var(--error-color);
}

.toast-warning {
    border-left-color: var(--warning-color);
    background: #ffffff;
}

.toast-warning .toast-icon {
    color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
}

.toast-warning .toast-progress {
    color: var(--warning-color);
}

.toast-info {
    border-left-color: var(--primary-color);
    background: #ffffff;
}

.toast-info .toast-icon {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
}

.toast-info .toast-progress {
    color: var(--primary-color);
}

/* Toast 進度條動畫 */
@keyframes toast-progress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Toast 響應式設計 */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast {
        transform: translateY(-100px);
    }
    
    .toast-show {
        transform: translateY(0);
    }
    
    .toast-hide {
        transform: translateY(-100px);
    }
    
    .toast-content {
        padding: 14px;
    }
    
    .toast-message {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .toast-container {
        top: 5px;
        right: 5px;
        left: 5px;
    }
    
    .toast-content {
        padding: 12px;
        gap: 10px;
    }
    
    .toast-icon {
        width: 20px;
        height: 20px;
    }
    
    .toast-message {
        font-size: 12px;
    }
}

/* Toast 暗色主題支援 */
@media (prefers-color-scheme: dark) {
    .toast {
        background: #ffffff;
        color: #1e293b;
    }
    
    .toast-message {
        color: #1e293b;
    }
    
    .toast-close {
        color: #64748b;
    }
    
    .toast-close:hover {
        background: rgba(0, 0, 0, 0.1);
        color: #1e293b;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Copy Success Animation */
.copy-success {
    background: var(--success-color) !important;
    transform: scale(0.95);
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-primary);
    z-index: 1000;
}

/* 頁腳 */
.footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-top: 40px;
    padding: 20px 0;
}

.footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

.footer a:hover {
    color: white;
    text-decoration: underline;
}

/* Hero CTA 區域專用樣式 */
.hero-cta-section {
    background: var(--hero-card-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--hero-card-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.1);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.hero-cta-section:hover {
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.hero-cta-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--hero-highlight-bg);
    opacity: 0.6;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.hero-cta-section:hover::before {
    opacity: 0.8;
}

.hero-cta-section h2 {
    color: var(--hero-title-color);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 0 1px 2px rgba(76, 29, 149, 0.1);
    position: relative;
    z-index: 1;
}

.hero-cta-section p {
    color: var(--hero-text-color);
    font-size: 1.15rem;
    line-height: 1.8;
    margin-bottom: 32px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(91, 33, 182, 0.1);
    position: relative;
    z-index: 1;
}

.hero-cta-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-cta-button {
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 0;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.hero-cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
    z-index: -1;
}

.hero-cta-button:hover::before {
    left: 100%;
}

.hero-cta-button.primary {
    background: linear-gradient(135deg, var(--hero-title-color), var(--hero-text-color));
    color: white;
    border: 2px solid transparent;
}

.hero-cta-button.primary:hover {
    background: linear-gradient(135deg, #5b21b6, #7c3aed);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(76, 29, 149, 0.4);
}

.hero-cta-button.secondary {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    border: 2px solid transparent;
}

.hero-cta-button.secondary:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.hero-cta-button.building {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
    color: white;
    border: 2px solid transparent;
}

.hero-cta-button.building:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

/* ==================================================
   共用元件樣式 - Common Components
   ================================================== */

/* 自定義複選框組件 - Custom Checkbox Component */
.checkbox-container {
    display: flex;
    align-items: center;
    margin-right: 20px;
    max-width: 280px;
}

.custom-checkbox {
    position: absolute;
    opacity: 0;
    height: 0;
    width: 0;
}

.checkbox-label {
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    user-select: none;
    display: flex;
    align-items: center;
    line-height: 1.3;
    word-wrap: break-word;
}

.checkbox-label:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.custom-checkbox:checked + .checkbox-label:before {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.custom-checkbox:checked + .checkbox-label:after {
    content: '✓';
    position: absolute;
    left: 5px;
    top: 1px;
    color: white;
    font-size: 14px;
}

.custom-checkbox:focus + .checkbox-label:before {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.custom-checkbox:hover + .checkbox-label:before {
    border-color: var(--primary-hover);
}

.custom-checkbox:disabled + .checkbox-label {
    opacity: 0.6;
    cursor: not-allowed;
}

.custom-checkbox:disabled + .checkbox-label:before {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .checkbox-container {
        max-width: 100%;
        margin-bottom: 12px;
        margin-right: 0;
    }

    .checkbox-label {
        font-size: 12px;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .checkbox-container {
        margin-bottom: 8px;
    }
    
    .checkbox-label {
        font-size: 11px;
        padding-left: 25px;
    }
    
    .checkbox-label:before {
        width: 18px;
        height: 18px;
    }
    
    .custom-checkbox:checked + .checkbox-label:after {
        left: 4px;
        font-size: 12px;
    }
}

/* ===== 自定義滾動條樣式 ===== */

/* Webkit 瀏覽器滾動條 (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

*::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-radius: 6px;
    border: 2px solid var(--bg-secondary);
    transition: all 0.3s ease;
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-hover), #1d4ed8);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

*::-webkit-scrollbar-thumb:active {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

*::-webkit-scrollbar-corner {
    background: var(--bg-secondary);
}

/* 針對特定元素的精細化滾動條樣式 */

/* 編輯器區域滾動條 */
.editor::-webkit-scrollbar,
.output::-webkit-scrollbar,
textarea::-webkit-scrollbar {
    width: 10px;
}

.editor::-webkit-scrollbar-track,
.output::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
}

.editor::-webkit-scrollbar-thumb,
.output::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #64748b, #475569);
    border-radius: 5px;
    border: 1px solid #f8fafc;
}

.editor::-webkit-scrollbar-thumb:hover,
.output::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2);
}

/* 導航區域滾動條 */
.navigation::-webkit-scrollbar {
    width: 8px;
}

.navigation::-webkit-scrollbar-track {
    background: transparent;
}

.navigation::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.5);
    border-radius: 4px;
}

.navigation::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

/* Firefox 滾動條樣式 */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-secondary);
}

.editor,
.output {
    scrollbar-width: thin;
    scrollbar-color: #64748b #f8fafc;
}

/* 針對特殊輸入元素 */
textarea,
[contenteditable="true"] {
    scrollbar-width: thin;
    scrollbar-color: #64748b #f8fafc;
}

.navigation {
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.5) transparent;
}

/* 深色主題時的滾動條調整 */
@media (prefers-color-scheme: dark) {
    *::-webkit-scrollbar-track {
        background: #1e293b;
        border-color: #334155;
    }

    *::-webkit-scrollbar-thumb {
        background: linear-gradient(135deg, #475569, #64748b);
        border-color: #1e293b;
    }

    *::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    }

    .editor::-webkit-scrollbar-track,
    .output::-webkit-scrollbar-track,
    textarea::-webkit-scrollbar-track {
        background: #0f172a;
        border-color: #1e293b;
    }

    .editor::-webkit-scrollbar-thumb,
    .output::-webkit-scrollbar-thumb,
    textarea::-webkit-scrollbar-thumb {
        background: linear-gradient(135deg, #334155, #475569);
        border-color: #0f172a;
    }

    * {
        scrollbar-color: #475569 #1e293b;
    }

    .editor,
    .output {
        scrollbar-color: #334155 #0f172a;
    }

    /* 針對特殊輸入元素的深色模式 */
    textarea,
    [contenteditable="true"] {
        scrollbar-color: #334155 #0f172a;
    }
}

/* 滾動條動畫效果 */
@keyframes scrollbar-appear {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

*::-webkit-scrollbar-thumb {
    animation: scrollbar-appear 0.3s ease-in-out;
}

/* 針對可滾動容器的增強樣式 */
.scrollable-container {
    position: relative;
}

.scrollable-container::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 100%;
    background: linear-gradient(to left, rgba(248, 250, 252, 0.8) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.scrollable-container:hover::before {
    opacity: 1;
}

/* 滾動體驗優化 */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* 為主要內容區域添加更好的滾動體驗 */
.container,
main,
.main-card {
    scroll-behavior: smooth;
}

/* 滾動條出現時的過渡效果 */
*::-webkit-scrollbar-thumb {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*::-webkit-scrollbar-track {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 當元素獲得焦點時的滾動條增強 */
*:focus::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
}

/* 移動設備上的滾動優化 */
@media (max-width: 768px) {
    * {
        -webkit-overflow-scrolling: touch; /* iOS 平滑滾動 */
    }
    
    *::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    
    .editor::-webkit-scrollbar,
    .output::-webkit-scrollbar,
    textarea::-webkit-scrollbar {
        width: 6px;
    }
}

/* ===== 查詢替代功能列樣式 ===== */

.replace-bar {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    display: none;
    animation: slideDown 0.3s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: relative;
}

.replace-bar.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 150px;
    }
}

/* 功能列標題 */
.replace-bar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.6);
}

.replace-bar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.replace-title-icon {
    font-size: 16px;
}

.replace-bar-shortcut {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.replace-bar-shortcuts {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shortcut-separator {
    color: var(--text-tertiary);
    font-size: 12px;
}

.replace-bar-hint {
    font-size: 10px;
    color: var(--text-tertiary);
    font-weight: 500;
    font-style: italic;
}

/* 功能列內容 */
.replace-bar-content {
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 20px;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

/* 輸入區域 */
.replace-input-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.replace-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.replace-field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.replace-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.replace-field-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.replace-field-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.replace-field-input::placeholder {
    color: var(--text-tertiary);
    font-style: italic;
}

.replace-field-counter {
    position: absolute;
    right: 10px;
    font-size: 11px;
    color: var(--text-secondary);
    background: rgba(248, 250, 252, 0.9);
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    pointer-events: none;
    border: 1px solid var(--border-color);
}

/* 選項區域 */
.replace-options-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
}

.replace-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.replace-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary-color);
}

.replace-option-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.option-icon {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    min-width: 20px;
    text-align: center;
}

/* 動作區域 */
.replace-actions-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.replace-navigation-group {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-primary);
}

.replace-nav-btn {
    padding: 8px 10px;
    border: none;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.replace-nav-btn:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.replace-nav-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.replace-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-icon {
    font-size: 12px;
    font-weight: 700;
}

.replace-action-group {
    display: flex;
    gap: 8px;
}

.replace-action-btn {
    padding: 8px 14px;
    border: 1.5px solid;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-primary);
}

.replace-btn-single {
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.replace-btn-single:hover:not(:disabled) {
    background: var(--warning-color);
    color: white;
}

.replace-btn-all {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.replace-btn-all:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

.replace-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.replace-close-btn {
    padding: 8px 10px;
    border: 1.5px solid #ef4444;
    border-radius: 6px;
    background: var(--bg-primary);
    color: #ef4444;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.replace-close-btn:hover {
    background: #ef4444;
    color: white;
}

.close-icon {
    font-size: 14px;
    font-weight: 700;
}

/* 工具列中的查詢替代按鈕激活狀態 */
#replaceToggleBtn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
/* 響應式設計 */
@media (max-width: 1024px) {
    .replace-bar-content {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .replace-input-section {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .replace-actions-section {
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }
}

@media (max-width: 768px) {
    .replace-bar-header {
        padding: 10px 16px 6px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .replace-bar-shortcuts {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .replace-bar-hint {
        font-size: 9px;
    }
    
    .replace-bar-content {
        padding: 12px 16px;
        gap: 12px;
    }
    
    .replace-options-section {
        gap: 6px;
    }
    
    .replace-action-group {
        width: 100%;
        justify-content: stretch;
    }
    
    .replace-action-btn {
        flex: 1;
        text-align: center;
    }
    
    .replace-actions-section {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .replace-navigation-group {
        align-self: center;
    }
}
    
    .replace-field-label {
        min-width: unset;
    }
    
    .replace-field-input {
        width: 100%;
    }
    
    .replace-options-group {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .replace-actions-group {
        justify-content: center;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .replace-bar {
        padding: 16px;
    }
    
    .replace-options-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .replace-actions-group {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    
    .replace-navigation,
    .replace-buttons {
        justify-content: center;
    }
    
    .replace-buttons {
        width: 100%;
    }
    
    .replace-buttons .btn {
        flex: 1;
    }
}

/* ==================================================
   App 式導航系統樣式 - Hover 展開 + RWD
   ================================================== */

/* 左側小標籤（Tab Handle） - 預設顯示 */
.sidebar-tab-handle {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 120px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    border-radius: 0 12px 12px 0;
    /* 右側淡邊線作為視覺分隔 */
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 2px 0 12px rgba(59, 130, 246, 0.3);
    cursor: pointer;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
}

.sidebar-tab-handle:hover {
    width: 32px;
    background: linear-gradient(135deg, var(--primary-hover) 0%, #1d4ed8 100%);
    box-shadow: 3px 0 16px rgba(59, 130, 246, 0.4);
}

.sidebar-tab-handle.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(-40px);
}

.tab-icon {
    font-size: 16px;
    font-weight: 700;
}

.tab-text {
    writing-mode: vertical-rl;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
}

/* 遮罩層（平板版/手機版使用） */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: none;
}

.sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* 全局佈局調整 */
body.has-sidebar-nav .container {
    /* 基礎設定：始終在視窗中央，不計算 sidebar 寬度 */
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

body.has-top-nav {
    padding-top: 60px;
}

body.has-top-nav .container {
    padding-top: 0;
}

/* ==================================================
   桌面版側邊欄導航
   ================================================== */

.app-nav-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    /* 右側陰影增強分隔效果 */
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    /* 預設隱藏在左側外 */
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar 展開狀態 */
.app-nav-sidebar.open {
    transform: translateX(0);
}

/* 舊的 collapsed 狀態（保留兼容） */
.app-nav-sidebar.collapsed {
    transform: translateX(-100%);
}

/* 導航頭部 */
.nav-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    min-height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.logo-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.app-nav-sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* 工具列表區域 */
.nav-tools-section {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 12px;
    scrollbar-gutter: stable;
    position: relative;
}

/* 關閉按鈕（平板版使用） */
.nav-close {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 32px;
    height: 32px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    color: #ef4444;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.nav-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.close-icon {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    padding: 8px 12px;
    margin-bottom: 8px;
    transition: opacity 0.3s ease;
}

.app-nav-sidebar.collapsed .nav-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}

/* 工具項目 */
.nav-tool-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    margin-bottom: 4px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    /* 確保高度固定，避免內容變化 */
    min-height: 48px;
    box-sizing: border-box;
}

.nav-tool-item:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(37, 99, 235, 0.18) 100%);
    border-color: rgba(59, 130, 246, 0.3);
    /* 移除 transform 保持對齊 */
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.nav-tool-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    border-color: transparent;
}

.nav-tool-item.active:hover {
    /* 移除 transform 保持對齊 */
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
    filter: brightness(1.05);
}

.nav-tool-item.featured::after {
    content: '⭐';
    position: absolute;
    right: 12px;
    font-size: 12px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.nav-tool-item.featured:hover::after,
.nav-tool-item.active.featured::after {
    opacity: 1;
}

.app-nav-sidebar.collapsed .nav-tool-item.featured::after {
    display: none;
}

.nav-tool-icon {
    font-size: 20px;
    flex-shrink: 0;
    transition: filter 0.2s ease;
    /* 確保圖標不會改變尺寸 */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.nav-tool-item:hover .nav-tool-icon {
    /* 使用濾鏡代替縮放，避免尺寸變化 */
    filter: brightness(1.15) saturate(1.3);
}

.nav-tool-label {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.app-nav-sidebar.collapsed .nav-tool-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.app-nav-sidebar.collapsed .nav-tool-item {
    justify-content: center;
    /* 確保 padding 對稱，讓圖標和背景完美對齊 */
    padding: 12px 10px;
    margin: 0 8px 4px 8px;
    /* 確保寬度固定，背景框與圖標完美契合 */
    width: calc(70px - 16px);
    box-sizing: border-box;
}

/* 收合狀態下的圖標樣式優化 */
.app-nav-sidebar.collapsed .nav-tool-icon {
    margin: 0;
}

/* 激活指示器 */
.active-indicator {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: white;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.5);
}

/* 頁腳區域 */
.nav-footer-section {
    border-top: 1px solid var(--border-color);
    padding: 12px;
    background: var(--bg-secondary);
}

.nav-footer-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    margin-bottom: 4px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: background 0.2s ease, color 0.2s ease;
    font-size: 13px;
    /* 確保高度固定 */
    min-height: 44px;
    box-sizing: border-box;
}

.nav-footer-item:hover {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-color);
    /* 移除 transform 保持對齊 */
}

.nav-footer-item.active {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.app-nav-sidebar.collapsed .nav-footer-item {
    justify-content: center;
    /* 確保對稱 padding */
    padding: 10px 8px;
    margin: 0 8px 4px 8px;
    /* 確保寬度固定 */
    width: calc(70px - 16px);
    box-sizing: border-box;
}

/* 收合狀態下的頁腳圖標樣式 */
.app-nav-sidebar.collapsed .nav-footer-item .nav-tool-icon {
    margin: 0;
}

/* ==================================================
   手機版頂部導航
   ================================================== */

.app-nav-mobile {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.mobile-nav-header {
    padding: 0;
}

.mobile-nav-toggle {
    width: 100%;
    padding: 16px 20px;
    background: transparent;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.mobile-nav-toggle:active {
    background: rgba(255, 255, 255, 0.1);
}

.current-page-label {
    flex: 1;
    text-align: left;
    margin: 0 12px;
}

.toggle-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.mobile-nav-dropdown {
    max-height: 0;
    overflow: hidden;
    background: white;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mobile-nav-dropdown.show {
    max-height: 80vh;
    overflow-y: auto;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.mobile-nav-item:hover {
    background: var(--bg-secondary);
}

.mobile-nav-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.15) 100%);
    color: var(--primary-color);
    font-weight: 600;
    border-left: 4px solid var(--primary-color);
}

.mobile-nav-item .nav-tool-icon {
    font-size: 22px;
}

.mobile-nav-item .nav-tool-label {
    font-size: 15px;
}

/* ==================================================
   頁腳樣式
   ================================================== */

.app-footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    padding: 24px 20px;
    margin-top: 40px;
    width: 100%;
    /* 確保 Footer 在頁面流中正確定位 */
    position: relative;
    z-index: 1;
}

.app-footer p {
    margin: 0;
}

.app-footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.2s ease;
}

.app-footer a:hover {
    color: white;
    text-decoration: underline;
}

/* ==================================================
   響應式設計 - RWD 分流
   ================================================== */

/* 桌面版 (>= 1024px) - Hover 互動 */
@media (min-width: 1024px) {
    .sidebar-tab-handle {
        cursor: default;
    }
    
    .nav-close {
        display: none;
    }
    
    .sidebar-overlay {
        display: none;
    }
    
    /* 桌面版全域 layout 規則 */
    body.has-sidebar-nav .container {
        /* 容器保持在視窗正中間，不計算 sidebar 寬度 */
        margin: 0 auto;
        max-width: 1200px;
    }
}

/* 平板版 (768px - 1023px) - 點擊互動 */
@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar-tab-handle {
        cursor: pointer;
    }
    
    .nav-close {
        display: flex;
    }
    
    .sidebar-overlay {
        display: block;
    }
    
    /* 平板版全域 layout 規則 */
    body.has-sidebar-nav .container {
        /* 完全置中，sidebar 用 overlay 遮罩 */
        margin-left: auto;
        margin-right: auto;
        max-width: 1200px;
    }
}

/* 手機版 (<= 767px) - 頂部導航 */
@media (max-width: 767px) {
    .sidebar-tab-handle {
        display: none;
    }
    
    .app-nav-sidebar {
        display: none;
    }
    
    .sidebar-overlay {
        display: none;
    }
    
    /* 手機版全域 layout 規則 */
    body.has-sidebar-nav {
        margin-left: 0;
    }
    
    body.has-sidebar-nav .container {
        /* 完全置中，使用頂部導航 */
        margin-left: auto;
        margin-right: auto;
        max-width: 1200px;
    }
}

@media (min-width: 768px) {
    .app-nav-mobile {
        display: none;
    }
}

/* 滾動條樣式優化（導航專用） */
.nav-tools-section::-webkit-scrollbar {
    width: 6px;
}

.nav-tools-section::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    /* 使用淺色背景確保滾動條空間始終存在 */
}

.nav-tools-section::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 3px;
    transition: background 0.2s ease;
}

.nav-tools-section::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

.mobile-nav-dropdown::-webkit-scrollbar {
    width: 6px;
}

.mobile-nav-dropdown::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.mobile-nav-dropdown::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.nav-tool-item,
.nav-footer-item {
    animation: fadeIn 0.4s ease-out;
}

.nav-tool-item:nth-child(1) { animation-delay: 0.05s; }
.nav-tool-item:nth-child(2) { animation-delay: 0.1s; }
.nav-tool-item:nth-child(3) { animation-delay: 0.15s; }
.nav-tool-item:nth-child(4) { animation-delay: 0.2s; }
.nav-tool-item:nth-child(5) { animation-delay: 0.25s; }
.nav-tool-item:nth-child(6) { animation-delay: 0.3s; }
.nav-tool-item:nth-child(7) { animation-delay: 0.35s; }
.nav-tool-item:nth-child(8) { animation-delay: 0.4s; }
