/* ─── Template Picker Styles ─── */

.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    max-height: 420px;
    overflow-y: auto;
}

.template-card {
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
}

.template-card:hover {
    border-color: var(--text-secondary);
    background: var(--bg-primary);
    transform: translateY(-1px);
}

.template-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 4px 12px rgba(94, 236, 192, 0.15);
}

.template-card-none {
    border-style: dashed;
    border-color: var(--border-color);
    opacity: 0.75;
}

.template-card-none:hover {
    border-color: var(--text-secondary);
    opacity: 0.9;
}

.template-card-none.selected {
    border-style: dashed;
    border-color: var(--accent);
    opacity: 0.85;
    box-shadow: 0 0 0 1px var(--accent), 0 4px 12px rgba(94, 236, 192, 0.08);
}

.template-card-preview {
    width: 100%;
    height: 60px;
    position: relative;
    overflow: hidden;
}

.template-card-preview canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.template-card-info {
    padding: 8px 10px;
}

.template-card-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.template-card-desc {
    font-size: 10px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.template-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.template-card-tag {
    font-size: 9px;
    padding: 1px 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.template-card.selected .template-card-tag {
    background: var(--accent-subtle);
    color: var(--accent);
}

.template-card-selected-indicator {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

.template-card.selected .template-card-selected-indicator {
    display: flex;
}

.template-card-selected-indicator svg {
    width: 12px;
    height: 12px;
    color: white;
}

.template-current-badge {
    display: inline-block;
    font-size: 9px;
    padding: 2px 6px;
    background: var(--accent-subtle-strong);
    color: var(--accent);
    border-radius: 4px;
    margin-top: 4px;
}

/* Responsive: single column on narrow sidebars */
@media (max-width: 380px) {
    .template-grid {
        grid-template-columns: 1fr;
    }
}
