/* Templates Page Specific Styles */

/* Templates Hero Section */
.templates-hero {
    background: linear-gradient(135deg, #ffd700 0%, #ffeb3b 100%);
    color: #111;
    padding: 120px 0 80px;
    position: relative;
    overflow: hidden;
}

.templates-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

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

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    font-family: 'Arvo', serif;
    font-style: italic;
}

.hero-subtitle {
    font-size: 1.2rem;
    font-weight: 300;
    margin-bottom: 2rem;
    opacity: 0.9;
    line-height: 1.6;
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.filter-btn {
    border-radius: 25px !important;
    text-transform: none !important;
    font-family: 'Poppins', sans-serif !important;
    font-weight: 400 !important;
    transition: all 0.3s ease !important;
}

.filter-btn.active {
    background-color: white !important;
    color: #111 !important;
    border-color: #ffd700 !important;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.25) !important;
}

.filter-btn:not(.active) {
    background-color: transparent !important;
    color: #111 !important;
    border-color: rgba(0,0,0,0.2) !important;
}

.filter-btn:not(.active):hover {
    background-color: rgba(255, 215, 0, 0.12) !important;
    border-color: #ffd700 !important;
}

/* Templates Gallery */
.templates-gallery {
    padding: 80px 0;
    background-color: #f8f9fa;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Template Card */
.template-card {
    background: white;
    border-radius: 16px !important;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
    position: relative;
}

.template-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15) !important;
}

/* Template Preview */
.template-preview {
    position: relative;
    height: 250px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}
.template-preview::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 10px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.92) 100%);
    pointer-events: none;
    z-index: 2;
}

.template-mockup {
    width: 100%;
    height: 100%;
    padding: 20px;
    transform: scale(0.8);
    transform-origin: top left;
    transition: transform 0.3s ease;
}

.template-card:hover .template-mockup {
    transform: scale(0.85);
}

/* Real screenshot preview support */
.template-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 20%; /* show lower portion of screenshot */
    display: block;
    position: relative;
    z-index: 0;
    transition: transform 0.3s ease;
}

.template-card:hover .template-image {
    transform: scale(1.03);
}

/* Mockup Elements */
.mockup-header {
    height: 40px;
    background: white;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
}

.mockup-nav {
    height: 20px;
    background: linear-gradient(90deg, #ffd700, #ffeb3b);
    border-radius: 4px;
    margin: 10px;
}

.mockup-hero {
    height: 80px;
    background: linear-gradient(135deg, #ffd700, #ffeb3b);
    border-radius: 8px;
    margin-bottom: 15px;
    position: relative;
}

.mockup-content {
    display: flex;
    gap: 10px;
}

.mockup-section {
    flex: 1;
    height: 60px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Business Template Mockups */
.business-template-1 .mockup-hero {
    background: linear-gradient(135deg, #2196F3, #21CBF3);
}

.business-template-2 .mockup-hero {
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
}

.business-template-2 .mockup-services {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.service-card {
    height: 40px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Portfolio Template Mockups */
.portfolio-template-1 .portfolio-hero {
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
}

.portfolio-template-2 .portfolio-hero-2 {
    background: linear-gradient(135deg, #A8E6CF, #7FCDCD);
}

.mockup-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.gallery-item {
    height: 35px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mockup-projects {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.project-item {
    flex: 1;
    height: 50px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* E-commerce Template Mockups */
.ecommerce-template-1 .ecommerce-hero {
    background: linear-gradient(135deg, #FF9A9E, #FECFEF);
}

.mockup-products {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.product-card {
    height: 45px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Blog Template Mockups */
.blog-template-1 .blog-hero {
    background: linear-gradient(135deg, #ffd700, #ffeb3b);
}

.mockup-posts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.post-card {
    height: 30px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Landing Page Template Mockups */
.landing-template-1 .landing-hero {
    background: linear-gradient(135deg, #FFA726, #FF7043);
}

.landing-template-2 .landing-hero-2 {
    background: linear-gradient(135deg, #AB47BC, #8E24AA);
}

.mockup-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.feature-block {
    height: 40px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mockup-cta {
    margin-top: 15px;
}

.cta-section {
    height: 50px;
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    border-radius: 6px;
}

/* Template Overlay */
.template-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.preview-btn {
    background-color: white !important;
    color: #111 !important;
    border: 2px solid #ffd700 !important;
}

/* Template Info */
.template-info {
    padding: 1.5rem;
}

.template-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-family: 'Poppins', sans-serif;
}

.template-description {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
    font-size: 0.95rem;
}

.template-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.feature-tag {
    background: linear-gradient(135deg, #ffd700, #ffeb3b);
    color: #111;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.template-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

/* Color palette row above preview button */
.template-price-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-palette {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 0;
}

.color-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: inline-block;
}

.color-dot.selected {
    border-color: #111;
    box-shadow: 0 0 0 2px rgba(17,17,17,0.25), 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: scale(1.06);
}

.color-dot:hover {
    transform: scale(1.06);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

@media (max-width: 600px) {
    .color-dot {
        width: 16px;
        height: 16px;
    }
    .color-palette {
        gap: 6px;
        padding: 4px 0;
    }
}

.template-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffb300;
    font-family: 'Poppins', sans-serif;
}

.select-template-btn {
    background: linear-gradient(135deg, #ffd700, #ffeb3b) !important;
    color: #111 !important;
    border: 2px solid #ffffff !important;
    border-radius: 25px !important;
    text-transform: none !important;
    font-family: 'Poppins', sans-serif !important;
}

/* Load More Section */
.load-more-section {
    text-align: center;
    margin-top: 2rem;
}

.load-more-btn {
    border-radius: 25px !important;
    text-transform: none !important;
    font-family: 'Poppins', sans-serif !important;
    border-color: #ffd700 !important;
    color: #ffb300 !important;
    padding: 12px 32px !important;
}

.load-more-btn:hover {
    background-color: #ffd700 !important;
    color: #111 !important;
}

/* Templates CTA Section */
.templates-cta {
    background: linear-gradient(135deg, #ffd700 0%, #ffeb3b 100%);
    color: #111;
    padding: 80px 0;
    text-align: center;
}

.cta-content h2 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    font-family: 'Poppins', sans-serif;
}

.cta-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.cta-buttons .mdc-button {
    border-radius: 25px !important;
    text-transform: none !important;
    font-family: 'Poppins', sans-serif !important;
    padding: 12px 32px !important;
}

.cta-buttons .mdc-button--raised {
    background-color: white !important;
    color: #111 !important;
    border: 2px solid #ffd700 !important;
}

.cta-buttons .mdc-button--outlined {
    border-color: #111 !important;
    color: #111 !important;
}

.cta-buttons .mdc-button--outlined:hover {
    background-color: rgba(255,255,255,0.1) !important;
}

/* Filter Animation */
.template-card.filter-hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.template-card.filter-visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .filter-buttons {
        gap: 0.5rem;
    }
    
    .filter-btn {
        font-size: 0.9rem !important;
        padding: 8px 16px !important;
    }
    
    .templates-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .template-preview {
        height: 200px;
    }

@media (max-width: 480px) {
    .templates-hero {
        padding: 100px 0 60px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .templates-gallery {
        padding: 60px 0;
    }
    
    /* Two-column grid on small screens */
    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    /* More compact previews */
    .template-preview {
        height: 110px;
    }
    
    /* Mobile fade overlay height */
    .template-preview::after {
        height: 32px;
    }
    
    /* Tighten card body spacing */
    .template-info {
        padding: 0.6rem;
    }
    
    .template-title {
        font-size: 1.0rem;
        line-height: 1.25;
        margin-bottom: 0.3rem;
    }
    
    /* Clamp description to two lines */
    .template-description {
        font-size: 0.8rem;
        line-height: 1.35;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-bottom: 0.6rem;
    }
    
    /* Hide feature chips on phones */
    .template-features {
        display: none;
    }
    
    /* Compact actions */
    .template-actions {
        gap: 0.4rem;
    }
    
    .template-price {
        font-size: 1.0rem;
    }
    
    .select-template-btn {
        padding: 5px 10px !important;
        font-size: 0.8rem !important;
        border-radius: 16px !important;
    }
    
    .preview-btn {
        padding: 5px 10px !important;
        font-size: 0.8rem !important;
        border-radius: 16px !important;
    }
    
    .templates-cta {
        padding: 60px 0;
    }
    
    .cta-content h2 {
        font-size: 1.75rem;
    }
    
    .cta-content p {
        font-size: 1rem;
    }
}

/* Palette removed intentionally (desktop + mobile) */

/* Animation Classes */
.fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stagger-animation {
    animation: staggerIn 0.6s ease-out forwards;
}

@keyframes staggerIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Animation for Template Cards */
.template-card.loading {
    opacity: 0.5;
    pointer-events: none;
}

.template-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.scroll-to-top:hover {
    background: #1565c0;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
}

/* Card Refinements */
.template-card {
    border: 1px solid rgba(0,0,0,0.06);
}

.template-card::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg, #ffd700, #ffeb3b);
}

.template-preview {
    height: 280px;
}

.template-title {
    font-weight: 700;
}

.template-description {
    color: #444;
    font-size: 1rem;
}

.template-actions {
    gap: 1rem;
}
    
    .template-mockup {
        transform: scale(0.7);
    }
    
    .template-card:hover .template-mockup {
        transform: scale(0.75);
    }
    
    .template-actions {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .template-price {
        text-align: center;
    }
    
    .cta-content h2 {
        font-size: 2rem;
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .cta-buttons .mdc-button {
        width: 200px;
    }
}

@media (max-width: 480px) {
    .templates-hero {
        padding: 100px 0 60px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .templates-gallery {
        padding: 60px 0;
    }
    
    .template-info {
        padding: 1rem;
    }
    
    .template-title {
        font-size: 1.25rem;
    }
    
    .template-description {
        font-size: 0.9rem;
    }
    
    .templates-cta {
        padding: 60px 0;
    }
    
    .cta-content h2 {
        font-size: 1.75rem;
    }
    
    .cta-content p {
        font-size: 1rem;
    }
}

/* Animation Classes */
.fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stagger-animation {
    animation: staggerIn 0.6s ease-out forwards;
}

@keyframes staggerIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Animation for Template Cards */
.template-card.loading {
    opacity: 0.5;
    pointer-events: none;
}

.template-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.scroll-to-top:hover {
    background: #1565c0;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
}

/* Template Search (Enhanced) */
.template-search {
    position: sticky;
    top: 72px; /* below fixed top bar */
    z-index: 20;
    display: flex;
    justify-content: center;
    padding: 12px 16px;
    margin: 1.5rem auto 2rem;
    width: calc(100% - 32px);
    max-width: 980px;
    background: rgba(255,255,255,0.96);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    backdrop-filter: saturate(180%) blur(8px);
}

.template-search input {
    width: 100%;
    max-width: 100%;
    font-family: 'Poppins', sans-serif;
    font-size: 1.125rem;
    padding: 16px 18px;
    border-radius: 12px;
    border: 2px solid rgba(0,0,0,0.2);
    background: #fff;
    color: #111;
}

.template-search input::placeholder {
    color: #666;
}

.template-search input:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.15);
}