/* ===========================
   Variables / Reset
=========================== */
.ha-tmpl-section {
    font-family: "DM Sans", sans-serif;
    margin: 0 auto;
    text-align: left;
}

/* ===========================
   Header
=========================== */
.ha-tmpl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 16px;
}

.ha-tmpl-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ha-tmpl-cat {
    padding: 11px 20px;
    border: 1px solid #d7eeff;
    border-radius: 50px;
    text-decoration: none;
    color: #0a0d11;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
    transition: background 0.25s, color 0.25s, border-color 0.25s;
    white-space: nowrap;
}

.ha-tmpl-cat.active,
.ha-tmpl-cat:hover {
    background: #0960ec;
    color: #fff !important;
    border-color: #0960ec;
}

/* ===========================
   Search
=========================== */
.ha-tmpl-search {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 334px;
    max-width: 100%;
    padding: 11px 17px;
    border: 1px solid #d7eeff;
    border-radius: 50px;
    background: #fff;
}

.ha-tmpl-search input {
    border: none;
    outline: none;
    font-size: 16px;
    line-height: 1.4;
    color: #171717;
    width: 100%;
    background: transparent;
}

.ha-tmpl-search input::placeholder {
    color: #9d9d9d;
}

/* ===========================
   Grid
=========================== */
.ha-tmpl-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px 14px;
}

/* Hidden items (loaded via JS) */
.ha-tmpl-item.ha-tmpl-hidden {
    display: none;
}

/* ===========================
   Card
=========================== */
.ha-tmpl-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 14px;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ha-tmpl-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(9, 96, 236, 0.12);
}

/* Thumbnail */
.ha-tmpl-thumb {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 6px;
}

.ha-tmpl-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.ha-tmpl-card:hover .ha-tmpl-thumb img {
    transform: scale(1.04);
}

.ha-tmpl-no-thumb {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #c8d8ff 0%, #eef3ff 100%);
}

/* Hover Overlay */
.ha-tmpl-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s;
    border-radius: 8px;
}

.ha-tmpl-card:hover .ha-tmpl-overlay {
    opacity: 1;
}

.ha-tmpl-preview-btn {
    padding: 6px 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #fff;
    border-radius: 4px;
}

/* Card Footer */
.ha-tmpl-card-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding-top: 16px;
}

.ha-tmpl-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ha-tmpl-title {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 25px;
    color: #1078ff !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.ha-tmpl-pages {
    font-size: 13px;
    color: #9d9d9d;
    font-weight: 500;
    line-height: 12px;
}

/* Right meta group */
.ha-tmpl-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.ha-tmpl-badge {
    padding: 3px 10px;
    color: #00025c;
    border: 1px solid #0853ff;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
}

.ha-tmpl-downloads {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 400;
    color: #00025c;
    border: 1px solid #9747ff;
    border-radius: 4px;
    padding: 3px 5px;
}

.ha-tmpl-save {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e36725;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
    padding: 3px 6px;
}

/* ===========================
   Empty State
=========================== */
.ha-tmpl-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #9d9d9d;
    padding: 60px 0;
    font-size: 16px;
}

/* ===========================
   Show More Button
=========================== */
.ha-tmpl-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 120px;
}

.ha-tmpl-load-more {
    font-family: "DM Sans", sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 19px;
    padding: 14px 24px;
    background: #0960ec;
    border: none;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.25s, color 0.25s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ha-tmpl-load-more:hover {
    background: #0960ec;
    color: #fff;
}

.ha-tmpl-load-more-wrap.ha-hidden {
    display: none;
}

/* ===========================
   Responsive
=========================== */
@media (max-width: 1200px) {
    .ha-tmpl-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .ha-tmpl-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 580px) {
    .ha-tmpl-grid {
        grid-template-columns: 1fr;
    }

    .ha-tmpl-header {
        flex-direction: column;
        align-items: stretch;
    }

    .ha-tmpl-search {
        width: 100%;
    }
}
