/* ==========================================
   CSSmart - Portfolio.css
   Estilos exclusivos para a página de Portfólio
   ========================================== */

/* ==========================================
   Portfolio Page Geral
   ========================================== */
.portfolio-page {
    min-height: 100vh;
    background-color: #f5f5f5;
    padding: 60px 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.portfolio-page .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h1 {
    font-size: 2.5rem;
    color: #1e5fa8;
    margin-bottom: 10px;
    font-weight: 700;
}

.section-divider {
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #1e5fa8, #00d4ff);
    margin: 0 auto 20px;
}

.section-header p {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* ==========================================
   Filtros de Portfólio
   ========================================== */
.portfolio-filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filter-btn {
    background: white;
    border: 2px solid #e0e0e0;
    color: #666;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.filter-btn:hover,
.filter-btn.active {
    background: #1e5fa8;
    color: white;
    border-color: #1e5fa8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 95, 168, 0.3);
}

/* ==========================================
   Grid de Portfólio
   ========================================== */
.portfolio-full-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 60px;
}

.loading,
.empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-style: italic;
    font-size: 1.1rem;
}

/* ==========================================
   Item Individual de Portfólio
   ========================================== */
.portfolio-item {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.portfolio-item.hidden {
    display: none;
}

.portfolio-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.portfolio-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.portfolio-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.portfolio-item:hover .portfolio-image img {
    transform: scale(1.1);
}

.portfolio-info {
    padding: 20px;
}

.portfolio-info h3 {
    font-size: 1.2rem;
    color: #1e5fa8;
    margin-bottom: 8px;
    font-weight: 600;
}

.category {
    font-size: 0.9rem;
    color: #00d4ff;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    font-weight: 500;
}

.btn-ver {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #1e5fa8, #00d4ff);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-ver:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 95, 168, 0.4);
    color: white;
    text-decoration: none;
}

/* ==========================================
   CTA Section
   ========================================== */
.portfolio-cta-section {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-top: 40px;
}

.portfolio-cta-section h2 {
    font-size: 2rem;
    color: #1e5fa8;
    margin-bottom: 15px;
}

.portfolio-cta-section p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 30px;
}

.btn-primary {
    background: linear-gradient(135deg, #1e5fa8, #00d4ff);
    color: white;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(30, 95, 168, 0.4);
    color: white;
}

/* ==========================================
   Animações
   ========================================== */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scrollScreenshot {
    0% { transform: translateY(0); }
    45% { transform: translateY(-40%); }
    55% { transform: translateY(-40%); }
    100% { transform: translateY(0); }
}

/* ==========================================
   Responsividade
   ========================================== */
@media (max-width: 1024px) {
    .portfolio-full-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .portfolio-full-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .portfolio-filters {
        gap: 8px;
    }

    .filter-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .section-header h1 {
        font-size: 2rem;
    }

    .portfolio-cta-section {
        padding: 40px 15px;
    }
}

@media (max-width: 480px) {
    .portfolio-page {
        padding: 40px 0;
    }

    .portfolio-info {
        padding: 15px;
    }

    .portfolio-info h3 {
        font-size: 1.1rem;
    }
}

/* ==========================================
   Estados de Carregamento e Erro
   ========================================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #1e5fa8;
}

.loading::before {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid #1e5fa8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================
   EFEITO SCROLL HOVER + VOLTA AUTOMÁTICA
   Inspirado em: https://descomplicandosites.com.br/sites/
   ========================================== */

/* Container da imagem */
.portfolio-image {
    position: relative;
    width: 100%;
    height: 400px; /* Altura visível - ajuste se quiser mais/menos */
    overflow: hidden;
    border-radius: 15px 15px 0 0;
    background: #f8f9fa; /* Fundo neutro para screenshots */
    cursor: pointer; /* Indica interatividade */
    transition: box-shadow 0.3s ease;
}

/* Imagem com scroll */
.portfolio-image img {
    width: 100%;
    height: auto; /* Mantém proporção real da imagem longa */
    object-fit: contain; /* SEM DISTORÇÃO - mostra toda a altura */
    display: block;
    transition: transform 0.5s ease-out; /* Suave no hover out */
}

/* Animação principal: Scroll para baixo no hover */
.portfolio-image:hover img {
    animation: scrollHoverDown 4s ease-in-out forwards; /* 4s para scroll lento */
}

/* Volta automática ao sair do hover (reverse) */
.portfolio-image:not(:hover) img {
    animation: scrollHoverUp 2s ease-out forwards; /* Volta mais rápida */
}

/* Keyframes: Scroll para baixo (ida) */
@keyframes scrollHoverDown {
    0% {
        transform: translateY(0); /* Posição inicial */
    }
    100% {
        transform: translateY(-75%); /* Revela 75% da imagem longa - ajuste % para sua altura */
    }
}

/* Keyframes: Volta para cima (volta) */
@keyframes scrollHoverUp {
    0% {
        transform: translateY(-75%); /* Parte de onde parou */
    }
    100% {
        transform: translateY(0); /* Volta ao topo */
    }
}

/* Pausa no mobile/touch (opcional) */
@media (hover: none) {
    .portfolio-image img {
        animation: none !important;
    }
    .portfolio-image:hover img {
        transform: none; /* Sem hover em mobile */
    }
}

/* Hover no container (sombra para feedback) */
.portfolio-image:hover {
    box-shadow: 0 10px 30px rgba(30, 95, 168, 0.3); /* Sombra azul CSSmart */
}

/* Badge sobre a imagem (não interfere no scroll) */
.status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.concluido { background: #28a745; color: white; }
.status-badge.andamento { background: #ffc107; color: #212529; }

/* BADGE */
.status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.concluido { background: #28a745; color: white; }
.status-badge.andamento { background: #ffc107; color: #212529; }

/* FILTROS COM ESTADO */
.filter-btn {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: white;
    color: #666;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn.active {
    background: #1e5fa8 !important;
    color: white !important;
    border-color: #1e5fa8 !important;
    box-shadow: 0 4px 12px rgba(30,95,168,0.4);
}

/* DIVISOR */
.filter-divider {
    width: 1px;
    height: 30px;
    background: #ddd;
    margin: 0 15px;
    opacity: 0.5;
}

@keyframes scrollScreenshot {
    0% { transform: translateY(0); }
    100% { transform: translateY(calc(-100% + 280px)); }
    
}

.long-image {
    animation-duration: 6s !important; /* Mais tempo para imagens MUITO longas */
}

/* BADGE DE STATUS */
.status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 5;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.concluido {
    background: #28a745;
    color: white;
}

.status-badge.andamento {
    background: #ffc107;
    color: #212529;
}

/* DIVISOR NOS FILTROS */
.filter-divider {
    width: 1px;
    height: 30px;
    background: #ddd;
    margin: 0 10px;
    border: none;
}

/* EFEITO SCROLL HOVER + VOLTA AUTOMÁTICA */
.vertical-scroll-container {
    overflow: hidden;
    height: 400px; /* Altura visível */
}

.vertical-scroll-container img {
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: transform 0.5s ease-out; /* Suave na volta */
}

.vertical-scroll-container:hover img {
    animation: scrollDown 5s ease-in forwards; /* Ida lenta no hover */
}

.vertical-scroll-container:not(:hover) img {
    animation: scrollUp 3s ease-out forwards; /* Volta mais rápida */
}

/* Keyframes IDA (down) */
@keyframes scrollDown {
    0% { transform: translateY(0); }
    100% { transform: translateY(calc(-100% + 400px)); /* Revela tudo - ajuste altura */
    }
}

/* Keyframes VOLTA (up) */
@keyframes scrollUp {
    0% { transform: translateY(calc(-100% + 400px)); }
    100% { transform: translateY(0); }
}

/* Outros estilos (mantenha) */
.portfolio-image {
    position: relative;
    width: 100%;
    border-radius: 15px 15px 0 0;
    background: #f8f9fa;
    cursor: pointer;
}

.portfolio-image:hover {
    box-shadow: 0 10px 30px rgba(30, 95, 168, 0.3);
}

/* ==========================================
   EFEITO SCROLL HOVER + VOLTA - CORRIGIDO
   ========================================== */

/* REMOVA estas declarações problemáticas: */
.portfolio-image {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 15px 15px 0 0;
    background: #f8f9fa;
    /* REMOVA: height, min-height, object-fit daqui */
}

/* CONTAINER DA IMAGEM - CORRIGIDO */
.portfolio-image {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 15px 15px 0 0;
    background: #f8f9fa;
    aspect-ratio: 16/9; /* Proporção inicial */
    height: auto; /* Altura livre */
}

/* IMAGEM LONGA - CORRIGIDO */
.portfolio-screenshot {
    width: 100%;
    height: auto; /* Altura automática baseada na proporção real */
    display: block;
    transition: transform 8s ease-in-out; /* Mais suave e lento */
}

/* CONTAINER PARA IMAGENS VERTICAIS LONGA */
.portfolio-image.vertical-long {
    aspect-ratio: unset; /* Remove proporção fixa */
    height: 400px; /* Altura visível fixa */
    overflow: hidden; /* Esconde o excesso */
}

.portfolio-image.vertical-long .portfolio-screenshot {
    width: 100%;
    height: auto; /* Mantém altura real da imagem */
    min-height: 400px; /* Mínimo igual ao container */
}

/* SCROLL VERTICAL NO HOVER - TÉCNICA DO SITE REFERÊNCIA */
.portfolio-image.vertical-long:hover .portfolio-screenshot {
    transform: translateY(calc(-100% + 400px)); /* Revela parte inferior */
    transition: transform 15s ease-in-out; /* Muito lento e suave */
}

/* VOLTA AO TOPO AO SAIR */
.portfolio-image.vertical-long:not(:hover) .portfolio-screenshot {
    transform: translateY(0);
    transition: transform 8s ease-in-out; /* Volta mais rápida */
}

/* ==========================================
   DETECÇÃO AUTOMÁTICA DE IMAGENS LONGA
   ========================================== */
.portfolio-image.auto-scroll {
    height: 400px; /* Altura fixa do viewport */
    overflow: hidden;
}

.portfolio-image.auto-scroll .portfolio-screenshot {
    width: 100%;
    height: auto;
}

/* Se imagem for mais alta que o container, aplica scroll */
.portfolio-image.auto-scroll:has(.portfolio-screenshot[height="5000"]),
.portfolio-image.auto-scroll:has(.portfolio-screenshot[height="8000"]) {
    height: 400px;
    overflow: hidden;
}

.portfolio-image.auto-scroll:has(.portfolio-screenshot[height="5000"]) .portfolio-screenshot,
.portfolio-image.auto-scroll:has(.portfolio-screenshot[height="8000"]) .portfolio-screenshot {
    height: auto;
    min-height: 400px;
}

/* DEBUG - Mostra informações das imagens */
.portfolio-image.loaded::after {
    content: attr(data-dimensions);
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    z-index: 10;
}

/* Remove transições durante debug */
.debug * {
    transition: none !important;
    animation: none !important;
}

/* ==========================================
   EFEITO SCROLL HOVER + VOLTA - CORRIGIDO PARA MOBILE
   ========================================== */

/* CONTAINER DA IMAGEM - CORRIGIDO */
.portfolio-image {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 15px 15px 0 0;
    background: #f8f9fa;
    height: 400px; /* Altura padrão para desktop */
}

/* IMAGEM LONGA - CORRIGIDO */
.portfolio-screenshot {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 8s ease-in-out;
}

/* CONTAINER PARA IMAGENS VERTICAIS LONGA - APENAS DESKTOP */
.portfolio-image.vertical-long {
    height: 400px;
    overflow: hidden;
}

.portfolio-image.vertical-long .portfolio-screenshot {
    width: 100%;
    height: auto;
    min-height: 400px;
}

/* SCROLL VERTICAL NO HOVER - APENAS DESKTOP */
@media (hover: hover) and (pointer: fine) {
    .portfolio-image.vertical-long:hover .portfolio-screenshot {
        transform: translateY(calc(-100% + 400px));
        transition: transform 12s ease-in-out;
    }
    
    .portfolio-image.vertical-long:not(:hover) .portfolio-screenshot {
        transform: translateY(0);
        transition: transform 6s ease-in-out;
    }
}

/* ==========================================
   MOBILE: DESATIVAR EFEITO SCROLL E AJUSTAR ALTURAS
   ========================================== */
@media (max-width: 768px) {
    .portfolio-image {
        height: 300px !important; /* Altura reduzida para mobile */
        overflow: hidden; /* Mantém o corte, mas sem scroll */
    }
    
    .portfolio-image.vertical-long {
        height: 300px !important;
    }
    
    .portfolio-image.vertical-long .portfolio-screenshot {
        height: 100%; /* Preenche o container sem scroll */
        object-fit: cover; /* Corta a imagem adequadamente */
        min-height: auto;
        transform: none !important; /* Remove transformações */
        transition: none !important; /* Remove transições */
    }
    
    /* Desativa completamente o efeito hover no mobile */
    .portfolio-image.vertical-long:hover .portfolio-screenshot {
        transform: none !important;
    }
}

/* Para dispositivos com touch (mobile/tablet) */
@media (hover: none) and (pointer: coarse) {
    .portfolio-image.vertical-long .portfolio-screenshot {
        transform: none !important;
        transition: none !important;
    }
    
    .portfolio-image {
        overflow: hidden; /* Apenas corta, não permite scroll */
    }
}

/* ==========================================
   OTIMIZAÇÃO MOBILE AVANÇADA
   ========================================== */
@media (max-width: 480px) {
    .portfolio-image {
        height: 250px !important; /* Altura ainda menor para mobile pequeno */
    }
    
    .portfolio-image.vertical-long {
        height: 250px !important;
    }
    
    /* Garante que imagens longas sejam cortadas adequadamente */
    .portfolio-image .portfolio-screenshot {
        object-fit: cover;
        width: 100%;
        height: 100%;
    }
}

/* Detecção de capacidades do dispositivo */
@media (hover: none) {
    .portfolio-image {
        cursor: default; /* Remove cursor pointer em touch devices */
    }
    
    .portfolio-image:hover {
        transform: none; /* Remove transformações hover */
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); /* Sombra padrão */
    }
}

