/* ========================================
   editor.html — 簡報編輯器頁面（補充樣式）
   main.css + editor.css 已涵蓋大部分樣式
   此檔案僅包含 Template Picker 專屬樣式
   ======================================== */

/* ── Template Picker ── */
.template-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

.template-picker-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 780px;
    max-height: 85vh;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: tpl-in 0.2s ease;
}

@keyframes tpl-in {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
}

.template-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.template-picker-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.template-picker-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.template-picker-grid {
    padding: 0;
    overflow-y: auto;
    max-height: calc(85vh - 60px);
}

/* Category tabs */
.tpl-category-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    background: var(--bg-elevated);
    position: sticky;
    top: 0;
    z-index: 1;
}

.tpl-tab {
    padding: 5px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.tpl-tab:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.tpl-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

/* Template cards grid */
.tpl-grid-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 16px 20px;
}

.template-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg-elevated);
}

.template-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 122, 232, 0.15);
}

.tpl-preview {
    width: 100%;
    height: 90px;
    border-bottom: 1px solid var(--border-color);
}

.tpl-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tpl-info .material-symbols-outlined {
    color: var(--accent-primary);
}

/* ── 底部導航工具列 ── */
.slide-nav {
    justify-content: space-between !important;
}

.nav-tool-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s;
    padding: 0;
}

.nav-tool-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.nav-tool-btn.active {
    background: rgba(26, 115, 232, 0.1);
    border-color: #1a73e8;
    color: #1a73e8;
}

/* ── 格線疊層 ── */
.canvas-grid-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image:
        linear-gradient(rgba(26, 115, 232, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 115, 232, 0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0;
    transition: opacity 0.2s;
}

.canvas-grid-overlay.visible {
    opacity: 1;
}

/* ── 鎖定元素 ── */
.editable-element.locked {
    pointer-events: none !important;
    outline: 1px dashed rgba(217, 48, 37, 0.4) !important;
}

.editable-element.locked::after {
    content: '🔒';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    z-index: 10;
}

/* ── 快捷鍵面板 ── */
.shortcuts-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ctxFadeIn 0.15s ease;
}

.shortcuts-card {
    background: #fff;
    border-radius: 14px;
    width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    padding: 24px;
}

.shortcuts-card h3 {
    margin: 0 0 16px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.shortcut-group {
    margin-bottom: 16px;
}

.shortcut-group-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #80868b;
    margin-bottom: 6px;
}

.shortcut-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 0.85rem;
}

.shortcut-row kbd {
    background: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 0.78rem;
    font-family: 'SF Mono', 'Menlo', monospace;
    color: #444746;
    min-width: 22px;
    text-align: center;
}