/* templates.php specific styles */

/* Page Hero */
.page-hero {
    padding: 90px 72px 24px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f8fafc 0%, #eef4ff 50%, #f8fafc 100%);
}
.page-hero-bg-glow {
    position: absolute;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(66, 129, 200, 0.12) 0%, rgba(66, 129, 200, 0) 70%);
    border-radius: 50%;
    top: 50%;
    right: -100px;
    transform: translateY(-50%);
    z-index: 0;
    pointer-events: none;
}
.page-hero-inner {
    position: relative;
    z-index: 1;
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 48px;
}
.page-hero-text {
    flex: 1;
    min-width: 0;
}
.page-hero-image {
    flex: 0 0 400px;
    position: relative;
    animation: floatHero 6s ease-in-out infinite;
}
@keyframes floatHero {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-16px); }
    100% { transform: translateY(0px); }
}
.page-hero-image img {
    width: 100%;
    display: block;
    transform: perspective(800px) rotateY(-15deg);
    transition: transform 0.3s ease;
}
.page-hero-image img:hover {
    transform: perspective(800px) rotateY(-5deg);
}
.page-hero-image-glow {
    position: absolute;
    width: 100%;
    max-width: 380px;
    height: 100%;
    max-height: 380px;
    background: radial-gradient(circle, rgba(66, 129, 200, 0.25) 0%, rgba(66, 129, 200, 0) 70%);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    pointer-events: none;
}
.page-hero-image-shape {
    position: absolute;
    width: 90%;
    height: 90%;
    max-width: 320px;
    max-height: 320px;
    background: linear-gradient(135deg, rgba(66, 129, 200, 0.15) 0%, rgba(200, 220, 227, 0.4) 100%);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    animation: pulseShape 4s ease-in-out infinite;
}
@keyframes pulseShape {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
    100% { transform: translate(-50%, -50%) scale(1); }
}
.page-hero-image-dots {
    position: absolute;
    width: 100px;
    height: 100px;
    background-image: radial-gradient(#4281c8 2px, transparent 2px);
    background-size: 18px 18px;
    z-index: -1;
    top: -10px;
    right: -10px;
    opacity: 0.3;
    animation: floatDots 10s linear infinite;
}
.page-hero-ornament-circle {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 4px solid rgba(66, 129, 200, 0.1);
    border-radius: 50%;
    bottom: 10%;
    left: 8%;
    z-index: 0;
    pointer-events: none;
    animation: pulseShape 5s ease-in-out infinite;
}
.page-hero-ornament-morph {
    position: absolute;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(200, 220, 227, 0.5);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    top: 20%;
    right: 15%;
    z-index: 0;
    pointer-events: none;
    animation: morphShape 7s ease-in-out infinite;
}
@keyframes floatDots {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-12px) rotate(5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}
@keyframes morphShape {
    0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; transform: rotate(0deg); }
    50% { border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%; transform: rotate(180deg); }
    100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; transform: rotate(360deg); }
}
.page-hero-title {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 10px;
    color: #081427;
}
.page-hero-title span {
    color: #4281c8;
    position: relative;
    display: inline-block;
}
.page-hero-title span::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 0;
    width: 100%;
    height: 10px;
    background: rgba(66, 129, 200, 0.15);
    z-index: -1;
    border-radius: 4px;
}
.page-hero-desc {
    font-size: 14px;
    color: #6B7280;
    line-height: 1.6;
    max-width: 520px;
    margin-bottom: 0;
}
.page-hero-stats {
    display: flex;
    gap: 28px;
}
.page-hero-stat {
    display: flex;
    flex-direction: column;
}
.page-hero-stat strong {
    font-size: 20px;
    font-weight: 800;
    color: #081427;
}
.page-hero-stat small {
    font-size: 12px;
    color: #6B7280;
}

/* Templates Grid Section */
.templates-section {
    padding: 40px 48px 100px;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}
.templates-ornament-1 {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(66, 129, 200, 0.08) 0%, rgba(66, 129, 200, 0) 70%);
    border-radius: 50%;
    top: -100px;
    right: -150px;
    z-index: 0;
    pointer-events: none;
}
.templates-ornament-2 {
    position: absolute;
    width: 180px;
    height: 180px;
    background-image: radial-gradient(#4281c8 2px, transparent 2px);
    background-size: 20px 20px;
    bottom: 80px;
    left: -60px;
    opacity: 0.12;
    z-index: 0;
    pointer-events: none;
    border-radius: 50%;
    animation: floatDots 12s linear infinite;
}
.templates-ornament-3 {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 6px solid rgba(66, 129, 200, 0.08);
    border-radius: 50%;
    top: 40%;
    left: 5%;
    z-index: 0;
    pointer-events: none;
    animation: pulseShape 6s ease-in-out infinite;
}
.templates-ornament-4 {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 4px solid rgba(200, 220, 227, 0.4);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    bottom: 15%;
    right: 8%;
    z-index: 0;
    pointer-events: none;
    animation: morphShape 8s ease-in-out infinite;
}
.templates-section > *:not(.templates-ornament-1):not(.templates-ornament-2):not(.templates-ornament-3):not(.templates-ornament-4) {
    position: relative;
    z-index: 1;
}
.templates-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 16px;
}

/* Templates Search Section Styles */
.templates-search-section {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

.templates-search-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.templates-search-input {
    width: 100%;
    padding: 16px 50px 16px 54px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    color: #081427;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid #c8dce3;
    border-radius: 16px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.templates-search-input:focus {
    background: #ffffff;
    border-color: #4281c8;
    box-shadow: 0 8px 30px rgba(66, 129, 200, 0.12);
}

.templates-search-icon {
    position: absolute;
    left: 20px;
    color: #6B7280;
    width: 20px;
    height: 20px;
    pointer-events: none;
    transition: color 0.3s;
}

.templates-search-input:focus + .templates-search-icon {
    color: #4281c8;
}

.templates-search-clear {
    position: absolute;
    right: 20px;
    background: #eef4ff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: #4281c8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    opacity: 0;
    visibility: hidden;
}

.templates-search-clear.visible {
    opacity: 1;
    visibility: visible;
}

.templates-search-clear:hover {
    background: #4281c8;
    color: #ffffff;
    transform: scale(1.1);
}

/* Suggestion Chips / Tags */
.templates-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.templates-tag {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #6B7280;
    background: #ffffff;
    border: 1px solid #c8dce3;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.templates-tag:hover {
    border-color: #4281c8;
    color: #4281c8;
    background: #eef4ff;
    transform: translateY(-1px);
}

.templates-tag.active {
    background: #4281c8;
    color: #ffffff;
    border-color: #4281c8;
    box-shadow: 0 4px 12px rgba(66, 129, 200, 0.2);
}


.templates-count {
    font-size: 14px;
    color: #6B7280;
    text-align: center;
}
.templates-count strong {
    color: #081427;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 48px;
}
.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #c8dce3;
    border-radius: 10px;
    background: #ffffff;
    color: #6B7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    user-select: none;
}
.pagination-btn:hover {
    border-color: #4281c8;
    color: #4281c8;
}
.pagination-btn.active {
    background: #4281c8 !important;
    color: #fff !important;
    border-color: #4281c8 !important;
    pointer-events: none;
}
.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.pagination-btn svg {
    width: 18px;
    height: 18px;
}

/* Template card (grid variant) */
.template-card {
    border: 1px solid #c8dce3;
}
.template-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}

.template-preview {
    height: 340px;
    background: #e8edf2;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12px;
    position: relative;
    overflow: hidden;
}
.template-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
    z-index: 2;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    pointer-events: none;
}
.template-preview.loaded::before {
    display: none;
}
@keyframes skeletonShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.template-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    border-radius: 8px;
    transition: transform 0.3s ease, opacity 0.4s ease;
    opacity: 0;
    position: relative;
    z-index: 1;
}
.template-preview img.loaded {
    opacity: 1;
}
.template-preview.loaded img.loaded {
    z-index: 1;
}
.template-card:hover .template-preview img {
    transform: scale(1.03);
}

.template-overlay {
    padding-bottom: 20px;
}

.template-zoom-btn {
    width: 36px;
    height: 36px;
}
.template-zoom-btn svg {
    width: 18px;
    height: 18px;
}

.template-info {
    padding: 16px 20px 20px;
}
.template-name {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #081427;
    margin-bottom: 4px;
}
.template-category {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #4281c8;
    background: #eef4ff;
    padding: 2px 10px;
    border-radius: 20px;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.template-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}
.template-categories .template-category {
    margin-bottom: 0;
}
.template-desc {
    font-size: 13px;
    color: #6B7280;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Zoom Modal */
.zoom-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.zoom-modal.active {
    display: flex;
}
.zoom-modal img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}
.zoom-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #ffffff;
    color: #081427;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    border: 1px solid #c8dce3;
}

/* No templates */
.no-templates {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: #6B7280;
}
.no-templates svg {
    display: block;
    margin: 0 auto 16px;
    width: 80px;
    height: 80px;
    color: #c8dce3;
}
.no-templates h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    color: #081427;
    margin-bottom: 8px;
}



/* Responsive templates */
@media (max-width: 1024px) {
    .page-hero {
        padding: 85px 32px 24px;
    }
    .page-hero-inner {
        flex-direction: column;
        gap: 28px;
    }
    .page-hero-image {
        flex: none;
        width: 100%;
        max-width: 480px;
    }
    .page-hero-title {
        font-size: 32px;
    }
    .templates-section {
        padding: 40px 24px 60px;
    }
    .templates-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .page-hero {
        padding: 80px 16px 20px;
    }
    .page-hero-title {
        font-size: 22px;
    }
    .page-hero-desc {
        font-size: 13px;
    }
    .page-hero-stats {
        gap: 20px;
    }
    .page-hero-image-dots {
        display: none;
    }
    .page-hero-ornament-circle,
    .page-hero-ornament-morph {
        display: none;
    }
    .templates-ornament-1,
    .templates-ornament-2,
    .templates-ornament-3,
    .templates-ornament-4 {
        display: none;
    }
    .templates-section {
        padding: 20px 16px 48px;
    }
    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .template-preview {
        height: auto;
        aspect-ratio: 3 / 4;
        padding: 8px;
    }
    .card-outline {
        display: none;
    }
    .template-overlay {
        opacity: 1;
        background: rgba(0,0,0,0.35);
        padding-bottom: 16px;
    }
    .template-btn {
        transform: translateY(0);
        width: auto;
        height: 32px;
        font-size: 12px;
        padding: 0 14px;
    }
    .template-zoom-btn {
        transform: scale(1);
        opacity: 1;
        width: 32px;
        height: 32px;
        top: 12px;
        right: 12px;
    }
    .template-zoom-btn svg {
        width: 16px;
        height: 16px;
    }
    .template-info {
        padding: 12px 14px 16px;
    }
    .template-name {
        font-size: 14px;
    }
    .template-desc {
        font-size: 12px;
    }

}

@media (max-width: 480px) {
    .templates-grid {
        grid-template-columns: 1fr;
        max-width: 340px;
        margin: 0 auto;
    }
    .pagination-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
        padding: 0 8px;
    }
}
