/* TEMPLATE FILTER + CARDS */

.seg {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.tplCard {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(32, 32, 32, 0.08);
    border-radius: 20px;
    padding: 12px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition:
        transform .2s ease,
        box-shadow .2s ease,
        border-color .2s ease,
        background .2s ease;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.tplPreviewBtn {
    all: unset;
    display: block;
    width: 100%;
    cursor: pointer;
}

.tplPreview {
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(32, 32, 32, 0.06);
    background: linear-gradient(180deg, #fcfcfc 0%, #f4f4f4 100%);
    display: block;
}

.tplCanvas {
    width: 100%;
}

.tplFrame {
    display: block;
    width: 100%;
    overflow: hidden;
    background: #f3f3f3;
    padding: 10px;
}

.tplFrame img {
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: contain;
    object-position: top center;
    display: block;
    margin: 0 auto;
    transition: transform .35s ease;
}

.tplBottom {
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 10px;
}

.tplInfo {
    display: grid;
    gap: 8px;
}

.tplTitleRow {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 2px;
}

.tplTitle {
    color: var(--ink);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
}

.tplMetaRow {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 2px;
}

.tplCard .badge,
.tplCard .chip {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid rgba(32, 32, 32, 0.08);
    background: rgba(255, 255, 255, 0.76);
    color: var(--ink2, #555);
    line-height: 1;
}

.tplCard .badge {
    color: var(--rose, #c27a8b);
    border-color: rgba(194, 122, 139, 0.22);
    background: rgba(194, 122, 139, 0.08);
}

.tplVariants {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(32, 32, 32, 0.06);
}

.tplVariantsLabel {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink3, #777);
    white-space: nowrap;
}

.tplThemeDots {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.tplThemeDot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(32, 32, 32, 0.10);
    background: var(--c1, #eaeaea);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.tplThemeMore {
    height: 18px;
    min-width: 22px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    border: 1px solid rgba(32, 32, 32, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink2, #555);
    background: rgba(255, 255, 255, 0.72);
}

.tplPaletteBar {
    width: 92px;
    height: 16px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(32, 32, 32, 0.08);
    background: rgba(255, 255, 255, 0.72);
    flex: 0 0 auto;
}

.tplPaletteBar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tplNote {
    margin-top: 8px;
    font-size: 12px;
    color: var(--ink2, #555);
    line-height: 1.4;
    opacity: .9;
}

/* HOVERS */
@media (hover:hover) {
    .tplCard:hover {
        transform: translateY(-3px);
        box-shadow: 0 16px 34px rgba(0, 0, 0, 0.08);
        border-color: rgba(255, 77, 77, 0.16);
        background: rgba(255, 255, 255, 0.84);
    }

    .tplCard:hover .tplFrame img {
        transform: scale(1.01);
    }

    .tplCard:hover .tplPreview {
        border-color: rgba(255, 77, 77, 0.18);
        box-shadow: 0 10px 26px rgba(255, 77, 77, 0.08);
    }
}

/* RESPONSIVE */
@media (max-width: 760px) {
    .tplVariants {
        flex-direction: column;
        align-items: flex-start;
    }

    .tplThemeDots {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .tplCard {
        padding: 10px;
        border-radius: 18px;
    }

    .tplPreview {
        border-radius: 12px;
    }

    .tplFrame {
        padding: 8px;
    }

    .tplFrame img {
        max-height: 320px;
    }

    .tplTitle {
        font-size: 15px;
    }

    .tplCard .badge,
    .tplCard .chip {
        font-size: 10px;
        padding: 5px 9px;
    }
}

/* TEMPLATE CARD ACTIONS */

.tplActions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}

.tplActionBtn {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    flex: 1 1 0;
    min-height: 42px;
    padding: 11px 14px;
    border-radius: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    transition:
        transform .22s cubic-bezier(.2, .8, .2, 1),
        box-shadow .22s cubic-bezier(.2, .8, .2, 1),
        border-color .22s cubic-bezier(.2, .8, .2, 1),
        background .22s cubic-bezier(.2, .8, .2, 1),
        color .22s cubic-bezier(.2, .8, .2, 1);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.tplActionBtn::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity .26s cubic-bezier(.2, .8, .2, 1),
        transform .26s cubic-bezier(.2, .8, .2, 1);
}

.tplActionBtn--ghost {
    color: var(--ink, #202020);
    background: rgba(255, 255, 255, .72);
    border: 1px solid rgba(32, 32, 32, .08);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.tplActionBtn--ghost::before {
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 77, 77, .16), transparent 56%),
        linear-gradient(180deg, rgba(255, 255, 255, .86), rgba(255, 77, 77, .08));
    transform: translateY(6px);
}

.tplActionBtn--primary {
    color: #fff !important;
    background:
        linear-gradient(135deg, #ff4d4d 0%, #ff4d4d 48%, #f90202 100%);
    border: 1px solid rgba(255, 77, 77, .28);
    box-shadow:
        0 10px 22px rgba(255, 77, 77, .18),
        inset 0 1px 0 rgba(255, 255, 255, .16);
}

.tplActionBtn--primary::before {
    background:
        linear-gradient(
            110deg,
            transparent 0%,
            transparent 28%,
            rgba(255, 255, 255, .28) 45%,
            rgba(255, 255, 255, .12) 55%,
            transparent 72%,
            transparent 100%
        );
    transform: translateX(-70%);
}

.tplActionBtn--ghost:visited {
    color: var(--ink, #202020);
}

.tplActionBtn--primary:visited {
    color: #fff !important;
}

@media (hover:hover) {
    .tplActionBtn:hover {
        transform: translateY(-2px);
    }

    .tplActionBtn:hover::before {
        opacity: 1;
        transform: translate(0, 0);
    }

    .tplActionBtn--ghost:hover {
        color: #ff4d4d;
        background: rgba(255, 255, 255, .88);
        border-color: rgba(255, 77, 77, .26);
        box-shadow:
            0 12px 24px rgba(0, 0, 0, .06),
            0 8px 22px rgba(255, 77, 77, .08);
    }

    .tplActionBtn--primary:hover {
        color: #fff !important;
        background:
            linear-gradient(135deg, #ff6666 0%, #ff4d4d 42%, #f90202 100%);
        border-color: rgba(255, 77, 77, .36);
        box-shadow:
            0 16px 30px rgba(255, 77, 77, .28),
            0 0 0 6px rgba(255, 77, 77, .07),
            inset 0 1px 0 rgba(255, 255, 255, .2);
    }

    .tplActionBtn--primary:hover::before {
        opacity: 1;
        transform: translateX(70%);
        transition:
            opacity .26s cubic-bezier(.2, .8, .2, 1),
            transform .72s cubic-bezier(.2, .8, .2, 1);
    }
}

.tplActionBtn--primary:active {
    color: #fff !important;
    background:
        linear-gradient(135deg, #ff4d4d 0%, #f90202 100%);
}

.tplActionBtn:active {
    transform: translateY(0) scale(.99);
}

.tplActionBtn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(255, 255, 255, .92),
        0 0 0 6px rgba(255, 77, 77, .16),
        0 10px 22px rgba(255, 77, 77, .14);
}

.tplActionBtn[disabled],
.tplActionBtn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: .62;
    transform: none !important;
    box-shadow: none;
}

@media (max-width: 480px) {
    .tplActions {
        gap: 8px;
    }

    .tplActionBtn {
        min-height: 40px;
        padding: 10px 12px;
        border-radius: 12px;
        font-size: 12px;
    }
}