/* ================================
   Variaveis e Reset Basico
================================= */
:root {
    --spacing: 8px;
    --primary-color: #ff6b35;
    --primary-gradient: linear-gradient(135deg, #ff9a56 0%, #ff6b35 100%);
    --secondary-color: #f88d2a;
    --text-color: #333;
    --text-muted: #666;
    --background: #f8f9fa;
    --white: #ffffff;
    --border-radius: 12px;
    --border-radius-small: 8px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--background);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    justify-content: flex-start;
    line-height: 1.6;
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 640px;
    box-sizing: border-box;
    margin: 0 auto;
    flex-grow: 1;
}

/* ================================
   Header e Busca
================================= */
header {
    display: flex;
    align-items: center;
    background: var(--primary-gradient);
    height: 70px;
    justify-content: space-between;
    padding: 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 640px;
    margin: 0 auto;
    padding: 12px 16px;
    box-sizing: border-box;
    gap: 16px;
    justify-content: center;
}

header .left {
    display: flex;
    align-items: center;
    gap: 8px;
}

header img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    margin-left: 6px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

header img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

header a {
    font-size: 20px;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    transition: var(--transition);
}

header a:hover {
    opacity: 0.9;
}

/* Formulario de busca no header */
header .search-form {
    flex: 1 1 auto;
    max-width: 380px;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
    border: 2px solid transparent;
    padding: 6px 16px;
    position: relative;
    gap: 8px;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

header .search-form:focus-within {
    background: var(--white);
    box-shadow: 0 8px 40px rgba(255, 107, 53, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

header .search-form input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    font-weight: 400;
    font-family: 'Rubik', sans-serif;
    color: var(--text-color);
    background: transparent;
    padding: 10px 35px 10px 0;
}

header .search-form input::placeholder {
    color: #999;
    font-weight: 400;
}

header .search-form button[type="submit"] {
    background: var(--primary-gradient);
    border: none;
    color: var(--white);
    font-size: 18px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

header .search-form button[type="submit"]:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

header .search-form button[type="submit"]:active {
    transform: scale(0.95);
}

#clear-btn {
    display: none;
    position: absolute;
    right: 65px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    user-select: none;
    transition: var(--transition);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
}

#clear-btn:hover {
    color: var(--primary-color);
    background: rgba(255, 107, 53, 0.1);
}

/* ================================
   Produtos (Lista e Cartoes)
================================= */
.produtos {
    display: flex;
    flex-wrap: wrap;
    margin: 20px 0;
    gap: 12px;
    justify-content: space-between;
}

.card {
    background: var(--white);
    color: var(--text-color);
    width: calc(50% - 6px);
    border-radius: var(--border-radius);
    text-align: center;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-bottom: var(--spacing);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card img {
    width: 100%;
    display: block;
    height: 180px;
    object-fit: cover;
    transition: var(--transition);
}

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

.card .info {
    padding: 12px;
    flex-grow: 1;
}

.card .info h3 {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-color);
    text-align: center;
    margin: 0;
    min-height: 3em;
    line-height: 1.4em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.botao {
    display: block;
    background: var(--primary-gradient);
    color: var(--white);
    padding: 12px 0;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
    margin-top: auto;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.botao:hover {
    background: linear-gradient(135deg, #ff8c43 0%, #e55a2b 100%);
    transform: translateY(-1px);
}

.lazy-img {
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.lazy-img.loaded {
    opacity: 1;
}

.lazy-img,
.lazy-relacionado {
    opacity: 0;
    transform: scale(1.02);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.lazy-img.loaded,
.lazy-relacionado.loaded {
    opacity: 1;
    transform: scale(1);
}

/* ================================
   Produto Detalhe
================================= */
.produto-detalhe {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 24px 0;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.produto-detalhe:hover {
    box-shadow: var(--shadow-md);
}

.produto-detalhe img {
    max-width: 320px;
    width: 100%;
    height: auto;
    border-radius: var(--border-radius-small);
}

.produto-detalhe h1 {
    font-size: 22px;
    margin: 20px 0 24px;
    color: var(--text-color);
    font-weight: 600;
    line-height: 1.3;
}

@media (max-width: 767px) {
    .produto-detalhe h1 {
        margin: 12px 0 16px;
        font-size: 20px;
    }
}

.descricao-titulo h2 {
    font-size: 20px;
    margin: 24px 0 32px;
    color: var(--text-color);
    font-weight: 600;
}

.descricao-texto p {
    color: var(--text-muted);
    font-size: 15px;
    margin: 12px 0 16px;
    line-height: 1.6;
}

.descricao-texto h2,
.descricao-texto h3 {
    font-size: 19px;
    margin: -16px 0 8px;
    color: var(--text-color);
    font-weight: 600;
}

.descricao h2 {
    margin-bottom: 32px;
}

.produto-detalhe p {
    color: var(--text-muted);
    font-size: 15px;
    margin: -1px 0 10px;;
    line-height: 1.7;
}

.produto-detalhe ul {
    margin-bottom: -8px;
    margin-top: -20px;
    font-size: 15px;
    text-align: left;
}

.produto-detalhe ul li {
   /* margin-bottom: 10px;  */
    color: var(--text-muted);
}

/* ================================
   Carousel Geral (ex: produto.php)
================================= */
.carousel img {
    display: none;
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius-small);
}

.carousel img.active {
    display: block;
}

.carousel button.prev,
.carousel button.next {
    background: rgba(255, 107, 53, 0.9);
    border: none;
    font-size: 28px;
    cursor: pointer;
    position: relative;
    top: -160px;
    color: var(--white);
    user-select: none;
    margin: 0 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.carousel button.prev:hover,
.carousel button.next:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.botao-comprar:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 50px rgba(255, 107, 53, 0.5);
    animation-duration: 1s;
}
/* ================================
   Busca (Overlay e Itens)
================================= */
.busca-item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-color);
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: var(--transition);
    border-radius: var(--border-radius-small);
    margin-bottom: 4px;
}

.busca-item img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: var(--border-radius-small);
    box-shadow: var(--shadow-sm);
}

.busca-item:hover {
    background: var(--primary-gradient);
    color: var(--white);
    transform: translateX(4px);
}

#busca-overlay {
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    background: var(--white);
}

/* ================================
   Produtos Relacionados (Carousel)
================================= */
.produtos-relacionados {
    margin-bottom: 32px;
    background: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.produtos-relacionados h2 {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
    color: var(--text-color);
}

.carousel-relacionados {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    scroll-behavior: smooth;
    padding: 12px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.carousel-relacionados::-webkit-scrollbar {
    display: none;
}

.card-produto {
    flex: 0 0 calc(50% - 8px);
    box-sizing: border-box;
    scroll-snap-align: center;
    border: 1px solid #f0f0f0;
    border-radius: var(--border-radius);
    text-align: center;
    padding: 16px;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.card-produto:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.card-produto > a:not(:has(img)) {
    background: var(--primary-gradient);
    color: var(--white);
    font-size: 14px;
    font-weight: 600;
    padding: 10px;
    border-radius: var(--border-radius-small);
    text-decoration: none;
    display: inline-block;
    transition: var(--transition);
}

.card-produto > a:not(:has(img)):hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.card-produto img {
    max-width: 100%;
    object-fit: contain;
    border-radius: var(--border-radius-small);
    margin-bottom: 12px;
    transition: var(--transition);
}

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

.card-produto div {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.card-produto .botao-saiba-mais {
    background: var(--primary-gradient);
    color: var(--white);
    padding: 10px;
    border-radius: var(--border-radius-small);
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
    font-size: 13px;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-produto .botao-saiba-mais:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.seta-relacionado {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 107, 53, 0.9);
    color: var(--white);
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.seta-relacionado:hover {
    background: var(--primary-color);
    transform: translateY(-50%) scale(1.05);
}

.seta-esq {
    left: 12px;
}

.seta-dir {
    right: 12px;
}

/* ================================
   Compartilhar
================================= */
.compartilhar a {
    margin: 0 8px;
    color: var(--text-muted);
    font-size: 22px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: var(--transition);
    padding: 8px;
    border-radius: 50%;
}

.compartilhar a:hover {
    color: var(--primary-color);
    background: rgba(255, 107, 53, 0.1);
    transform: translateY(-2px);
}

/* Responsividade para compartilhamento */
@media (max-width: 480px) {
    .compartilhar a {
        margin: 0 4px;
        font-size: 20px;
        padding: 6px;
    }
}

/* ================================
   Footer
================================= */
html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: var(--white);
    text-align: center;
    padding: 24px 0;
    width: 100%;
    z-index: 10;
    font-family: 'Rubik', sans-serif;
    margin-top: auto;
}

footer nav ul {
    list-style: none;
    padding: 0;
    margin: 0 auto 20px auto;
    max-width: 100%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 24px;
    font-size: 15px;
    box-sizing: border-box;
}

footer nav ul li a {
    color: var(--white);
    text-decoration: none;
    transition: var(--transition);
    padding: 8px 12px;
    border-radius: var(--border-radius-small);
    font-weight: 500;
}

footer nav ul li a:hover,
footer nav ul li a:focus {
    color: var(--primary-color);
    background: rgba(255, 107, 53, 0.1);
    transform: translateY(-1px);
}

footer .social-icons a {
    color: var(--white);
    margin: 0 12px;
    font-size: 24px;
    padding: 12px;
    text-decoration: none;
    transition: var(--transition);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

footer .social-icons a:hover,
footer .social-icons a:focus {
    color: var(--primary-color);
    background: rgba(255, 107, 53, 0.1);
    transform: translateY(-2px) scale(1.05);
}

footer p {
    font-size: 16px;
    margin: 0 0 12px;
    opacity: 0.9;
    font-weight: 400;
}

/* ================================
   Responsividade
================================= */
@media (max-width: 640px) {
    header {
        height: 70px;
    }

    header .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 12px;
        width: 100%;
        box-sizing: border-box;
    }

    header .search-form {
        flex: 1;
        display: flex;
        gap: 6px;
        margin-left: 12px;
        margin-right: 60px;
        max-width: 100%;
        box-sizing: border-box;
    }

    header .search-form input[type="text"] {
        flex: 1;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
        font-size: 15px;
        padding: 8px 30px 8px 0;
    }

    header .search-form button {
        flex-shrink: 0;
        max-width: 80px;
        width: auto;
    }

    .container {
        padding: 0 8px;
    }

    .produtos {
        gap: 10px;
        margin: 16px 0;
    }

    .card, .card-produto {
        width: calc(50% - 5px);
    }

    .card img {
        height: 160px;
    }

    .produto-detalhe {
        padding: 16px;
        margin: 16px 0;
    }

    .produtos-relacionados {
        padding: 16px;
        margin-bottom: 24px;
    }
}

/* ================================
   Animacoes e Micro-interacoes
================================= */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }

/* Scroll suave para toda a pagina */
html {
    scroll-behavior: smooth;
}

/* Melhor focus para acessibilidade */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Estados de carregamento */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}