/* Modal */
.template-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    overflow-y: auto; /* Cho phép cuộn nội dung */
}

.template-modal-content {
    background: white;
    margin: 50px auto;
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 800px;
    position: relative;
}

#close-template-modal {
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
    font-size: 20px;
}

/* Template Grid */
.template-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.template-card {
    width: 220px!important;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
     margin: 10px;
    background: #fff;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.template-card:hover {
    transform: scale(1.05);
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
}

.select-template-button {
    padding: 5px 10px;
    background: #0073aa;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s ease;
}

.select-template-button:hover {
    background: #005a87;
}

/* Template Thumbnail */
.template-thumbnail {
    overflow: hidden;
    display: flex;
    align-items: center; /* Căn giữa dọc */
    justify-content: center; /* Căn giữa ngang */
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
}

.template-thumbnail svg {
    max-width: 100%; /* Giới hạn chiều rộng */
    max-height: 100%; /* Giới hạn chiều cao */
    height: auto; /* Giữ tỉ lệ SVG */
    width: auto; /* Giữ tỉ lệ SVG */
}

/* Responsive Styles */
@media screen and (max-width: 768px) {
    .template-modal-content {
        width: 95%; /* Thu hẹp modal trên màn hình nhỏ */
        margin: 20px auto; /* Giảm khoảng cách bên trên */
    }

    .template-thumbnail {
        width: 140px; /* Kích thước thumbnail nhỏ hơn trên di động */
    }

    .template-card {
        width: 160px!important; /* Thu nhỏ các template card */
    }
.template-grid {
        gap: 15px;
    }
    .template-card {
        margin: 15px;
    }
    .select-template-button {
        font-size: 12px; /* Giảm kích thước chữ */
        padding: 4px 8px; /* Giảm kích thước nút */
    }
}
