/* Scope tabs */
.template-scope-tab { color: #64748b; background: transparent; }
.template-scope-tab.active { color: #0f172a; background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* Category pills */
.template-cat-btn { color: #64748b; border-color: #e2e8f0; background: white; }
.template-cat-btn.active { color: white; background: #0f172a; border-color: #0f172a; }

/* Gallery cards */
.template-card {
    border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden;
    transition: all 0.2s; cursor: pointer; background: white;
}
.template-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.08); }
.template-card-preview { height: 160px; background: #f8fafc; overflow: hidden; padding: 12px; }
.template-card-body { padding: 14px; }
.template-card-name { font-size: 14px; font-weight: 700; color: #0f172a; }
.template-card-category { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.template-card-actions { display: flex; gap: 6px; margin-top: 8px; }

/* Editor overlay (Task 3 will use these) */
.template-editor-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,0.6); backdrop-filter: blur(4px);
    z-index: 9998; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.template-editor-overlay.open { opacity: 1; pointer-events: auto; }
.template-editor-panel {
    position: fixed; top: 0; right: -720px; width: 720px; height: 100vh;
    background: white; z-index: 9999; transition: right 0.3s; display: flex; flex-direction: column;
    box-shadow: -10px 0 40px rgba(0,0,0,0.15);
}
.template-editor-panel.open { right: 0; }

/* Preview pane */
.template-preview-pane {
    flex: 1; background: #f1f0ee; padding: 20px; overflow-y: auto;
    display: flex; justify-content: center;
}
.template-preview-frame {
    width: 540px; background: white; border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06); overflow: hidden;
}

/* Section editors */
.template-section-editor {
    border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 12px; overflow: hidden;
}
.template-section-label {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: #f8fafc; border-bottom: 1px solid #e2e8f0;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b;
}
.template-section-content {
    padding: 12px; min-height: 60px; outline: none;
    font-size: 14px; line-height: 1.6; color: #37352f;
}
.template-section-content:focus { background: #fefce8; }

/* Variable dropdown */
.template-var-dropdown {
    position: absolute; background: white; border: 1px solid #e2e8f0; border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.12); max-height: 260px; overflow-y: auto;
    width: 260px; z-index: 10000; display: none;
}
.template-var-dropdown.open { display: block; }
.template-var-group { padding: 6px 12px; font-size: 10px; font-weight: 700; text-transform: uppercase; color: #94a3b8; }
.template-var-item { padding: 8px 12px; cursor: pointer; font-size: 13px; display: flex; justify-content: space-between; }
.template-var-item:hover { background: #f1f5f9; }
.template-var-item code { font-size: 11px; color: #7c3aed; background: #f5f3ff; padding: 1px 6px; border-radius: 3px; }

/* Theme picker */
.theme-picker {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
    scrollbar-width: thin; scrollbar-color: #e2e8f0 transparent;
}
.theme-picker::-webkit-scrollbar { height: 4px; }
.theme-picker::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }
.theme-card {
    flex: 0 0 auto; width: 72px; cursor: pointer; border: 2px solid #e2e8f0;
    border-radius: 8px; padding: 6px; text-align: center; transition: all 0.15s;
    background: white;
}
.theme-card:hover { border-color: #94a3b8; transform: translateY(-1px); }
.theme-card.active { border-color: #7c3aed; box-shadow: 0 0 0 2px rgba(124,58,237,0.15); }
.theme-card-swatch { height: 32px; border-radius: 4px; overflow: hidden; background: #f8fafc; margin-bottom: 4px; }
.theme-card-name { font-size: 9px; font-weight: 700; color: #64748b; line-height: 1.2; display: block; }

/* Block palette */
.block-palette {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
}
.block-palette-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 4px; border: 1px solid #e2e8f0; border-radius: 6px;
    cursor: grab; font-size: 9px; font-weight: 600; color: #64748b;
    background: white; transition: all 0.15s; text-align: center;
    -webkit-user-select: none; user-select: none;
}
.block-palette-item:hover { border-color: #7c3aed; color: #7c3aed; background: #faf5ff; }
.block-palette-item:active, .block-palette-item.dragging { opacity: 0.5; cursor: grabbing; }

/* Drag & drop indicators */
.template-section-editor { transition: all 0.15s; }
.template-section-editor.drag-over {
    border-color: #7c3aed; box-shadow: 0 0 0 2px rgba(124,58,237,0.15);
    border-top: 3px solid #7c3aed;
}
.template-section-editor.dragging { opacity: 0.4; }
.template-section-editor .drag-handle {
    cursor: grab; font-size: 14px; color: #cbd5e1; line-height: 1;
    padding: 0 2px; -webkit-user-select: none; user-select: none;
}
.template-section-editor .drag-handle:hover { color: #64748b; }

/* Font picker */
.font-picker { max-height: 280px; overflow: hidden; display: flex; flex-direction: column; }
.font-picker-search { margin-bottom: 8px; }
.font-picker-search-input {
    width: 100%; padding: 7px 12px; border: 1px solid #e2e8f0; border-radius: 6px;
    font-size: 12px; color: #334155; outline: none; background: #f8fafc;
    transition: border-color 0.15s;
}
.font-picker-search-input:focus { border-color: #7c3aed; background: white; }
.font-picker-search-input::placeholder { color: #94a3b8; }
.font-picker-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
    overflow-y: auto; max-height: 220px; padding-right: 4px;
    scrollbar-width: thin; scrollbar-color: #e2e8f0 transparent;
}
.font-picker-grid::-webkit-scrollbar { width: 4px; }
.font-picker-grid::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }
.font-picker-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 6px 8px; border: 1.5px solid #e2e8f0; border-radius: 8px;
    cursor: pointer; background: white; transition: all 0.15s; text-align: center;
}
.font-picker-item:hover { border-color: #7c3aed; background: #faf5ff; transform: translateY(-1px); }
.font-picker-item.active { border-color: #7c3aed; background: #f5f3ff; box-shadow: 0 0 0 2px rgba(124,58,237,0.15); }
.font-picker-preview {
    font-size: 22px; font-weight: 600; color: #1e293b; line-height: 1.2;
    height: 30px; display: flex; align-items: center; justify-content: center;
}
.font-picker-name {
    font-size: 8px; font-weight: 700; color: #64748b; text-transform: uppercase;
    letter-spacing: 0.03em; line-height: 1.1; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

/* Picker category tabs */
.picker-cat-tab { color: #64748b; border-color: #e2e8f0; background: white; }
.picker-cat-tab.active { color: white; background: #0f172a; border-color: #0f172a; }
