/**
 * Estilos da Galeria Pública - CPC
 * Layout quadrado simples
 * 
 * @author Júnior
 * @version 1.0.0
 */

/* =====================================================
   RESET E CONFIGURAÇÕES BÁSICAS
   ===================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Cores principais */
    --primary-color: #ff6b6b;
    --primary-dark: #ee5a52;
    --primary-light: #ff8a8a;
    
    /* Cores neutras */
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Transições */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--gray-700);
    background: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =====================================================
   CONTAINER PRINCIPAL
   ===================================================== */

.galeria-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 5px 1rem 2rem;
    position: relative;
    background: transparent;
    overflow: visible;
}

/* =====================================================
   LAYOUT GRID QUADRADO SIMPLES
   ===================================================== */

.diamonds-wrapper {
    position: relative;
    margin: 0 auto;
    max-width: 1200px;
    padding: 0;
    overflow: visible;
    z-index: 10;
}

.diamonds {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 20px;
    overflow: visible;
}

.diamonds > li {
    position: relative;
    margin: 0;
    padding: 0;
}

/* Fotos em formato quadrado normal */
.diamond {
    position: relative;
    display: block;
    width: calc(100% - 30px);
    height: 0;
    padding-bottom: calc(100% - 30px); /* Mantém proporção 1:1 com redução de 15px em cada lado */
    margin: 15px;
    overflow: visible;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-decoration: none;
    transition: all 0.3s ease;
    z-index: 20;
}

.diamond:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.diamond .content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    transform: translateY(0);
    opacity: 1;
    z-index: 25;
    border-radius: 12px;
}

.diamond .content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.diamond:hover .content img {
    transform: scale(1.05);
}

/* Remove classe diamond-sm - todas iguais */
.diamond-sm {
    /* Mesmo estilo do diamond normal */
}

/* Responsividade */
@media (max-width: 1024px) {
    .diamonds {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 767px) {
    .diamonds {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

@media (max-width: 479px) {
    .diamonds {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
}

/* =====================================================
   LIGHTBOX MODAL
   ===================================================== */

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    animation: scaleIn 0.3s ease-out;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
    box-shadow: var(--shadow-xl);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: var(--white);
    font-size: 2rem;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.lightbox-close:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-nav:hover {
    background: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: -60px;
}

.lightbox-next {
    right: -60px;
}

.lightbox-info {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    color: var(--white);
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    padding: 1rem;
    border-radius: 10px;
}

.lightbox-titulo {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.lightbox-descricao {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.4;
}

/* =====================================================
   LOADING E ESTADOS
   ===================================================== */

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: var(--white);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    z-index: 1001;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* =====================================================
   ANIMAÇÕES
   ===================================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { 
        opacity: 0;
        transform: scale(0.8);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

/* =====================================================
   RESPONSIVIDADE - TABLET
   ===================================================== */

@media (max-width: 1024px) {
    .galeria-container {
        padding: 10px 1rem 1rem;
    }
}

/* =====================================================
   RESPONSIVIDADE - MOBILE (≤ 767px)
   ===================================================== */

@media (max-width: 767px) {
    .galeria-container {
        padding: 10px 0.5rem 1rem;
    }
    
    /* Lightbox mobile */
    .lightbox-content {
        max-width: 95%;
        max-height: 80%;
    }
    
    .lightbox-close {
        top: -50px;
        right: 10px;
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-info {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .lightbox-titulo {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .lightbox-descricao {
        font-size: 0.85rem;
        line-height: 1.4;
    }
}