/* Template page specific styles - only affects content within .container */
.templates-page-container {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.templates-page-container {
    width: 100%;
    background: #f8f9fa;
    min-height: calc(100vh - 80px);
    padding-top: 80px;
}

.templates-page-container .container {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem 2rem 4rem;
}

.templates-page-container .container > header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 0;
}

.templates-page-container .container > header h1 {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    color: #0f172a;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.1;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.templates-page-container .subtitle {
    font-size: 1.35rem;
    color: #64748b;
    font-weight: 500;
    line-height: 1.4;
    margin-top: 0;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.templates-page-container .category-filter {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.templates-page-container .filter-btn {
    padding: 0.875rem 2rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #475569;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.templates-page-container .filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.templates-page-container .filter-btn[data-category="all"]:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.templates-page-container .filter-btn[data-category="modern"]:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.templates-page-container .filter-btn[data-category="minimalistisch"]:hover {
    border-color: #10b981;
    color: #10b981;
}

.templates-page-container .filter-btn[data-category="creatief"]:hover {
    border-color: #a855f7;
    color: #a855f7;
}

.templates-page-container .filter-btn.active {
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.templates-page-container .filter-btn[data-category="all"].active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.templates-page-container .filter-btn[data-category="modern"].active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.templates-page-container .filter-btn[data-category="minimalistisch"].active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.templates-page-container .filter-btn[data-category="creatief"].active {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
    border-color: #a855f7;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}

.templates-page-container .templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 2.5rem;
    margin-bottom: 3rem;
    max-width: 100%;
}

.templates-page-container .template-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.templates-page-container .template-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.templates-page-container .template-preview {
    height: 650px;
    min-height: 650px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
    border-bottom: 1px solid #e5e7eb;
    padding: 25px;
}

.templates-page-container .template-preview-inner {
    width: 100%;
    height: 100%;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.templates-page-container .template-preview-inner .a4-page {
    transform: scale(0.55);
    transform-origin: center center;
}

.templates-page-container .template-preview-inner .cv-template {
    box-shadow: none;
}

.templates-page-container .template-info {
    padding: 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.templates-page-container .template-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 700;
}

.templates-page-container .template-info p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 1rem;
    font-weight: 500;
}

.templates-page-container .template-category {
    color: var(--text-light);
    font-weight: 600;
}

.templates-page-container .template-category[data-category="modern"] {
    color: #3b82f6;
}

.templates-page-container .template-category[data-category="minimalistisch"] {
    color: #10b981;
}

.templates-page-container .template-category[data-category="creatief"] {
    color: #a855f7;
}

.templates-page-container .template-buttons {
    display: flex;
    gap: 1rem;
    margin-top: auto;
    flex-wrap: wrap;
}

.templates-page-container .btn-select,
.templates-page-container .btn-preview {
    flex: 1;
    min-width: 140px;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.templates-page-container .btn-select {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.templates-page-container .btn-select:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.templates-page-container .btn-preview {
    background: white;
    color: var(--text-dark);
    border: 2px solid #e2e8f0;
}

.templates-page-container .btn-preview:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.templates-page-container .template-card.hidden {
    display: none;
}

/* Template Preview Modal */
.template-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.template-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10001;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a202c;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.modal-close:hover {
    background: white;
    transform: rotate(90deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.modal-template-preview {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-template-preview .a4-page {
    width: 210mm;
    min-height: 297mm;
    height: auto;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: scale(0.8);
    transform-origin: center center;
}

.modal-template-preview .cv-template {
    width: 210mm;
    min-height: 297mm;
    height: auto;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    display: block;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 1.5rem 1.5rem 1rem;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-template-preview .a4-page {
        transform: scale(0.5);
    }
    
    .templates-page-container .template-buttons {
        flex-direction: column;
    }
    
    .templates-page-container .btn-select,
    .templates-page-container .btn-preview {
        width: 100%;
    }
}

@media (max-width: 1400px) {
    .templates-page-container .container {
        max-width: 1200px;
        padding: 2.5rem 1.5rem;
    }
    
    .templates-page-container .templates-grid {
        grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
        gap: 2rem;
    }
}

/* Category Header (Mobile Only) */
.templates-category-header {
    text-align: center;
    margin: 1.5rem 0 1rem;
    padding: 0 1rem;
}

.templates-category-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

/* Carousel Wrapper (Mobile Only) - Hidden, dots are per card now */
.templates-carousel-wrapper {
    display: none !important;
}

.templates-swipe-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    transition: opacity 0.4s ease;
}

.templates-swipe-hint svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.templates-swipe-hint.fade-out {
    opacity: 0;
}

.templates-swipe-hint.hidden {
    display: none;
}

@media (max-width: 767px) {
    .templates-page-container .container {
        padding: 2rem 1rem;
    }
    
    /* Show category header and carousel on mobile */
    .templates-category-header {
        display: block !important;
    }
    
    .templates-carousel-wrapper {
        display: block !important;
    }
    
    /* Hide category filter on mobile */
    .templates-page-container .category-filter {
        display: none;
    }
    
    /* Mobile slider/carousel for templates page - same as homepage */
    .templates-page-container .templates-grid {
        display: flex;
        overflow-x: auto;
        overflow-y: visible;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 0;
        padding: 3rem 0.5rem 0.5rem;
        margin: 0 -1rem;
        margin-top: 0;
        position: relative;
        scroll-padding-left: 0.5rem;
        scroll-padding-right: 0.5rem;
        scroll-behavior: smooth;
    }
    
    .templates-page-container .templates-grid::-webkit-scrollbar {
        display: none;
    }
    
    .templates-page-container .template-card {
        flex: 0 0 80%;
        max-width: 80%;
        scroll-snap-align: center;
        margin-right: 0.5rem;
        flex-shrink: 0;
        overflow: visible;
        position: relative;
        padding-top: 0;
    }
    
    .templates-page-container .template-card:first-child {
        margin-left: 0.5rem;
    }
    
    .templates-page-container .template-card:last-child {
        margin-right: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .templates-page-container .container > header h1 {
        font-size: 2.5rem;
        letter-spacing: -0.5px;
    }
    
    .templates-page-container .subtitle {
        font-size: 1.1rem;
        max-width: 100%;
    }
    
    /* Category badge above preview (mobile only) - like homepage */
    .templates-page-container .template-category-badge {
        display: none;
    }
    
    .templates-page-container .template-card {
        position: relative;
        overflow: visible !important;
        padding-top: 0;
    }
    
    .templates-page-container .template-category-badge {
        position: absolute;
        top: 0;
        left: 0;
        padding: 0.5rem 1rem;
        border-radius: 0 0 50px 0;
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        z-index: 10;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        display: block !important;
    }
    
    .templates-page-container .template-card[data-category="modern"] .template-category-badge {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        color: white;
    }
    
    .templates-page-container .template-card[data-category="minimalistisch"] .template-category-badge {
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
        color: white;
    }
    
    .templates-page-container .template-card[data-category="creatief"] .template-category-badge {
        background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
        color: white;
    }
    
    .templates-page-container .template-card {
        padding-top: 2.5rem !important;
    }
    
    /* Template preview - compact like homepage mobile, tight fit */
    .templates-page-container .template-preview {
        height: clamp(380px, 50vh, 420px) !important;
        min-height: clamp(380px, 50vh, 420px) !important;
        max-height: clamp(380px, 50vh, 420px) !important;
        overflow: hidden !important;
        background: #f8f9fa !important;
        padding: 0.25rem !important;
        margin: 0 !important;
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
        position: relative !important;
        border-bottom: none !important;
    }
    
    /* Template info - compact on mobile */
    .templates-page-container .template-info {
        padding: 0.75rem 1.25rem 1rem;
        background: white;
    }
    
    .templates-page-container .template-info h3 {
        font-size: 1.125rem;
        margin-bottom: 0.25rem;
    }
    
    .templates-page-container .template-info p {
        font-size: 0.8125rem;
        margin-bottom: 0.5rem;
    }
    
    /* Pagination dots per card - visible on mobile, right under preview */
    .templates-page-container .template-card-pagination {
        display: flex !important;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0;
        margin: 0.5rem 0 0.75rem;
    }
    
    .templates-page-container .template-card-pagination-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #d1d5db;
        border: none;
        padding: 0;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        flex-shrink: 0;
        outline: none;
        opacity: 0.5;
    }
    
    .templates-page-container .template-card-pagination-dot:hover {
        opacity: 0.8;
        transform: scale(1.2);
    }
    
    .templates-page-container .template-card-pagination-dot.active {
        width: 24px;
        height: 6px;
        border-radius: 4px;
        background: #6366f1;
        opacity: 1;
        transform: scale(1);
    }
    
    /* Template buttons - side by side on mobile */
    .templates-page-container .template-buttons {
        flex-direction: row;
        gap: 0.75rem;
        margin-top: 0;
        padding-top: 0;
    }
    
    .templates-page-container .btn-preview,
    .templates-page-container .btn-select {
        flex: 1;
        min-width: 0;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        font-weight: 600;
        margin: 0;
        text-align: center;
    }
}

@media (min-width: 768px) {
    /* Hide category header and carousel on desktop */
    .templates-category-header {
        display: none !important;
    }
    
    .templates-carousel-wrapper {
        display: none !important;
    }
    
    /* Hide category badge on desktop */
    .templates-page-container .template-category-badge {
        display: none !important;
    }
    
    .templates-page-container .template-card {
        padding-top: 0 !important;
    }
    
    /* Hide pagination dots on desktop */
    .templates-page-container .template-card-pagination {
        display: none !important;
    }
    
    /* Buttons back to column on desktop */
    .templates-page-container .template-buttons {
        flex-direction: column;
    }
}

