/* ══════════════════════════════════════════════════════════
   FLARE Template Picker — Bibliothèque de templates
   Galerie interactive avec preview en couleurs live
   ══════════════════════════════════════════════════════════ */

/* ── Section wrapper ──────────────────────────────────────── */
.tp-section {
    background: var(--color-gray-50, #fafafa);
    padding: 64px 0;
}

/* Conteneur interne (équivalent .container pour les pages sans ce class) */
.tp-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* En-tête de section centré (équivalent .section-header-center) */
.tp-section-header {
    text-align: center;
    margin-bottom: 0;
}

.tp-section-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--color-accent, #19e66b);
    background: rgba(25, 230, 107, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
    font-family: var(--font-primary, 'Inter', sans-serif);
}

.tp-section-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 12px;
    font-family: var(--font-primary, 'Inter', sans-serif);
}

.tp-section-title mark {
    background: none;
    color: var(--color-accent, #19e66b);
}

.tp-section-subtitle {
    font-size: 1rem;
    color: var(--color-gray-500, #737373);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
    font-family: var(--font-primary, 'Inter', sans-serif);
}

/* ── Barre palette globale ────────────────────────────────── */
.tp-palette-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--color-gray-200, #e5e5e5);
    margin-top: 2rem;
    flex-wrap: wrap;
}

.tp-palette-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tp-palette-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--color-gray-500, #737373);
    font-family: var(--font-primary, 'Inter', sans-serif);
    white-space: nowrap;
}

.tp-palette-hint {
    font-size: 0.7rem;
    color: var(--color-gray-400, #a3a3a3);
    font-family: var(--font-primary, 'Inter', sans-serif);
    line-height: 1.4;
    margin-top: 1px;
}

.tp-palette-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ── Grid ─────────────────────────────────────────────────── */
.tp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: 1.25rem;
}

@media (max-width: 640px) {
    .tp-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* ── Loading / empty states ───────────────────────────────── */
.tp-grid-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: var(--color-gray-500, #737373);
    font-size: 0.875rem;
    font-family: var(--font-primary, 'Inter', sans-serif);
}

.tp-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--color-gray-500, #737373);
    font-size: 0.875rem;
}

/* ── Spinner ──────────────────────────────────────────────── */
.tp-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--color-gray-200, #e5e5e5);
    border-top-color: var(--color-accent, #19e66b);
    border-radius: 50%;
    animation: tp-spin 0.65s linear infinite;
    flex-shrink: 0;
}

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

/* ── Card ─────────────────────────────────────────────────── */
.tp-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    transition: transform 0.22s cubic-bezier(.4,0,.2,1),
                box-shadow 0.22s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
}

.tp-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.13);
}

/* ── Preview area ─────────────────────────────────────────── */
.tp-preview {
    position: relative;
    background: linear-gradient(145deg, #f5f5f0 0%, #eceae0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 0.75rem 0.75rem;
    min-height: 210px;
    overflow: hidden;
}

.tp-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    position: relative;
    z-index: 1;
}

/* Loading overlay over canvas */
.tp-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(245, 245, 240, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    backdrop-filter: blur(2px);
    transition: opacity 0.2s ease;
}

/* Sport badge top-left */
.tp-sport-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(10, 10, 10, 0.72);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 3px 9px;
    border-radius: 20px;
    text-transform: uppercase;
    backdrop-filter: blur(6px);
    z-index: 3;
    font-family: var(--font-primary, 'Inter', sans-serif);
}

/* ── Card body ────────────────────────────────────────────── */
.tp-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.tp-name {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--color-gray-600, #525252);
    text-transform: uppercase;
    font-family: var(--font-primary, 'Inter', sans-serif);
}

/* ── Zone color pickers ───────────────────────────────────── */
.tp-zones-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.tp-zones-label {
    font-size: 0.7rem;
    color: var(--color-gray-400, #a3a3a3);
    letter-spacing: 0.5px;
    font-weight: 600;
    font-family: var(--font-primary, 'Inter', sans-serif);
    white-space: nowrap;
}

.tp-zones-hint {
    display: block;
    font-size: 0.68rem;
    color: var(--color-gray-400, #a3a3a3);
    font-family: var(--font-primary, 'Inter', sans-serif);
    margin-top: 3px;
    font-style: italic;
}

.tp-zone-wrap {
    position: relative;
    display: block;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 0;
}

.tp-zone-dot {
    display: block;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.14), inset 0 1px 2px rgba(255,255,255,0.3);
    transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.tp-zone-wrap:hover .tp-zone-dot {
    transform: scale(1.18);
    box-shadow: 0 0 0 2.5px var(--color-accent, #19e66b), inset 0 1px 2px rgba(255,255,255,0.3);
}

/* Hide the native color input but keep it clickable */
.tp-zone-pk {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    cursor: pointer;
    padding: 0;
    border: none;
    border-radius: 50%;
}

/* ── Action buttons ───────────────────────────────────────── */
.tp-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    /* Le bouton Aléatoire est dans la barre palette, pas dans la carte */
}

.tp-btn-rand {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--color-gray-100, #f5f5f5);
    color: var(--color-gray-700, #404040);
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.625rem;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.14s ease;
    white-space: nowrap;
    font-family: var(--font-primary, 'Inter', sans-serif);
    flex-shrink: 0;
}

.tp-btn-rand:hover {
    background: var(--color-gray-200, #e5e5e5);
}

.tp-btn-rand svg {
    flex-shrink: 0;
}

.tp-btn-config {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary, #0a0a0a);
    color: #fff;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-decoration: none;
    transition: background 0.14s ease, color 0.14s ease, transform 0.14s ease;
    white-space: nowrap;
    font-family: var(--font-primary, 'Inter', sans-serif);
}

.tp-btn-config:hover {
    background: var(--color-accent, #19e66b);
    color: var(--color-primary, #0a0a0a);
    transform: translateY(-1px);
}

/* ── Bottom CTA ───────────────────────────────────────────── */
.tp-cta-bottom {
    margin-top: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1.5rem 1rem;
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--color-gray-200, #e5e5e5);
}

.tp-cta-bottom p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-gray-600, #525252);
    font-family: var(--font-primary, 'Inter', sans-serif);
}

/* Responsive tweaks */
@media (max-width: 480px) {
    .tp-preview {
        min-height: 160px;
        padding: 0.75rem 0.5rem 0.5rem;
    }

    .tp-body {
        padding: 0.75rem;
        gap: 0.6rem;
    }

    .tp-zone-dot {
        width: 22px;
        height: 22px;
    }

    .tp-btn-rand span {
        display: none;
    }
}

/* ── Bouton "Voir tous les designs" ──────────────────────── */
.tp-see-all {
    text-align: center;
    padding: 24px 0 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.tp-see-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 28px;
    background: #001e3c;
    color: #fff;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .5px;
    text-decoration: none;
    text-transform: uppercase;
    transition: background .2s, transform .15s;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.tp-see-all-btn:hover {
    background: #003366;
    transform: translateY(-2px);
}

.tp-see-all-link {
    font-size: 12px;
    color: #666;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tp-see-all-link:hover {
    color: #001e3c;
}
