/* ====================================
   GALERÍA AVANZADA - COARQ CHILE
   ==================================== */

/* Portfolio Destacado */
.portfolio-destacado {
    margin-bottom: 60px;
    text-align: center;
}

.portfolio-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.portfolio-subtitle {
    color: var(--text-light);
    margin-bottom: 30px;
}

.portfolio-grid {
    max-width: 800px;
    margin: 0 auto;
}

.portfolio-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

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

.portfolio-item img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.95), rgba(52, 152, 219, 0.95));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

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

.portfolio-overlay h4 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.portfolio-overlay p {
    color: white;
    font-size: 1.1rem;
}

/* Filtros */
.proyectos-filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-bottom: 50px;
}

.filtro-btn {
    padding: 12px 25px;
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.filtro-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.filtro-btn.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

/* Grid de Proyectos */
.proyectos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

.proyecto-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.proyecto-image {
    position: relative;
    height: 250px;
    overflow: hidden;
}

.proyecto-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.proyecto-card:hover .proyecto-image img {
    transform: scale(1.1);
}

.proyecto-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255,255,255,0.95);
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 2;
}

.proyecto-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.proyecto-card:hover .proyecto-overlay {
    opacity: 1;
}

.btn-ver-proyecto {
    background: white;
    color: var(--secondary-color);
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-ver-proyecto:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.proyecto-info {
    padding: 25px;
}

.proyecto-info h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.proyecto-categoria {
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ====================================
   MODAL AVANZADO
   ==================================== */

.gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
}

.gallery-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    border: 2px solid white;
    color: white;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10002;
}

.modal-close:hover {
    background: var(--secondary-color);
    transform: rotate(90deg);
}

.modal-content-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: auto;
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.1);
    border: 2px solid white;
    color: white;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10001;
}

.modal-nav:hover {
    background: var(--secondary-color);
    transform: translateY(-50%) scale(1.1);
}

.modal-prev {
    left: -80px;
}

.modal-next {
    right: -80px;
}

.modal-main {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    padding: 30px;
}

.modal-image-container {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

.modal-main-image {
    width: 100%;
    max-height: 600px;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}

.modal-main-image.zoomed {
    transform: scale(2);
    cursor: zoom-out;
}

.modal-counter {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
}

.modal-zoom {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.7);
    border: 2px solid white;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.modal-zoom:hover {
    background: var(--secondary-color);
}

.modal-info {
    margin-bottom: 20px;
}

.modal-info h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.modal-info p {
    color: var(--text-light);
    line-height: 1.8;
    margin-bottom: 15px;
}

.modal-category {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-light);
    padding: 8px 20px;
    border-radius: 20px;
    color: var(--primary-color);
    font-weight: 600;
}

/* Thumbnails */
.modal-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 20px;
    max-height: 150px;
    overflow-y: auto;
    padding: 10px 0;
}

.modal-thumb {
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
}

.modal-thumb:hover {
    border-color: var(--accent-color);
}

.modal-thumb.active {
    border-color: var(--secondary-color);
}

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

/* Antes/Después */
.modal-before-after {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--bg-light);
}

.before-after-toggle {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.ba-btn {
    padding: 12px 30px;
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.ba-btn:hover {
    background: var(--primary-color);
    color: white;
}

.ba-btn.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

/* Responsive */
@media (max-width: 1024px) {
    .modal-prev {
        left: 10px;
    }
    
    .modal-next {
        right: 10px;
    }
}

@media (max-width: 768px) {
    .proyectos-grid {
        grid-template-columns: 1fr;
    }
    
    .proyectos-filtros {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filtro-btn {
        justify-content: center;
    }
    
    .modal-nav {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .modal-main {
        padding: 15px;
    }
    
    .modal-thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
    
    .modal-thumb {
        height: 60px;
    }
    
    .portfolio-item img {
        height: 250px;
    }
}
