/* ===================================================
   TEMPLATES PAGES - CreatorFlow
   ===================================================
   Brand Guidelines:
   - NO box-shadows (except box-shadow: none to remove inherited)
   - ONLY #000000 for dark backgrounds
   - Lime green #d1fe17 for accents/badges
   - Poppins font for headings
   =================================================== */

/* ===== CSS VARIABLES ===== */
:root {
    --templates-lime: #d1fe17;
    --templates-black: #000000;
    --templates-white: #ffffff;
    --templates-gray-50: #f9fafb;
    --templates-gray-100: #f3f4f6;
    --templates-gray-200: #e5e7eb;
    --templates-gray-600: #4b5563;
    --templates-gray-700: #374151;
}

/* ===== HUB PAGE - HERO SECTION ===== */
.templates-hero {
    padding: 10rem 0 2.5rem;
    background: var(--templates-white);
    text-align: center;
}

.templates-hero__container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 3rem;
}

.templates-hero__badge {
    display: inline-block;
    background: transparent;
    color: #6b7280;
    padding: 0;
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: 'neusanstrial', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.templates-hero__title {
    font-size: clamp(1.75rem, 4.5vw, 2.75rem);
    font-weight: 800;
    color: #000000 !important;
    margin: 0 0 1rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-family: 'neusanstrial', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.templates-hero__subtitle {
    font-size: clamp(0.9375rem, 2.5vw, 1.125rem);
    color: var(--templates-gray-600);
    margin: 0;
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.templates-hero__cta {
    margin-top: 1.25rem;
}

/* ===== FILTER TABS ===== */
.templates-filters {
    padding: 0;
    background: var(--templates-white);
}

.templates-filters__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.templates-filters__tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.875rem 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.templates-filters__tabs::-webkit-scrollbar {
    display: none;
}

.templates-filter-tab {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--templates-gray-200);
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--templates-gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'neusanstrial', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.templates-filter-tab:hover {
    border-color: var(--templates-black);
    color: var(--templates-black);
}

.templates-filter-tab--active {
    background: var(--templates-black);
    border-color: var(--templates-black);
    color: var(--templates-white);
}

.templates-filter-tab--active:hover {
    background: var(--templates-black);
    border-color: var(--templates-black);
    color: var(--templates-white);
}

/* ===== TEMPLATES GRID ===== */
.templates-grid-section {
    padding: 2.5rem 0 3rem;
    margin-top: 1.5rem;
    background: var(--templates-gray-50);
}

.templates-grid__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.templates-empty {
    text-align: center;
    color: var(--templates-gray-600);
    padding: 4rem 2rem;
}

/* ===== TEMPLATE CARD ===== */
.template-card {
    display: flex;
    flex-direction: column;
    background: var(--templates-white);
    border: 1px solid var(--templates-gray-200);
    border-radius: 0.875rem;
    overflow: hidden;
    text-decoration: none;
    transition: border-color 0.2s ease;
}

.template-card:hover {
    border-color: var(--templates-lime);
}

.template-card__preview {
    background: var(--templates-gray-50);
    padding: 1rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Flow Preview Inside Card - Compact horizontal */
.template-preview-flow {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    justify-content: center;
}

.flow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.625rem;
    background: var(--templates-white);
    border: 1px solid var(--templates-gray-200);
    border-radius: 0.5rem;
    min-width: 52px;
}

.flow-step--trigger {
    border-color: var(--templates-lime);
}

.flow-step--result {
    border-color: var(--templates-lime);
}

.flow-icon {
    font-size: 1.125rem;
}

.flow-label {
    font-size: 0.5625rem;
    font-weight: 600;
    color: var(--templates-gray-700);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.flow-arrow {
    font-size: 0.875rem;
    color: var(--templates-gray-600);
    font-weight: 500;
}

.template-card__content {
    padding: 1rem 1.125rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.template-card__badge {
    display: inline-block;
    background: var(--templates-gray-100);
    color: var(--templates-gray-700);
    padding: 0.1875rem 0.5rem;
    border-radius: 3px;
    font-size: 0.5625rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    align-self: flex-start;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.template-card__title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--templates-black);
    margin: 0 0 0.375rem;
    line-height: 1.35;
    font-family: 'neusanstrial', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.template-card__description {
    font-size: 0.8125rem;
    color: var(--templates-gray-600);
    line-height: 1.55;
    margin: 0;
    flex: 1;
}

.template-card__cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid var(--templates-gray-200);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--templates-black);
}

.template-cta-arrow {
    transition: transform 0.2s ease;
}

.template-card:hover .template-cta-arrow {
    transform: translateX(3px);
}

/* ===== DETAIL PAGE - HERO ===== */
.template-detail-hero {
    padding: 10rem 0 4rem;
    background: var(--templates-white);
    text-align: center;
}

.template-detail-hero__container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 3rem;
}

.template-detail-hero__badge {
    display: inline-block;
    background: transparent;
    color: #6b7280;
    padding: 0;
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: 'neusanstrial', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.template-detail-hero__title {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 700;
    color: var(--templates-black);
    margin: 0 0 1.5rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-family: 'neusanstrial', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.template-detail-hero__subtitle {
    font-size: clamp(1rem, 3vw, 1.25rem);
    color: var(--templates-gray-600);
    margin: 0 0 2rem;
    line-height: 1.6;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
}

.template-detail-hero__cta {
    margin-bottom: 1rem;
}

.template-detail-hero__microcopy {
    font-size: 0.875rem;
    color: var(--templates-gray-600);
    margin: 0;
}

/* ===== PREVIEW SECTION ===== */
.template-preview-section {
    padding: 3rem 2rem;
    background: var(--templates-gray-50);
}

.template-preview__container {
    max-width: 900px;
    margin: 0 auto;
}

.template-preview__diagram {
    background: var(--templates-white);
    border: 1px solid var(--templates-gray-200);
    border-radius: 1rem;
    padding: 3rem 2rem;
}

.preview-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.preview-flow__step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
    background: var(--templates-gray-50);
    border: 2px solid var(--templates-gray-200);
    border-radius: 1rem;
    min-width: 120px;
    transition: all 0.2s ease;
}

.preview-flow__step:hover {
    border-color: var(--templates-lime);
}

.preview-flow__icon {
    font-size: 2rem;
}

.preview-flow__number {
    width: 32px;
    height: 32px;
    background: var(--templates-black);
    color: var(--templates-lime);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    font-family: 'neusanstrial', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.preview-flow__title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--templates-black);
    text-align: center;
    font-family: 'neusanstrial', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.preview-flow__arrow {
    font-size: 1.5rem;
    color: var(--templates-gray-600);
    font-weight: 700;
}

.template-preview__caption {
    text-align: center;
    font-size: 0.875rem;
    color: var(--templates-gray-600);
    margin: 1.5rem 0 0;
}

/* ===== HOW IT WORKS SECTION ===== */
.template-how-it-works {
    padding: 5rem 2rem;
    background: var(--templates-white);
}

.template-how-it-works__container {
    max-width: 1000px;
    margin: 0 auto;
}

/* ===== WHAT'S INCLUDED SECTION ===== */
.template-whats-included {
    padding: 5rem 2rem;
    background: var(--templates-gray-50);
}

.template-whats-included__container {
    max-width: 800px;
    margin: 0 auto;
}

.whats-included-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 3rem;
}

.whats-included-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    background: var(--templates-white);
    border: 1px solid var(--templates-gray-200);
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.whats-included-item:hover {
    border-color: var(--templates-lime);
}

.whats-included-check {
    width: 24px;
    height: 24px;
    background: var(--templates-lime);
    color: var(--templates-black);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
}

.whats-included-text {
    font-size: 0.9375rem;
    color: var(--templates-gray-700);
    line-height: 1.5;
}

/* ===== PERFECT FOR SECTION ===== */
.template-perfect-for {
    padding: 5rem 2rem;
    background: var(--templates-white);
}

.template-perfect-for__container {
    max-width: 800px;
    margin: 0 auto;
}

.perfect-for-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 3rem;
}

.perfect-for-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    background: var(--templates-gray-50);
    border: 1px solid var(--templates-gray-200);
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.perfect-for-card:hover {
    border-color: var(--templates-lime);
    background: var(--templates-white);
}

.perfect-for-icon {
    font-size: 1.5rem;
}

.perfect-for-text {
    font-size: 0.9375rem;
    color: var(--templates-gray-700);
    line-height: 1.4;
}

/* ===== MID-PAGE CTA ===== */
.template-mid-cta {
    padding: 4rem 2rem;
    background: var(--templates-white);
    text-align: center;
    border-top: 1px solid var(--templates-gray-200);
    border-bottom: 1px solid var(--templates-gray-200);
}

.template-mid-cta__container {
    max-width: 600px;
    margin: 0 auto;
}

.template-mid-cta__microcopy {
    font-size: 0.875rem;
    color: var(--templates-gray-600);
    margin: 1rem 0 0;
}

/* ===== RELATED TEMPLATES ===== */
.template-related {
    padding: 5rem 2rem;
    background: var(--templates-gray-50);
}

.template-related__container {
    max-width: 900px;
    margin: 0 auto;
}

.related-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.related-template-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background: var(--templates-white);
    border: 1px solid var(--templates-gray-200);
    border-radius: 0.75rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.related-template-card:hover {
    border-color: var(--templates-lime);
    transform: translateX(4px);
}

.related-template__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--templates-black);
    margin: 0;
    font-family: 'neusanstrial', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.related-template__arrow {
    font-size: 1.25rem;
    color: var(--templates-gray-600);
    transition: transform 0.2s ease;
}

.related-template-card:hover .related-template__arrow {
    transform: translateX(4px);
    color: var(--templates-black);
}

/* ===== FAQ SECTION ===== */
.templates-faq-section {
    padding: 4rem 0;
    background: var(--templates-white);
}

.templates-faq__container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 2rem;
}

.templates-faq__title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--templates-black);
    text-align: center;
    margin: 0 0 2.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-family: 'neusanstrial', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.templates-faq-section .faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.templates-faq-section .faq-item {
    background: var(--templates-white);
    border: 1px solid var(--templates-gray-200);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.templates-faq-section .faq-item:hover {
    border-color: var(--templates-lime);
}

.templates-faq-section .faq-item[open] {
    border-color: var(--templates-lime);
}

.templates-faq-section .faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--templates-black);
    cursor: pointer;
    list-style: none;
    font-family: 'neusanstrial', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transition: background 0.2s ease;
}

.templates-faq-section .faq-question::-webkit-details-marker {
    display: none;
}

.templates-faq-section .faq-question::after {
    content: '+';
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--templates-gray-600);
    flex-shrink: 0;
    margin-left: 0.75rem;
}

.templates-faq-section .faq-item[open] .faq-question::after {
    content: '−';
    color: var(--templates-lime);
}

.templates-faq-section .faq-item[open] .faq-question {
    background: var(--templates-gray-50);
}

.templates-faq-section .faq-answer {
    padding: 0 1.25rem 1.25rem;
}

.templates-faq-section .faq-answer p {
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--templates-gray-600);
    margin: 0;
}

/* ===== TABLET RESPONSIVE ===== */
@media (min-width: 769px) and (max-width: 1023px) {
    .templates-hero {
        padding: 9rem 0 2rem;
    }

    .templates-grid-section {
        margin-top: 1rem;
    }

    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .templates-hero {
        padding: 8rem 0 1.5rem;
    }

    .templates-hero__container,
    .template-detail-hero__container {
        padding: 0 2rem;
    }

    .templates-hero__title {
        font-size: 1.5rem;
    }

    .templates-hero__subtitle {
        font-size: 0.875rem;
    }

    .templates-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .templates-grid-section {
        padding: 1.5rem 0 2rem;
        margin-top: 1rem;
    }

    .templates-grid__container {
        padding: 0 1rem;
    }

    .templates-filters__container {
        padding: 0 1rem;
    }

    .templates-filter-tab {
        padding: 0.375rem 0.625rem;
        font-size: 0.6875rem;
    }

    /* Compact horizontal card on mobile */
    .template-card {
        flex-direction: row;
        align-items: stretch;
    }

    .template-card__preview {
        width: 80px;
        min-width: 80px;
        padding: 0.75rem 0.5rem;
        flex-shrink: 0;
    }

    .template-preview-flow {
        flex-direction: column;
        gap: 0.125rem;
    }

    .flow-step {
        padding: 0.25rem 0.375rem;
        min-width: 44px;
    }

    .flow-icon {
        font-size: 0.875rem;
    }

    .flow-label {
        font-size: 0.4375rem;
    }

    .flow-arrow {
        font-size: 0.625rem;
        transform: rotate(90deg);
    }

    .template-card__content {
        padding: 0.625rem 0.875rem;
        justify-content: center;
    }

    .template-card__badge {
        font-size: 0.5rem;
        padding: 0.125rem 0.3rem;
        margin-bottom: 0.25rem;
    }

    .template-card__title {
        font-size: 0.8125rem;
        margin-bottom: 0.1875rem;
    }

    .template-card__description {
        font-size: 0.6875rem;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .template-card__cta {
        display: none;
    }

    .template-detail-hero {
        padding: 8rem 0 1rem;
    }

    .template-preview-section {
        padding: 2rem 1rem;
    }

    .template-preview__diagram {
        padding: 2rem 1rem;
    }

    .preview-flow {
        gap: 0.75rem;
    }

    .preview-flow__step {
        padding: 1rem;
        min-width: 90px;
    }

    .preview-flow__arrow {
        font-size: 1.25rem;
    }

    .template-how-it-works,
    .template-whats-included,
    .template-perfect-for,
    .template-related {
        padding: 2.5rem 1rem;
    }

    .whats-included-grid,
    .perfect-for-grid,
    .related-templates-grid {
        grid-template-columns: 1fr;
    }

    .template-mid-cta {
        padding: 2.5rem 1rem;
    }

    /* Full-width CTA buttons on mobile */
    .template-detail-hero__cta .btn-hero-primary,
    .template-mid-cta .btn-hero-primary {
        width: 100%;
        display: block;
        text-align: center;
    }

    /* FAQ responsive */
    .templates-faq-section {
        padding: 2.5rem 0;
    }

    .templates-faq__container {
        padding: 0 1rem;
    }

    .templates-faq__title {
        margin-bottom: 1.5rem;
        font-size: 1.375rem;
    }

    .templates-faq-section .faq-list {
        gap: 0.5rem;
    }

    .templates-faq-section .faq-question {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }

    .templates-faq-section .faq-answer {
        padding: 0 1rem 1rem;
    }

    .templates-faq-section .faq-answer p {
        font-size: 0.8125rem;
    }
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 480px) {
    .templates-hero {
        padding: 7.5rem 0 1.25rem;
    }

    .templates-hero__container,
    .template-detail-hero__container {
        padding: 0 1.5rem;
    }

    .templates-hero__badge {
        font-size: 0.6875rem;
        padding: 0;
        margin-bottom: 1.25rem;
    }

    .templates-hero__title {
        font-size: 1.25rem;
    }

    .templates-filter-tab {
        padding: 0.3125rem 0.5rem;
        font-size: 0.625rem;
    }

    .templates-grid {
        gap: 0.625rem;
    }

    .templates-grid-section {
        margin-top: 0.75rem;
    }

    /* Extra small mobile card */
    .template-card__preview {
        width: 64px;
        min-width: 64px;
        padding: 0.5rem 0.375rem;
    }

    .flow-step {
        padding: 0.1875rem 0.25rem;
        min-width: 36px;
    }

    .flow-icon {
        font-size: 0.75rem;
    }

    .flow-label {
        font-size: 0.375rem;
    }

    .flow-arrow {
        font-size: 0.5rem;
    }

    .template-card__content {
        padding: 0.5rem 0.75rem;
    }

    .template-card__badge {
        font-size: 0.4375rem;
        padding: 0.0625rem 0.25rem;
    }

    .template-card__title {
        font-size: 0.75rem;
    }

    .template-card__description {
        font-size: 0.625rem;
        -webkit-line-clamp: 2;
    }

    .template-detail-hero {
        padding: 7rem 0 0.75rem;
    }

    .template-detail-hero__title {
        font-size: 1.25rem;
    }

    .template-detail-hero__subtitle {
        font-size: 0.8125rem;
    }

    /* Detail page flow - keep vertical */
    .preview-flow {
        flex-direction: column;
    }

    .preview-flow__arrow {
        transform: rotate(90deg);
    }

    .preview-flow__step {
        width: 100%;
        max-width: 200px;
    }

    /* FAQ mobile */
    .templates-faq-section {
        padding: 2rem 0;
    }

    .templates-faq__title {
        font-size: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .templates-faq-section .faq-question {
        padding: 0.75rem 0.875rem;
        font-size: 0.8125rem;
    }

    .templates-faq-section .faq-question::after {
        font-size: 1.125rem;
    }

    .templates-faq-section .faq-answer {
        padding: 0 0.875rem 0.875rem;
    }

    .templates-faq-section .faq-answer p {
        font-size: 0.75rem;
    }
}

/* ===== EXTRA SMALL MOBILE: 360px ===== */
@media (max-width: 360px) {
    .templates-hero__container,
    .template-detail-hero__container {
        padding: 0 1.25rem;
    }
}

/* ===== RELATED PAGES SECTION (Internal Linking for SEO) ===== */
.related-pages-section {
  padding: 4rem 0;
  background: #f9fafb;
}

.related-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.related-page-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.related-page-card:hover {
  border-color: #000000;
  background: #fafafa;
}

.related-page-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #000000;
}

.related-page-arrow {
  font-size: 1.25rem;
  color: #6b7280;
  transition: transform 0.2s ease, color 0.2s ease;
}

.related-page-card:hover .related-page-arrow {
  transform: translateX(4px);
  color: #000000;
}

@media (max-width: 640px) {
  .related-pages-section {
    padding: 3rem 0;
  }

  .related-pages-grid {
    grid-template-columns: 1fr;
  }
}
