/**
 * Estilos del Portfolio Frontend
 *
 * @package Ovisoft_Portfolio
 */

/* ==========================================================================
   Variables CSS (se sobrescriben dinámicamente desde PHP)
   ========================================================================== */

:root {
    --ovisoft-filter-bg: #f0f0f0;
    --ovisoft-filter-text: #333333;
    --ovisoft-filter-active-bg: #2271b1;
    --ovisoft-filter-active-text: #ffffff;
    --ovisoft-grid-gap: 25px;
    --ovisoft-border-radius: 8px;
    --ovisoft-transition: all 0.3s ease;
}

/* ==========================================================================
   Contenedor principal del portfolio
   ========================================================================== */

.ovisoft-portfolio-wrapper {
    width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   Filtros AJAX
   ========================================================================== */

.ovisoft-portfolio-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.ovisoft-filter-button {
    background: var(--ovisoft-filter-bg);
    color: var(--ovisoft-filter-text);
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: var(--ovisoft-transition);
    border-radius: 4px;
    font-family: inherit;
    text-transform: capitalize;
}

.ovisoft-filter-button:hover {
    opacity: 0.8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.ovisoft-filter-button.active {
    background: var(--ovisoft-filter-active-bg);
    color: var(--ovisoft-filter-active-text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ovisoft-filter-button:focus {
    outline: 2px solid var(--ovisoft-filter-active-bg);
    outline-offset: 2px;
}

/* ==========================================================================
   Grid de proyectos
   ========================================================================== */

.ovisoft-portfolio-grid {
    display: grid;
    gap: var(--ovisoft-grid-gap);
    width: 100%;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.ovisoft-portfolio-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Columnas responsive - Se sobrescriben dinámicamente */
.ovisoft-portfolio-grid {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1024px) {
    .ovisoft-portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .ovisoft-portfolio-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

/* ==========================================================================
   Tarjeta de proyecto
   ========================================================================== */

.ovisoft-portfolio-item {
    position: relative;
    background: #fff;
    border-radius: var(--ovisoft-border-radius);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: var(--ovisoft-transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ovisoft-portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Imagen del proyecto */
.ovisoft-portfolio-image {
    position: relative;
    width: 100%;
    padding-bottom: 66.67%; /* Ratio 3:2 */
    overflow: hidden;
    background: #f5f5f5;
}

.ovisoft-portfolio-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

/* Overlay en hover */
.ovisoft-portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ovisoft-portfolio-item:hover .ovisoft-portfolio-overlay {
    opacity: 1;
}

.ovisoft-portfolio-overlay .view-project {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    padding: 12px 24px;
    border: 2px solid #fff;
    border-radius: 4px;
    transition: var(--ovisoft-transition);
}

.ovisoft-portfolio-overlay .view-project:hover {
    background: #fff;
    color: #333;
}

/* Contenido de la tarjeta */
.ovisoft-portfolio-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.ovisoft-portfolio-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
}

.ovisoft-portfolio-title a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.3s ease;
}

.ovisoft-portfolio-title a:hover {
    color: var(--ovisoft-filter-active-bg);
}

/* Taxonomías */
.ovisoft-portfolio-taxonomies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.ovisoft-portfolio-term {
    display: inline-block;
    padding: 4px 12px;
    background: #f5f5f5;
    border-radius: 3px;
    font-size: 13px;
    color: #666;
    text-decoration: none;
    transition: var(--ovisoft-transition);
}

.ovisoft-portfolio-term:hover {
    background: var(--ovisoft-filter-active-bg);
    color: #fff;
}

.ovisoft-portfolio-term.category {
    background: #e8f4f8;
    color: #0073aa;
}

.ovisoft-portfolio-term.technology {
    background: #f0f0f0;
    color: #555;
}

/* Extracto */
.ovisoft-portfolio-excerpt {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 15px;
    line-height: 1.6;
    flex-grow: 1;
}

/* ==========================================================================
   Página individual del proyecto (Single)
   ========================================================================== */

.single-ovisoft_portfolio .ovisoft-single-project,
.ovisoft-single-shortcode {
    max-width: 1200px;
    margin: 0 auto;
}

/* Título cuando se usa shortcode */
.ovisoft-single-shortcode .ovisoft-single-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 30px 0;
    line-height: 1.2;
    color: #1a1a1a;
}

/* Imagen destacada */
.ovisoft-single-featured-image {
    margin-bottom: 40px;
    border-radius: var(--ovisoft-border-radius);
    overflow: hidden;
}

.ovisoft-single-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Meta box de información */
.ovisoft-project-meta {
    background: #f9f9f9;
    border-left: 4px solid var(--ovisoft-filter-active-bg);
    padding: 25px;
    margin-bottom: 40px;
    border-radius: 4px;
}

.ovisoft-project-meta h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #1a1a1a;
}

.ovisoft-meta-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    font-size: 15px;
}

.ovisoft-meta-item:last-child {
    margin-bottom: 0;
}

.ovisoft-meta-icon {
    width: 20px;
    margin-right: 12px;
    color: var(--ovisoft-filter-active-bg);
    flex-shrink: 0;
}

.ovisoft-meta-label {
    font-weight: 600;
    margin-right: 8px;
    color: #333;
}

.ovisoft-meta-value {
    color: #666;
}

.ovisoft-meta-value a {
    color: var(--ovisoft-filter-active-bg);
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.ovisoft-meta-value a:hover {
    opacity: 0.7;
    text-decoration: underline;
}

.ovisoft-meta-value .ovisoft-portfolio-term {
    margin-right: 6px;
    margin-bottom: 6px;
    display: inline-block;
}

/* Contenido principal */
.ovisoft-project-content {
    margin-bottom: 40px;
    font-size: 16px;
    line-height: 1.8;
    color: #333;
}

.ovisoft-project-content h1,
.ovisoft-project-content h2,
.ovisoft-project-content h3,
.ovisoft-project-content h4 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    line-height: 1.3;
}

.ovisoft-project-content p {
    margin-bottom: 1em;
}

.ovisoft-project-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Galería de imágenes */
.ovisoft-project-gallery {
    margin-bottom: 40px;
}

.ovisoft-project-gallery h3 {
    margin: 0 0 20px 0;
    font-size: 22px;
    color: #1a1a1a;
}

.ovisoft-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.ovisoft-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--ovisoft-border-radius);
    cursor: pointer;
    aspect-ratio: 4 / 3;
}

.ovisoft-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ovisoft-gallery-item:hover img {
    transform: scale(1.1);
}

/* Navegación entre proyectos */
.ovisoft-project-navigation {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 30px 0;
    border-top: 1px solid #e0e0e0;
    margin-top: 40px;
}

.ovisoft-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: #f5f5f5;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: var(--ovisoft-transition);
    max-width: 45%;
}

.ovisoft-nav-link:hover {
    background: var(--ovisoft-filter-active-bg);
    color: #fff;
}

.ovisoft-nav-link.prev .ovisoft-nav-arrow {
    order: -1;
}

.ovisoft-nav-arrow {
    font-size: 20px;
}

.ovisoft-nav-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ovisoft-nav-label {
    font-size: 12px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ovisoft-nav-title {
    font-weight: 600;
    font-size: 15px;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.ovisoft-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ovisoft-lightbox.active {
    display: flex;
    opacity: 1;
}

.ovisoft-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    animation: lightboxZoom 0.3s ease;
}

@keyframes lightboxZoom {
    from {
        transform: scale(0.8);
    }
    to {
        transform: scale(1);
    }
}

.ovisoft-lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    border-radius: 4px;
}

.ovisoft-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: var(--ovisoft-transition);
    backdrop-filter: blur(10px);
}

.ovisoft-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.ovisoft-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: var(--ovisoft-transition);
    backdrop-filter: blur(10px);
}

.ovisoft-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ovisoft-lightbox-prev {
    left: 20px;
}

.ovisoft-lightbox-next {
    right: 20px;
}

/* ==========================================================================
   Loading y estados
   ========================================================================== */

.ovisoft-loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.ovisoft-loading::after {
    content: "";
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--ovisoft-filter-active-bg);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.ovisoft-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 18px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
    .ovisoft-project-meta {
        padding: 20px;
    }
    
    .ovisoft-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 767px) {
    .ovisoft-portfolio-filters {
        gap: 8px;
    }
    
    .ovisoft-filter-button {
        padding: 10px 18px;
        font-size: 14px;
    }
    
    .ovisoft-portfolio-content {
        padding: 15px;
    }
    
    .ovisoft-portfolio-title {
        font-size: 18px;
    }
    
    .ovisoft-project-navigation {
        flex-direction: column;
    }
    
    .ovisoft-nav-link {
        max-width: 100%;
    }
    
    .ovisoft-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .ovisoft-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .ovisoft-lightbox-prev {
        left: 10px;
    }
    
    .ovisoft-lightbox-next {
        right: 10px;
    }
}

/* ==========================================================================
   Utilidades
   ========================================================================== */

.ovisoft-hidden {
    display: none !important;
}

.ovisoft-fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
