/* =============================================
   SISTEMA UNIFICADO DE GALERIA E CATEGORIZAÇÃO
   ============================================= */

/* ===========================================
   1. ESTILOS GERAIS E ANIMAÇÕES
   =========================================== */

/* Animações Gerais */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

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

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ===========================================
   2. HEADER E INFORMAÇÕES DA GALERIA
   =========================================== */

.galeria-header {
    /*background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 0 20px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);*/
    color: var(--elegant-primary);
    padding: 3rem 0;
    margin: -2rem -4rem 0rem;
}

@media (max-width: 768px) {
    .galeria-header {
        margin: -1rem -1rem 2rem;
        padding: 2rem 1rem;
    }
}

.galeria-header h1 {
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.galeria-header h3 {
    font-size: 1.25rem;
    opacity: 0.95;
    font-weight: 400;
}

.galeria-info {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.galeria-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.galeria-info-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.galeria-info-item i {
    font-size: 1rem;
}

/* ===========================================
   3. CATEGORIAS E TÍTULOS
   =========================================== */

/* Título de categoria */
.categoria-titulo {
    color: #2c3e50;
    font-weight: 600;
    border-left: 4px solid #3498db;
    padding-left: 10px;
    margin-top: 30px;
    margin-bottom: 15px;
}

/* Seções de Categoria */
.categoria-section {
    margin-bottom: 4rem;
    animation: fadeIn 0.5s ease;
}

.categoria-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #dddddd;
}

.categoria-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #222222;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.categoria-header .badge {
    background: #f7f7f7;
    color: #717171;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* Galeria categorizada */
.galeria-categorizada {
    padding: 20px 0;
}

.galeria-categoria-secao {
    margin-bottom: 40px;
}

/* Indicador de categoria na galeria */
.categoria-indicador {
    display: inline-block;
    background: #f8f9fa;
    color: #495057;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 15px;
}

/* Contador de fotos por categoria */
.categoria-contador {
    background: #6c757d;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 10px;
}

/* Separador visual entre categorias */
.categoria-separador {
    height: 2px;
    background: linear-gradient(to right, #3498db, transparent);
    margin: 20px 0;
}

/* ===========================================
   4. FILTROS E BOTÕES
   =========================================== */

/* Seção de Filtros */
.filter-section {
    background: #ffffff;
    padding: 2rem 2rem;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Filtros de Categoria */
.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0;
    padding: 1rem;
    background: #f7f7f7;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filter-btn {
    padding: 0.625rem 1.25rem;
    border: 1px solid #dddddd;
    background: white;
    outline: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: #222222;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-btn:hover {
    border-color: #222222;
    background: #f7f7f7;
    transform: translateY(-1px);
}

.filter-btn.active {
    background: #222222;
    color: white;
    border-color: #222222;
}

.filter-btn .badge {
    background: rgba(0, 0, 0, 0.1);
    color: inherit;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
}

/* ===========================================
   5. GRID DE FOTOS E CARDS
   =========================================== */

/* Grid de Fotos */
.foto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Grid Unificada de Fotos */
.foto-grid-unificada {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}

@media (min-width: 1200px) {
    .foto-grid,
    .foto-grid-unificada {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .foto-grid,
    .foto-grid-unificada {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .foto-grid,
    .foto-grid-unificada {
        grid-template-columns: 1fr;
    }
}

/* Animação para fotos filtradas */
.foto-card.hidden {
    display: none;
    animation: fadeOut 0.3s ease;
}

.foto-card.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.95); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Grid de fotos por categoria */
.categoria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Card de Foto */
.foto-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 4/3;
}

.foto-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.foto-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.foto-card:hover img {
    transform: scale(1.08);
}

/* Item de foto com animação */
.foto-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    animation: fadeInUp 0.5s ease;
}

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

/* Card de foto na edição */
.foto-existente {
    position: relative;
}

.foto-existente .card {
    transition: all 0.3s ease;
}

.foto-existente:hover .card {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Informações da Foto */
.foto-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0) 100%);
    color: white;
    padding: 2rem 1rem 1rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.foto-card:hover .foto-info {
    transform: translateY(0);
}

/* Overlay de categoria ao passar o mouse */
.foto-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: white;
    padding: 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.foto-item:hover .foto-overlay {
    transform: translateY(0);
}

/* ===========================================
   6. BADGES E INDICADORES
   =========================================== */

/* Badge de categoria */
.categoria-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(52, 152, 219, 0.9);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Badge de categoria na foto */
.foto-categoria-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: var(--nga-primary-color);
    backdrop-filter: blur(10px);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 5;
    transition: all 0.3s ease;
}

.foto-card:hover .foto-categoria-badge {
    background: rgba(0, 0, 0, 0.85);
    transform: translateY(-2px);
    bottom: 32px;
}

/* Badge de foto principal */
.foto-principal-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

/* Indicador de foto principal */
.foto-principal-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ff385c;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Número da foto */
.foto-numero {
    position: absolute;
    top: 12px;
    left: 12px;
    background: white;
    color: #222222;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-width: 32px;
    text-align: center;
    z-index: 8;
}

/* ===========================================
   7. LIGHTBOX
   =========================================== */

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

.lightbox.active {
    display: flex !important;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 36px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 10px;
    z-index: 10001;
    transition: transform 0.3s ease;
}

.lightbox-close:hover {
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 1rem;
    cursor: pointer;
    font-size: 24px;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
}

.lightbox-prev {
    left: 40px;
}

.lightbox-next {
    right: 40px;
}

.lightbox-counter {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
}

/* ===========================================
   8. PREVIEW E EDIÇÃO
   =========================================== */

/* Container de preview */
.preview-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
}

/* Card de preview com categoria */
.preview-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.preview-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.preview-card .card-img-top {
    height: 150px;
    object-fit: cover;
}

/* ===========================================
   9. BOTÕES E INPUTS
   =========================================== */

/* Botão de salvar categoria */
.salvar-categoria {
    width: 100%;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.salvar-categoria:hover {
    transform: scale(1.02);
}

/* Inputs de categoria e ordem */
.categoria-select, .ordem-input {
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.categoria-select:focus, .ordem-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
    outline: none;
}

/* Estilo para select customizado */
.custom-select-categoria {
    appearance: none;
    background: white url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3e%3cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e") no-repeat right .75rem center/8px 10px;
    padding-right: 2rem;
}

/* ===========================================
   10. NAVEGAÇÃO E BOTÕES FIXOS
   =========================================== */

/* Botões de Navegação Fixos */
.navigation-buttons {
    position: sticky;
    bottom: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    z-index: 100;
    margin-top: 3rem;
    max-width: fit-content;
    margin-left: auto;
    margin-right: auto;
}


/* ===========================================
   11. ESTADOS E INDICADORES
   =========================================== */

/* Estado Vazio */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    background: #f7f7f7;
    border-radius: 12px;
    margin: 3rem 0;
}

.empty-state i {
    font-size: 5rem;
    color: #c3c3c3;
    margin-bottom: 1.5rem;
}

.empty-state h4 {
    color: #222222;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #717171;
}

/* Loading spinner para salvamento */
.saving-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: #28a745;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Loading State */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

/* ===========================================
   12. RESPONSIVIDADE
   =========================================== */

@media (max-width: 768px) {
    .categoria-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .categoria-titulo {
        font-size: 16px;
    }
    
    .preview-card .card-img-top {
        height: 100px;
    }
    
    .galeria-header h1 {
        font-size: 1.75rem;
    }
    
    .lightbox-nav {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    .lightbox-prev {
        left: 20px;
    }
    
    .lightbox-next {
        right: 20px;
    }
    
    .navigation-buttons {
        bottom: 1rem;
        flex-direction: column;
        width: calc(100% - 2rem);
        max-width: none;
    }
    
    .btn-elegant {
        width: 100%;
        justify-content: center;
    }
    
    /* Ajustes para filtros em mobile */
    .filter-section {
        padding: 1rem 0;
        position: relative;
    }
    
    .filter-buttons {
        padding: 0.75rem;
        gap: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-btn {
        white-space: nowrap;
        font-size: 12px;
        padding: 0.5rem 1rem;
    }
    
    /* Ajustes para badges em mobile */
    .foto-numero {
        top: 8px;
        right: 8px;
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .foto-categoria-badge {
        bottom: 8px;
        left: 8px;
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .foto-principal-indicator {
        top: 8px;
        left: 8px;
        padding: 4px 8px;
        font-size: 10px;
    }
}

/* ===========================================
   13. ANIMAÇÕES DE ENTRADA SEQUENCIAL
   =========================================== */

.foto-card {
    animation: slideInUp 0.5s ease backwards;
    transition: all 0.3s ease;
}

.foto-card:nth-child(1) { animation-delay: 0.05s; }
.foto-card:nth-child(2) { animation-delay: 0.1s; }
.foto-card:nth-child(3) { animation-delay: 0.15s; }
.foto-card:nth-child(4) { animation-delay: 0.2s; }
.foto-card:nth-child(5) { animation-delay: 0.25s; }
.foto-card:nth-child(6) { animation-delay: 0.3s; }
.foto-card:nth-child(7) { animation-delay: 0.35s; }
.foto-card:nth-child(8) { animation-delay: 0.4s; }

/* Efeito hover suave para cards */
.foto-card {
    position: relative;
    overflow: hidden;
}

.foto-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.foto-card:hover::before {
    opacity: 1;
}

/* Contador de fotos visíveis */
#fotos-visiveis-count {
    font-weight: 600;
    color: var(--elegant-primary, #222222);
}

/* Estilo para filtros com scroll horizontal em mobile */
@media (max-width: 768px) {
    .filter-buttons::-webkit-scrollbar {
        height: 4px;
    }
    
    .filter-buttons::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 2px;
    }
    
    .filter-buttons::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 2px;
    }
    
    .filter-buttons::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
}

/* Melhorias para acessibilidade */
.filter-btn:focus,
.foto-card:focus {
    outline: 2px solid var(--elegant-primary, #222222);
    outline-offset: 2px;
}

.filter-btn:focus-visible,
.foto-card:focus-visible {
    box-shadow: 0 0 0 3px rgba(34, 34, 34, 0.2);
}

/* Fim do arquivo CSS unificado */