/* Portfolio Templates Page Styles */

/* Hero Section */
.templates-hero {
    background-color: var(--primary-color);
    padding: 4rem 5%;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.templates-hero::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0) 100%);
    z-index: 0;
}

.templates-hero .container {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.templates-hero h1 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.templates-hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.template-search {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.template-search input {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    border: none;
    font-size: 1rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.template-search button {
    position: absolute;
    right: 6px;
    top: 6px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.template-search button:hover {
    background-color: var(--link-hover-color);
}

/* Filters Section */
.filters-section {
    padding: 1.5rem 5%;
    background-color: var(--secondary-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 70px;
    z-index: 10;
    transition: background-color 0.3s ease;
}

.filters-section .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.filters-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.filters-container h2 {
    font-size: 1.3rem;
    margin: 0;
    color: var(--text-color);
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    background: none;
    border: 2px solid transparent;
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background-color: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-container label {
    font-size: 0.9rem;
    color: var(--text-color);
}

.sort-container select {
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

/* Templates Grid Section */
.templates-section {
    padding: 3rem 5%;
    background-color: var(--background-color);
}

.templates-section .container {
    max-width: 1400px;
    margin: 0 auto;
}

.templates-count {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 2rem;
    font-weight: 500;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Template Card Styles */
.template-card {
    background-color: var(--background-color);
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.template-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

.template-thumbnail {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.template-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.template-card:hover .template-thumbnail img {
    transform: scale(1.05);
}

/* We'll keep the overlay but without buttons */
.template-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 1.5rem;
}

.template-card:hover .template-overlay {
    opacity: 1;
}

/* Template content section */
.template-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.template-title {
    font-size: 1.3rem;
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
    font-weight: 600;
    transition: color 0.3s ease;
}

.template-card:hover .template-title {
    color: var(--primary-color);
}

.template-description {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 1.5rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

/* Template meta information */
.template-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 1rem; /* Add space between meta and buttons */
}

.template-downloads {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.template-downloads i {
    color: var(--primary-color);
}

.template-date {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* New Button Container at Card Bottom */
.template-buttons-container {
    display: flex;
    gap: 0.5rem;
    margin-top: auto; /* Push to bottom of card */
    padding: 0 1.5rem 1.5rem;
}

.template-btn {
    flex: 1;
    text-align: center;
    padding: 0.7rem 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.template-btn i {
    font-size: 0.8rem;
}

.template-btn.preview {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.template-btn.preview:hover {
    background-color: var(--secondary-color);
    border-color: var(--primary-color);
}

.template-btn.download {
    background-color: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

.template-btn.download:hover {
    background-color: var(--link-hover-color);
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 3rem;
    grid-column: 1 / -1;
    color: var(--primary-color);
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.loading-spinner p {
    color: var(--text-color);
    font-weight: 500;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem;
    grid-column: 1 / -1;
    color: var(--text-color);
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.no-results p {
    opacity: 0.7;
}

/* CTA Section */
.templates-cta {
    background-color: var(--secondary-color);
    padding: 4rem 5%;
    text-align: center;
}

.templates-cta .container {
    max-width: 800px;
    margin: 0 auto;
}

.cta-content {
    background-color: var(--background-color);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.cta-content h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.cta-content p {
    margin-bottom: 1.5rem;
    color: var(--text-color);
    opacity: 0.8;
}

.cta-content .btn {
    font-size: 1.1rem;
    padding: 1rem 2rem;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .templates-hero h1 {
        font-size: 2.3rem;
    }
    
    .templates-hero p {
        font-size: 1.1rem;
    }
    
    .filters-section .container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-buttons {
        overflow-x: auto;
        white-space: nowrap;
        width: 100%;
        padding-bottom: 0.5rem;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
    }
    
    .filter-buttons::-webkit-scrollbar {
        display: none; /* Chrome, Safari and Opera */
    }
    
    .sort-container {
        margin-top: 0.5rem;
        align-self: flex-end;
    }
    
    .templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 576px) {
    .templates-hero {
        padding: 3rem 5%;
    }
    
    .templates-hero h1 {
        font-size: 2rem;
    }
    
    .templates-hero p {
        font-size: 1rem;
    }
    
    .template-search input {
        padding: 0.8rem 1.2rem;
    }
    
    .templates-grid {
        grid-template-columns: 1fr;
    }
    
    .template-thumbnail {
        height: 180px;
    }
    
    .template-buttons {
        gap: 0.5rem;
    }
    
    .template-btn {
        padding: 0.5rem 1rem;
    }
    
    .cta-content {
        padding: 2rem 1.5rem;
    }
    
    .cta-content h2 {
        font-size: 1.5rem;
    }
}
