/* Templates Page Styles */

/* Hero */
.templates-hero {
    padding: 100px 0 60px;
    background: linear-gradient(180deg, rgba(247, 250, 252, 1) 0%, rgba(255, 255, 255, 1) 100%);
    text-align: center;
}

.templates-hero h1 {
    font-size: 4rem;
    margin-bottom: 20px;
}

.templates-hero p {
    font-size: 1.2rem;
    color: var(--gray);
    line-height: 1.6;
}

/* Categories */
.categories-section {
    padding: 20px 0;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--light-gray);
    position: sticky;
    top: 80px;
    /* Below navbar */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    z-index: 900;
}

.category-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.cat-btn {
    padding: 10px 20px;
    border: 1px solid var(--light-gray);
    background: white;
    border-radius: 30px;
    font-weight: 600;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.3s;
}

.cat-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cat-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(108, 99, 255, 0.3);
}

/* Templates Grid */
.templates-display {
    padding-bottom: 100px;
}

.templates-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.templates-grid.active {
    display: grid;
}

.template-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    cursor: pointer;
    border: 1px solid transparent;
}

.template-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(108, 99, 255, 0.2);
}

.card-image {
    position: relative;
    height: 350px;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.template-card:hover .card-image img {
    transform: scale(1.05);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.template-card:hover .overlay {
    opacity: 1;
}

.card-info {
    padding: 20px;
    text-align: center;
}

.card-info h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.price {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.open {
    display: flex;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.modal-preview {
    background: #f0f0f0;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal-preview img {
    max-height: 500px;
    width: auto;
    max-width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-price-tag {
    margin-top: 20px;
    background: var(--dark);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1.2rem;
}

.modal-form-container {
    padding: 40px;
}

.modal-subtitle {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mini-upload {
    border: 2px dashed var(--light-gray);
    padding: 20px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    color: var(--gray);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.9rem;
}

.mini-upload:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.full-width {
    width: 100%;
    justify-content: center;
    margin-top: 20px;
}

.file-list-em {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--gray);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .modal-grid {
        grid-template-columns: 1fr;
    }

    .modal-preview {
        padding: 20px;
    }

    .modal-preview img {
        max-height: 300px;
    }

    .templates-hero h1 {
        font-size: 2.5rem;
    }

    .templates-hero {
        padding: 60px 0 40px;
    }

    .templates-hero p {
        font-size: 1rem;
        padding: 0 15px;
    }

    .category-tabs {
        padding: 0 15px;
        gap: 10px;
    }

    .cat-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .templates-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .template-card {
        max-width: 100%;
    }

    .card-image {
        height: 300px;
    }

    .card-info h3 {
        font-size: 1rem;
    }

    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-form-container {
        padding: 25px 20px;
    }

    .modal-subtitle {
        font-size: 0.85rem;
    }

    .close-modal {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
    }

    .modal-price-tag {
        font-size: 1rem;
        padding: 8px 16px;
    }
}

@media (max-width: 480px) {
    .templates-hero h1 {
        font-size: 2rem;
    }

    .card-image {
        height: 250px;
    }

    .templates-grid {
        gap: 15px;
    }
}