/* Templates Hero Section */
.templates-hero {
    background: var(--primary-purple);
    padding: 5rem 0 4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.templates-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.templates-hero-content {
    position: relative;
    z-index: 2;
}

.templates-hero h1 {
    font-size: 3rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1rem;
    line-height: 1.2;
    letter-spacing: -1px;
}

.templates-hero-subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.8;
}

.templates-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.template-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
    min-width: 180px;
}

.template-stat:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-5px);
}

.template-stat i {
    font-size: 2rem;
    color: white;
    margin-bottom: 0.5rem;
}

.template-stat strong {
    font-size: 2rem;
    font-weight: 800;
    color: white;
}

.template-stat span {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

/* Compact Page Header */
.page-header {
    background: var(--primary-green);
    padding: 2rem 0 1.5rem;
    text-align: center;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: white;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.page-header p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    padding: 0 1rem;
}

/* Demo Buttons */
.demo-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.demo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    border-radius: 50px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    min-width: 200px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.demo-btn i {
    font-size: 1.1rem;
}

.demo-btn-user {
    background: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
}

.demo-btn-user:hover {
    background: #00b359;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 191, 98, 0.4);
}

.demo-btn-admin {
    background: #ff6b35;
    color: white;
    border-color: #ff6b35;
}

.demo-btn-admin:hover {
    background: #e55a2b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

@media (max-width: 576px) {
    .demo-buttons {
        flex-direction: column;
        align-items: stretch;
        padding: 0 1rem;
        gap: 0.75rem;
    }
    
    .demo-btn {
        width: 100%;
        min-width: auto;
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .demo-btn i {
        font-size: 1rem;
    }
}

@media (max-width: 420px) {
    .demo-buttons {
        padding: 0 0.75rem;
    }
    
    .demo-btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.85rem;
    }
}

/* Templates Gallery */
.templates-gallery {
    padding: 1.5rem 0 3rem;
    background: white;
}

.gallery-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 768px) {
    .templates-gallery {
        padding: 1rem 0 2.5rem;
    }
    
    .templates-content {
        padding: 0 0.5rem;
    }
}

@media (max-width: 480px) {
    .templates-gallery {
        padding: 0.75rem 0 2rem;
    }
}

/* Sidebar Filter (Desktop) */
.filter-sidebar {
    position: sticky;
    top: 92px;
    background: white;
    border-radius: 12px;
    max-height: 82vh;
    overflow-y: auto;
    scrollbar-width: none;
    box-shadow: var(--shadow-md);
    padding: 1.25rem;
    border: 2px solid var(--border-color);
}

.sidebar-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-green);
}

.sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header i {
    color: var(--primary-green);
}

.sidebar-filters {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-sidebar-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border: 2px solid transparent;
    background: var(--bg-light);
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    width: 100%;
}

.filter-sidebar-btn i {
    font-size: 1rem;
    color: var(--text-light);
    transition: all 0.3s;
}

.filter-sidebar-btn span:first-of-type {
    flex: 1;
}

.filter-count {
    background: white;
    color: var(--text-light);
    padding: 0.25rem 0.65rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    transition: all 0.3s;
}

.filter-sidebar-btn:hover {
    background: var(--bg-light-green);
    border-color: var(--primary-green);
    transform: translateX(5px);
}

.filter-sidebar-btn:hover i {
    color: var(--primary-green);
}

.filter-sidebar-btn.active {
    background: var(--primary-green);
    border-color: var(--primary-green);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 191, 98, 0.3);
}

.filter-sidebar-btn.active i {
    color: white;
}

.filter-sidebar-btn.active .filter-count {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Mobile Filter Bar */
.filter-mobile-bar {
    display: none;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-light);
    border-radius: 10px;
    border: 2px solid var(--border-color);
}

@media (max-width: 768px) {
    .filter-mobile-bar {
        margin: 0 0.5rem 1rem 0.5rem;
        padding: 0.85rem 1rem;
    }
}

@media (max-width: 480px) {
    .filter-mobile-bar {
        margin: 0 0.5rem 0.75rem 0.5rem;
        padding: 0.75rem 0.85rem;
    }
}

/* Mobile Dropdown Filter */
.filter-dropdown {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.filter-dropdown label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: normal;
    flex-shrink: 0;
    max-width: 45%;
}

@media (max-width: 768px) {
    .filter-dropdown {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .filter-dropdown label {
        font-size: 0.85rem;
        max-width: 100%;
        width: 100%;
    }
    
    .category-select {
        width: 100%;
    }
}

.filter-dropdown label i {
    color: var(--primary-green);
}

.category-select {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    background: white;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s;
    outline: none;
}

.category-select:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(0, 191, 98, 0.1);
}

/* Templates Content Area */
.templates-content {
    min-width: 0;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .templates-content {
        padding: 0 0.5rem;
    }
}

@media (max-width: 480px) {
    .templates-content {
        padding: 0 0.25rem;
    }
}

/* Desktop Horizontal Filter */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 0.25rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-green) var(--bg-light);
}

.filter-bar::-webkit-scrollbar {
    height: 6px;
}

.filter-bar::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 10px;
}

.filter-bar::-webkit-scrollbar-thumb {
    background: var(--primary-green);
    border-radius: 10px;
}

.filter-btn {
    padding: 0.65rem 1.25rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 50px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-btn i {
    font-size: 0.85rem;
}

.filter-btn:hover {
    border-color: var(--primary-green);
    color: var(--primary-green);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.filter-btn.active {
    background: var(--primary-green);
    border-color: var(--primary-green);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 191, 98, 0.3);
}

/* Templates Gallery */
.templates-gallery {
    padding: 2rem 0;
    background: white;
}

.category-section {
    margin-bottom: 3rem;
    animation: fadeIn 0.6s ease-in-out;
}

.category-section:last-child {
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .category-section {
        margin-bottom: 2.5rem;
    }
}

@media (max-width: 480px) {
    .category-section {
        margin-bottom: 2rem;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary-green);
    flex-wrap: wrap;
    gap: 1rem;
}

.category-title-group h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 0.35rem;
    letter-spacing: -0.5px;
}

.category-title-group p {
    font-size: 1rem;
    color: var(--text-light);
}

.category-badge {
    background: var(--primary-purple);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
}

.category-badge span {
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

/* Templates Grid */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.25rem;
    }
}

@media (max-width: 480px) {
    .templates-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

.template-card {
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s;
    box-shadow: var(--shadow-md);
}

.template-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.template-link {
    display: block;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    background: var(--bg-light);
}

.template-link img {
    aspect-ratio: 16/9;
    width: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.template-card:hover .template-link img {
    transform: scale(1.08);
}

.template-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 191, 98, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.template-card:hover .template-overlay {
    opacity: 1;
}

.preview-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.template-card:hover .preview-btn {
    transform: translateY(0);
}

.preview-btn i {
    font-size: 3rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Templates CTA Section */
.templates-cta {
    background: var(--primary-green);
    padding: 3.5rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.templates-cta::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
}

@keyframes moveBackground {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

.cta-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.templates-cta h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.templates-cta p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 2.5rem;
    line-height: 1.8;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.templates-cta .btn-outline {
    border-color: white;
    color: white;
}

.templates-cta .btn-outline:hover {
    background: white;
    color: var(--primary-green);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .gallery-wrapper {
        grid-template-columns: 250px 1fr;
        gap: 2rem;
    }

    .filter-sidebar {
        padding: 1.25rem;
    }
}

@media (max-width: 1024px) {
    .gallery-wrapper {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .filter-sidebar {
        display: none;
    }

    .filter-mobile-bar {
        display: block;
    }

    .templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 2rem;
    }

    .category-header h2 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
.templates-gallery {
    padding-top: 1rem;
}
    
    .page-header {
        padding: 1.5rem 0 1.25rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
        padding: 0 1rem;
    }

    .page-header p {
        font-size: 0.9rem;
        padding: 0 1rem;
    }

    .filter-mobile-bar {
        z-index: 50;
        background: white;
        margin-bottom: 1rem;
        padding: 0.75rem 1rem;
        box-shadow: var(--shadow-sm);
        border-radius: 10px;
        border: 2px solid var(--border-color);
    }

    .category-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 1.25rem;
        padding-bottom: 0.75rem;
        gap: 0.75rem;
    }

    .category-title-group h2 {
        font-size: 1.4rem;
        margin-bottom: 0.25rem;
    }

    .category-title-group p {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .category-badge {
        padding: 0.5rem 1rem;
        align-self: flex-start;
    }

    .category-badge span {
        font-size: 0.85rem;
    }

    .template-link img {
        aspect-ratio: 16/9;
        height: auto;
    }

    .preview-btn {
        font-size: 1rem;
    }

    .preview-btn i {
        font-size: 2.5rem;
    }

    .templates-cta {
        padding: 2.5rem 1rem;
    }

    .templates-cta h2 {
        font-size: 1.6rem;
        padding: 0 1rem;
    }

    .templates-cta p {
        font-size: 0.9rem;
        padding: 0 1rem;
    }

    .cta-buttons {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0 1rem;
    }

    .cta-buttons a {
        width: 100%;
    }

    .category-section {
        margin-bottom: 2.5rem;
    }
}

@media (max-width: 480px) {
    .templates-hero h1 {
        font-size: 1.6rem;
        padding: 0 1rem;
    }

    .templates-hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 2rem;
        padding: 0 1rem;
    }

    .template-stat {
        min-width: 100px;
        padding: 0.75rem 1rem;
    }

    .template-stat i {
        font-size: 1.5rem;
    }

    .template-stat strong {
        font-size: 1.4rem;
    }

    .template-stat span {
        font-size: 0.75rem;
    }
    
    .page-header h1 {
        font-size: 1.35rem;
    }
    
    .page-header p {
        font-size: 0.85rem;
    }

    .filter-dropdown label {
        font-size: 0.8rem;
    }

    .category-select {
        font-size: 0.8rem;
        padding: 0.65rem 0.9rem;
    }

    .category-title-group h2 {
        font-size: 1.25rem;
    }
    
    .category-title-group p {
        font-size: 0.8rem;
    }

    .template-link img {
        aspect-ratio: 16/9;
        height: auto;
    }

    .preview-btn {
        font-size: 0.9rem;
        gap: 0.5rem;
    }

    .preview-btn i {
        font-size: 2rem;
    }

    .templates-cta {
        padding: 2rem 1rem;
    }

    .templates-cta h2 {
        font-size: 1.35rem;
    }
    
    .templates-cta p {
        font-size: 0.85rem;
        line-height: 1.6;
    }
    
    .category-badge {
        padding: 0.4rem 0.85rem;
    }
    
    .category-badge span {
        font-size: 0.8rem;
    }
}

/* Animation for fade in effect */
.fade-in {
    animation: fadeIn 0.6s ease-in-out;
}
