/*

Theme Name: showpets-template
Text Domain: Showpets Template
Version: 1.0
Author: Show Pets

*/

:root {
    --primary-color: #fff176;
    --secondary-color: #963bae;
    --terciary-color: #cb6be6;
    --background-color: #eee;
    --text-color: #000;
    --text-muted: #ccc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Gabarito', sans-serif;
}

html {
    min-height: 100dvh;
    /* Ajuste de clamp mais suave para evitar que fontes fiquem gigantes em monitores Widescreen */
    font-size: clamp(14px, 1vw + 0.5rem, 20px);
    max-width: 100dvw;
    overflow-x: hidden;
}

body {
    min-height: 100dvh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    background-color: var(--background-color);
    background-image: url('./assets/images/bg-pattern.svg');
}

a {
    text-decoration: none;
    color: var(--text-color);
}

ul {
    list-style: none;
}

footer {
	justify-self: end;
	margin-bottom: 0;
}

/* ================= HEADER ELEMENTS ================= */

.header-nav {
    background-color: var(--primary-color);
    height: 9dvh;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 1rem clamp(1rem, 10vw, 10rem);
    overflow: hidden;
}

.header-logo {
    font-family: 'Jua', sans-serif;
    font-weight: 400;
    height: 120px;
    width: auto;
}

.header-logo:hover {
    transform: scale(1.05) rotate(-10deg);
}

.nav-menu {
    display: flex;
    flex-direction: row;
    gap: 2rem;
}

.nav-menu>ul {
	display: flex;
	flex-direction: row;
}

.nav-menu>li>a {
    padding: 1rem 0;
    display: inline-block;
}

.nav-menu>li>a:hover,
.header-logo:hover {
    text-decoration: underline;
    text-underline-offset: .3rem;
}

.header-button {
    display: none;
    background-color: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
}

/* SEARCH BAR */
.search-form {
    padding: 1rem;
    display: flex;
    gap: 1rem;
    padding-bottom: 0;
    width: 75%;
    max-width: 1440px;
    align-self: center;
}

.search-input {
    width: 100%;
    padding: 0.4rem 0.8rem;
    outline: none;
    border: 1px solid var(--text-color);
    border-radius: 8px;
    transition: border 0.15s ease-in-out, box-shadow 0.15s;
    font-size: 1rem;
}

.search-input:hover {
    border: 1px solid var(--secondary-color);
}

.search-input:focus {
    border: 1px solid var(--secondary-color);
    box-shadow: 0 0 10px var(--terciary-color);
}

.search-button {
    cursor: pointer;
    background-color: transparent;
    border: none;
    font-size: 1.2rem;
    transition: color 0.15s ease-in-out;
}

.search-button:hover {
    color: var(--secondary-color);
}

/* SEARCH PAGE */

.search-results-custom {
    display: flex;
    flex-direction: column;
    width: 90%;
    gap: 1.5rem;
    /* Aumentado um pouco o espaço entre os cards */
    align-self: center;
}

.search-card {
    background-color: var(--terciary-color);
    border-radius: 8px;
    padding: 1rem;
    transition: transform .3s ease-in-out, box-shadow .3s;
    display: flex;
    flex-direction: row;
    /* Alinhamento lado a lado no desktop */
    gap: 1.2rem;
    align-items: center;
    /* Centraliza a imagem e o texto verticalmente */
    width: 100%;
}

.search-card:hover {
    transform: scale(1.01);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 1. Correção do tamanho da imagem no Desktop */
.search-card-image {
    width: 220px;
    /* Define uma largura padrão fixa para a imagem no desktop */
    aspect-ratio: 16 / 9;
    /* Mantém a proporção */
    flex-shrink: 0;
    /* Impede que o texto empurre e esmague a imagem */
    overflow: hidden;
    border-radius: 6px;
}

/* Garante que a tag <img> gerada pelo WordPress se adapte ao contêiner */
.search-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Preenche o espaço 16:9 sem distorcer a foto */
    display: block;
}

.search-card-text {
    flex: 1;
    /* Faz o texto ocupar todo o restante do espaço do card */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.search-card-text h2 {
    margin: 0;
}

/* 2. Solução para textos com tamanhos variados (Line Clamp) */
.search-card-text p {
    opacity: 0.9;
    margin: 0;

    /* Esta combinação faz o texto cortar em exatamente X linhas e colocar "..." */
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* CATEGORIES PAGE */

.category-results-custom {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 90%;
    align-self: center;
}

.category-card {
    background-color: var(--terciary-color);
    border-radius: 8px;
    padding: 1rem;
    height: fit-content;
    transition: transform .3s ease-in-out;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    text-align: center;
}

.category-card:hover {
    transform: scale(1.02);
}

/* ================= MAIN ELEMENTS ================= */

main {
    width: 100%;
    max-width: 1320px;
    /* Limite máximo para Widescreen */
    margin: 0 auto;
    /* Centraliza em telas muito grandes */
    padding: 1rem clamp(1rem, 5vw, 5rem);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ================= CAROUSEL ================= */

.sp-carousel-area {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 90%;
    align-self: center;
}

.sp-carousel-nav {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 0.5rem;
}

.sp-carousel-container {
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    position: relative;
    border-radius: 12px;
    align-self: center;
}

.sp-carousel-button {
    background-color: transparent;
    color: var(--background-color);
    border: none;
    padding: 1rem;
    font-size: 2rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    position: absolute;
    z-index: 10;
    border-radius: 8px;
}

.sp-carousel-button.prev {
    left: 1rem;
}

.sp-carousel-button.next {
    right: 1rem;
}

.sp-carousel-button:hover {
    transform: scale(1.15);
}

.sp-carousel-container > ul {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* =======================================
   MÁGICA DA FLUIDEZ AQUI
======================================= */
.sp-slide {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    pointer-events: none;
    
    opacity: 0;
    /* Transição suave do transform e opacity */
    transition: opacity 0.5s ease-out, transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Quando vamos para a FRENTE (next): 
   O slide que vai entrar espera na DIREITA (100%) */
.sp-carousel-container[data-direction="next"] .sp-slide:not([data-active]):not([data-exiting]) {
    transform: translateX(100%);
}

/* Quando vamos para TRÁS (prev): 
   O slide que vai entrar espera na ESQUERDA (-100%) */
.sp-carousel-container[data-direction="prev"] .sp-slide:not([data-active]):not([data-exiting]) {
    transform: translateX(-100%);
}

/* SLIDE ATIVO (O que está na tela) */
.sp-slide[data-active] {
    opacity: 1;
    transform: translateX(0) !important;
    pointer-events: auto;
    z-index: 2;
}

/* SLIDE SAINDO PARA A ESQUERDA (indo para next) */
.sp-slide[data-exiting="left"] {
    transform: translateX(-100%);
    opacity: 0;
    z-index: 1;
}

/* SLIDE SAINDO PARA A DIREITA (indo para prev) */
.sp-slide[data-exiting="right"] {
    transform: translateX(100%);
    opacity: 0;
    z-index: 1;
}

/* ======================================= */

.sp-slide-content {
    position: relative;
    display: inline-block;
    width: 100%;
    height: 100%;
}

.sp-slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    z-index: -1;
}

.sp-slide-text {
    position: absolute;
    z-index: 2;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1rem 3rem 1.2rem;
    background: var(--terciary-color);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.sp-carousel-ball {
    background-color: var(--text-muted);
    height: 0.6rem;
    width: 0.6rem;
    border-radius: 50%;
    cursor: pointer;
    /* Animação elástica na bolinha */
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s ease;
}

.sp-carousel-ball[data-active-ball] {
    background-color: var(--secondary-color);
    transform: scale(1.4);
}

/* ================= MOST SEARCHED ================= */

.sp-most-searched {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    align-self: center;
}

.sp-most-searched-grid {
    display: grid;
    grid-template-columns: auto auto;
    gap: 1.5rem;
    justify-content: center;
}

.sp-most-searched-card {
    background-color: var(--terciary-color);
    max-height: 30dvh;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s;
}

.sp-most-searched-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.sp-most-searched-more {
    background-color: var(--terciary-color);
    color: var(--background-color);
    border-radius: 24px;
    padding: 0.6rem 1.2rem;
    transition: transform 0.3s ease-in-out, background-color 0.2s ease-in-out;
    cursor: pointer;
}

.sp-most-searched-more:hover {
    transform: scale(1.05);
    background-color: var(--secondary-color);
}

/* PAGINATION */

.sp-pagination {
    display: flex;
    flex-direction: row;
    width: 70%;
    justify-content: space-between;
    margin-bottom: 1rem;
    align-self: center;
}

.sp-pagination-btn:hover {
    text-decoration: underline;
    text-underline-offset: .3rem;
}

.sp-pagination-btn.disabled {
    text-decoration: none;
    color: var(--text-muted);
    pointer-events: none;
}

.page-numbers {

    border: 1px solid var(--text-color);
    padding: .5rem .8rem;
    border-radius: 8px;
    text-align: center;

}

.page-numbers:not(.current):hover {
    background-color: var(--terciary-color);
}

.page-numbers.current {
    color: var(--text-muted);
    background-color: var(--background-color);
    pointer-events: none;
}

/* ================= FOOTER ELEMENTS ================= */

footer {
    flex-shrink: 0;
    padding: 2rem clamp(1rem, 5vw, 5rem);
    background-color: var(--primary-color);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.footer-info {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    /* Permite que os itens desçam em telas menores */
    gap: 2rem;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

.footer-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 200px;
    align-items: center;
}

.footer-center {
    text-align: center;
    align-items: center;
}

.footer-right {
    text-align: end;
}

.nav-menu-footer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-menu-socials {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    justify-content: center;
}

.nav-menu-socials>li>a>i {
    color: var(--text-color);
    font-size: 1.5rem;
}

.nav-menu-footer>li:hover {
    text-decoration: underline;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.footer-copyright {
    text-align: center;
    opacity: 0.8;
}

/* ================= GERAIS ================= */

article {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
}

img {
    max-width: 100%;
    /* max-width é mais seguro que width: 100% para não distorcer ícones */
    height: auto;
}

/* ARTICLES */

.sp-custom-article {

    display: flex;
    flex-direction: column;
    width: 90%;
    gap: 1.5rem;
    align-self: center;

}

.sp-custom-tags {

    align-self: end;

}

.sp-article-tag:hover {
    text-decoration: underline;
    color: var(--secondary-color);
}

/* MISC */

.sp-page-header {
    text-align: center;
    padding: 1rem 0;
    border-bottom: .3rem solid var(--terciary-color);
    border-top: .3rem solid var(--terciary-color);
    text-wrap: balance;
    background-color: rgb(from var(--terciary-color) r g b / .2);
}

/* ================= MEDIA QUERIES (MOBILE) ================= */

@media (max-width: 768px) {

    .header-nav {
        padding: 1rem;
    }

    .header-menu {
        z-index: 900;
        position: fixed;
        background-color: var(--primary-color);
        flex-direction: column;
        height: 100dvh;
        width: 18rem;
        top: 0;
        right: 0;
        padding: 2rem 1rem;
        transform: translateX(100%);
        transition: transform 0.18s ease-in-out;
        justify-content: center;
    }

    .header-button {
        display: block;
        z-index: 999;
    }

    .show-menu {
        transform: translateX(0);
    }

    .footer-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-right,
    .newsletter-form {
        text-align: center;
    }

    .sp-carousel-button {
        padding: 0.5rem;
        font-size: 1.5rem;
    }

    .sp-slide-text {
        padding: 0.5rem 1rem;
    }

    .sp-slide-text p {
        display: none;
        /* Esconde o resumo em telas muito pequenas para não sobrecarregar */
    }

    .search-form {
        width: 100%;
    }

    .search-card {
        flex-direction: column;
        /* No mobile, imagem fica em cima e texto embaixo */
        align-items: stretch;
        /* Faz o conteúdo esticar por toda a largura do card */
        gap: 1rem;
    }

    .search-card-image {
        width: 100%;
        /* A imagem passa a ocupar 100% da largura disponível */
        /* O aspect-ratio: 16/9 definido lá em cima fará a altura se ajustar proporcionalmente! */
    }

    .search-card-text p {
        line-clamp: 3;
        -webkit-line-clamp: 3;
        /* No mobile você pode dar margem para até 3 linhas se quiser */
    }

}