.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
}

.template-item {
    position: relative;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
    border: 1px solid #939597;
}

.template-item:hover {
    transform: scale(1.05);
}

.stacked-images {
    position: relative;
    width: 100%;
    height: 300px;
    display: flex;
    transition: transform 0.5s ease;
}

.stacked-images img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.stacked-image-prev,
.stacked-image-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    font-size: 18px;
    cursor: pointer;
}

.stacked-image-prev {
    left: 10px;
}

.stacked-image-next {
    right: 10px;
}

.template-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    z-index: 100;
}

.name {
    font-weight: bold;
    text-align: left;
    margin: 10px;
}

.template-type {
    font-size: 12px;
    color: #ccc;
    text-align: left;
    margin: 10px;
}

.edit-button {
    background-color: gray;
    color: white;
    border: none;
    padding: 1px 5px;
    cursor: pointer;
    font-size: 12px;
    position: absolute;
    right: 6px;
    bottom: 4px;
}

.edit-button:hover {
    background-color: #e68a00;
}