/* ============================================================
   PAGE TEMPLATES - Galerie immersive
   ============================================================ */

/* ============ HERO TEMPLATES ============ */
.templates-hero {
    position: relative;
    padding: 100px 0 80px;
    background: linear-gradient(180deg, var(--cream) 0%, #f0ebe1 100%);
    overflow: hidden;
}

.templates-hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.tpl-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
}

.tpl-blob-1 {
    width: 500px;
    height: 500px;
    background: var(--royal-gold);
    top: -150px;
    right: -100px;
    animation: tplBlobFloat 15s ease-in-out infinite;
}

.tpl-blob-2 {
    width: 400px;
    height: 400px;
    background: var(--royal-burgundy);
    bottom: -150px;
    left: -100px;
    animation: tplBlobFloat 15s ease-in-out infinite 3s;
}

@keyframes tplBlobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -40px) scale(1.1); }
}

.templates-hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 720px;
    margin: 0 auto;
}

.templates-hero-eyebrow {
    display: inline-block;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: var(--royal-gold-dark);
    margin-bottom: 20px;
    padding: 0 40px;
    position: relative;
}

.templates-hero-eyebrow::before,
.templates-hero-eyebrow::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30px;
    height: 1px;
    background: var(--royal-gold);
}

.templates-hero-eyebrow::before { left: 0; }
.templates-hero-eyebrow::after { right: 0; }

.templates-hero-title {
    font-family: 'Great Vibes', cursive;
    font-size: clamp(48px, 7vw, 84px);
    color: var(--royal-blue);
    line-height: 1.05;
    margin-bottom: 25px;
    font-weight: 400;
}

.templates-hero-desc {
    font-family: 'Cormorant Garamond', serif;
    font-size: 19px;
    color: var(--color-text-muted);
    line-height: 1.7;
    margin-bottom: 50px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.templates-hero-stats {
    display: inline-flex;
    gap: 50px;
    padding: 25px 45px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(201, 169, 97, 0.3);
    border-radius: 60px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 30px rgba(26, 26, 62, 0.06);
}

.tpl-stat {
    text-align: center;
}

.tpl-stat-value {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--royal-blue);
    line-height: 1;
    margin-bottom: 6px;
}

.tpl-stat-label {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

/* ============ FILTRES STICKY ============ */
.templates-filters-bar {
    position: relative;
    z-index: 50;
    padding: 20px 0;
    background: rgba(250, 247, 242, 0.9);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(26, 26, 62, 0.05);
    border-bottom: 1px solid rgba(26, 26, 62, 0.08);
    transition: all 0.3s ease;
}

.templates-filters-bar.sticky-active {
    position: sticky;
    top: var(--header-height, 70px);
    box-shadow: 0 4px 20px rgba(26, 26, 62, 0.08);
    background: rgba(250, 247, 242, 0.98);
}

.templates-filters-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

/* Onglets catégories */
.templates-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.templates-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: transparent;
    border: 1.5px solid rgba(26, 26, 62, 0.12);
    border-radius: 50px;
    font-family: 'Cinzel', serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.templates-tab:hover {
    border-color: var(--royal-gold);
    background: rgba(201, 169, 97, 0.08);
    transform: translateY(-2px);
}

.templates-tab.active {
    background: linear-gradient(135deg, var(--royal-blue), var(--royal-deep));
    border-color: var(--royal-gold);
    color: var(--royal-gold-light);
    box-shadow: 0 6px 20px rgba(26, 26, 62, 0.25);
}

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

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: rgba(26, 26, 62, 0.08);
    border-radius: 50px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
}

.templates-tab.active .tab-count {
    background: var(--royal-gold);
    color: var(--royal-blue);
}

/* Barre de recherche */
.templates-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: #fff;
    border: 1.5px solid rgba(26, 26, 62, 0.12);
    border-radius: 50px;
    transition: all 0.25s ease;
    min-width: 240px;
}

.templates-search:focus-within {
    border-color: var(--royal-gold);
    box-shadow: 0 0 0 4px rgba(201, 169, 97, 0.15);
}

.templates-search svg {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.templates-search input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'Cormorant Garamond', serif;
    font-size: 15px;
    color: var(--color-text);
    outline: none;
}

.templates-search input::placeholder {
    color: var(--color-text-light);
    font-style: italic;
}

/* ============ SECTION GRILLE ============ */
.templates-grid-section {
    padding: 60px 0 80px;
    background: var(--cream);
    min-height: 60vh;
}

.templates-result-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 40px;
    padding: 15px 25px;
    background: rgba(201, 169, 97, 0.08);
    border-left: 3px solid var(--royal-gold);
    border-radius: 12px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 16px;
    color: var(--color-text);
}

.templates-result-info em {
    font-style: italic;
    color: var(--royal-gold-dark);
    font-weight: 600;
}

.templates-reset {
    font-family: 'Cinzel', serif;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--royal-gold-dark);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.25s ease;
}

.templates-reset:hover {
    background: var(--royal-gold);
    color: #fff;
}

/* Grille */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

/* ============ CARD TEMPLATE ============ */
.template-card {
    background: #ffffff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(26, 26, 62, 0.08);
    transition: box-shadow 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(26, 26, 62, 0.06);
    position: relative;
    display: flex;
    flex-direction: column;
}

.template-card:hover {
    box-shadow: 
        0 20px 50px rgba(26, 26, 62, 0.15),
        0 0 0 2px var(--royal-gold);
}

/* Preview */
.template-card-preview {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--royal-blue);
    flex-shrink: 0;
}

.template-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.template-card:hover .template-card-preview img {
    transform: scale(1.08);
}

.template-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 80px;
    color: rgba(255, 255, 255, 0.4);
    background: linear-gradient(135deg, #1a1a3e, #0d0d24);
}

/* Badge Premium */
.template-card-badges {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 3;
}

.template-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-family: 'Cinzel', serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.template-badge-premium {
    background: linear-gradient(135deg, var(--royal-gold), var(--royal-gold-dark));
    color: #fff;
}

/* Catégorie en bas */
.template-card-category {
    position: absolute;
    bottom: 15px;
    left: 15px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    font-family: 'Cinzel', serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--royal-blue);
    letter-spacing: 1px;
    z-index: 2;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Overlay au hover */
.template-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(26, 26, 62, 0.4) 0%,
        rgba(26, 26, 62, 0.85) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
    backdrop-filter: blur(2px);
}

.template-card:hover .template-card-overlay {
    opacity: 1;
}

.template-card-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    width: 100%;
    max-width: 240px;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.template-card:hover .template-card-actions {
    transform: translateY(0);
}

.template-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: 50px;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.template-action-demo {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.template-action-demo:hover {
    background: #fff;
    color: var(--royal-blue);
    border-color: #fff;
    transform: scale(1.03);
}

.template-action-choose {
    background: linear-gradient(135deg, var(--royal-gold), var(--royal-gold-dark));
    color: #fff;
    box-shadow: 0 8px 20px rgba(201, 169, 97, 0.5);
}

.template-action-choose:hover {
    background: linear-gradient(135deg, var(--royal-gold-light), var(--royal-gold));
    color: var(--royal-blue);
    transform: scale(1.03);
}

/* Info */
.template-card-info {
    padding: 22px 24px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.template-card-name {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    color: var(--royal-blue);
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.template-card-desc {
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Palette */
.template-card-palette {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid rgba(26, 26, 62, 0.06);
}

.palette-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.1),
        inset 0 0 0 2px #fff,
        0 0 0 1px rgba(26, 26, 62, 0.08);
    transition: transform 0.25s ease;
}

.palette-dot:hover {
    transform: scale(1.2) rotate(15deg);
}

/* ============ ÉTAT VIDE ============ */
.templates-empty {
    text-align: center;
    padding: 80px 20px;
}

.templates-empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.4;
}

.templates-empty h3 {
    font-family: 'Cinzel', serif;
    font-size: 24px;
    color: var(--royal-blue);
    margin-bottom: 12px;
}

.templates-empty p {
    font-family: 'Cormorant Garamond', serif;
    font-size: 17px;
    color: var(--color-text-muted);
    margin-bottom: 30px;
}

/* ============ CTA FINAL ============ */
.templates-cta {
    position: relative;
    padding: 100px 20px;
    background: linear-gradient(135deg, var(--royal-blue), var(--royal-deep));
    overflow: hidden;
    text-align: center;
}

.templates-cta-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.cta-tpl-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
}

.cta-tpl-blob-1 {
    width: 400px;
    height: 400px;
    background: var(--royal-gold);
    opacity: 0.15;
    top: -150px;
    left: -100px;
    animation: tplBlobFloat 15s ease-in-out infinite;
}

.cta-tpl-blob-2 {
    width: 350px;
    height: 350px;
    background: var(--royal-burgundy);
    opacity: 0.2;
    bottom: -100px;
    right: -100px;
    animation: tplBlobFloat 15s ease-in-out infinite 3s;
}

.templates-cta-content {
    position: relative;
    z-index: 2;
    max-width: 640px;
    margin: 0 auto;
    color: var(--ivory);
}

.templates-cta-icon {
    font-size: 72px;
    margin-bottom: 25px;
    filter: drop-shadow(0 0 30px var(--royal-gold));
    animation: ctaFloat 4s ease-in-out infinite;
}

@keyframes ctaFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.templates-cta-title {
    font-family: 'Great Vibes', cursive;
    font-size: clamp(38px, 5vw, 60px);
    color: #fff;
    margin-bottom: 20px;
    font-weight: 400;
    line-height: 1.1;
    text-shadow: 0 0 40px rgba(201, 169, 97, 0.4);
}

.templates-cta-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 19px;
    color: rgba(245, 240, 225, 0.85);
    line-height: 1.7;
    margin-bottom: 40px;
}

.templates-cta-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.templates-cta .btn-outline {
    color: var(--royal-gold-light);
    border-color: rgba(201, 169, 97, 0.5);
}

.templates-cta .btn-outline:hover {
    background: var(--royal-gold);
    color: var(--royal-blue);
    border-color: var(--royal-gold);
}

.templates-cta-hint {
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
    color: rgba(245, 240, 225, 0.65);
    font-style: italic;
}

/* ============ ANIMATIONS ============ */
[data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-animate].animated {
    opacity: 1;
    transform: translateY(0);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 968px) {
    .templates-hero {
        padding: 70px 0 60px;
    }
    
    .templates-hero-stats {
        gap: 30px;
        padding: 20px 30px;
    }
    
    .tpl-stat-value {
        font-size: 22px;
    }
    
    .templates-filters-inner {
        flex-direction: column;
        align-items: stretch;
    }
    
    .templates-search {
        min-width: 100%;
    }
}

@media (max-width: 640px) {
    .templates-hero {
        padding: 50px 0 40px;
    }
    
    .templates-hero-title {
        font-size: 48px;
    }
    
    .templates-hero-desc {
        font-size: 16px;
    }
    
    .templates-hero-stats {
        gap: 20px;
        padding: 15px 25px;
    }
    
    .tpl-stat-value {
        font-size: 20px;
    }
    
    .tpl-stat-label {
        font-size: 9px;
        letter-spacing: 2px;
    }
    
    .templates-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 5px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .templates-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .templates-tab {
        padding: 8px 14px;
        font-size: 12px;
        flex-shrink: 0;
    }
    
    .tab-label {
        display: none;
    }
    
    .tab-count {
        display: inline-flex;
        margin-left: 4px;
    }
    
    .templates-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .template-card-info {
        padding: 18px 20px;
    }
    
    .templates-cta {
        padding: 70px 20px;
    }
    
    .templates-cta-actions {
        flex-direction: column;
    }
    
    .templates-cta-actions .btn {
        width: 100%;
    }
}

/* Très petits écrans : 2 colonnes compactes */
@media (max-width: 400px) {
    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .template-card {
        border-radius: 16px;
    }
    
    .template-card-info {
        padding: 14px 14px 12px;
    }
    
    .template-card-name {
        font-size: 14px;
    }
    
    .template-card-desc {
        display: none;
    }
    
    .template-card-category {
        font-size: 9px;
        padding: 5px 10px;
        bottom: 10px;
        left: 10px;
    }
    
    .palette-dot {
        width: 14px;
        height: 14px;
    }
}