/**
 * CSS Dinâmico para Controle de Elementos
 * 
 * Estilos que se adaptam baseados nas configurações de exibição de elementos
 * 
 * @package Veistin
 */

/* ========================================
   Utilitários de Exibição
   ======================================== */

[data-element] {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-element][style*="display: none"] {
    display: none !important;
}

/* ========================================
   Classes por Tipo de Página
   ======================================== */

/* Página Inicial */
body.page-type-home {
    /* Estilos específicos da home */
}

/* Post Individual */
body.page-type-single_post {
    /* Estilos específicos de posts */
}

/* Página Estática */
body.page-type-page {
    /* Estilos específicos de páginas */
}

/* Arquivo de Categoria */
body.page-type-category {
    /* Estilos específicos de categorias */
}

/* Arquivo de Tag */
body.page-type-tag {
    /* Estilos específicos de tags */
}

/* Resultados de Busca */
body.page-type-search {
    /* Estilos específicos de busca */
}

/* Arquivo de Leiloeiras */
body.page-type-archive_leiloeira {
    /* Estilos específicos de leiloeiras */
}

/* Página 404 */
body.page-type-404 {
    /* Estilos específicos de 404 */
}

/* ========================================
   Header Sticky Desabilitado
   ======================================== */

body.no-sticky-header .veistin-header {
    position: relative !important;
    top: auto !important;
}

/* ========================================
   Ajustes de Layout sem Elementos
   ======================================== */

/* Sem Header */
body:not(.show-header) .veistin-header {
    display: none;
}

body:not(.show-header) .veistin-content-wrapper {
    padding-top: 0;
}

/* Sem Footer */
body:not(.show-footer) .veistin-footer {
    display: none;
}

/* Sem Breadcrumbs */
body:not(.show-breadcrumbs) .veistin-breadcrumbs {
    display: none;
}

/* ========================================
   Ajustes de Sidebar
   ======================================== */

/* Quando não há nenhuma sidebar ativa */
body.no-sidebar-active .veistin-content-area {
    display: block !important;
    grid-template-columns: 1fr !important;
}

body.no-sidebar-active .veistin-main-content {
    width: 100%;
    max-width: 100%;
}

/* ========================================
   Opções de Largura de Conteúdo
   ======================================== */

/* Largura Padrão (com sidebar se ativa) */
body.content-width-default .veistin-content-area {
    max-width: var(--veistin-container-width, 1200px);
    margin: 0 auto;
}

/* Largura Centralizada (900px) */
body.content-width-centered .veistin-content-area {
    max-width: 900px;
    margin: 0 auto;
}

body.content-width-centered .veistin-main-content {
    padding: 0 30px;
}

/* Largura Larga (1200px) */
body.content-width-wide .veistin-content-area {
    max-width: 1200px;
    margin: 0 auto;
}

body.content-width-wide .veistin-main-content {
    padding: 0 40px;
}

/* Largura Total (100%) */
body.content-width-full .veistin-content-area {
    max-width: var(--veistin-container-width, 1200px);
    margin: 0 auto;
}

body.content-width-full .veistin-main-content {
    padding: 0 20px;
}

/* ========================================
   Elementos de Post
   ======================================== */

/* Meta do Post */
.veistin-post-meta[data-element="post_meta"][style*="display: none"] {
    display: none !important;
}

/* Imagem Destacada */
.veistin-post-thumbnail[data-element="post_thumbnail"][style*="display: none"] {
    display: none !important;
}

/* Tags do Post */
.veistin-post-tags[data-element="post_tags"][style*="display: none"] {
    display: none !important;
}

/* Categorias do Post */
.veistin-post-categories[data-element="post_categories"][style*="display: none"] {
    display: none !important;
}

/* Botões de Compartilhamento */
.veistin-post-share[data-element="post_share"][style*="display: none"] {
    display: none !important;
}

/* Navegação Entre Posts */
.veistin-post-navigation[data-element="post_navigation"][style*="display: none"] {
    display: none !important;
}

/* Box do Autor */
.veistin-author-box[data-element="author_box"][style*="display: none"] {
    display: none !important;
}

/* Comentários */
.veistin-comments[data-element="comments"][style*="display: none"] {
    display: none !important;
}

/* ========================================
   Seções Especiais
   ======================================== */

/* Seção de Leiloeiras */
.veistin-leiloeiras-section[data-element="section_leiloeiras"][style*="display: none"] {
    display: none !important;
}

/* Seção de Categorias */
.veistin-categories-section[data-element="section_categories"][style*="display: none"] {
    display: none !important;
}

/* Posts Relacionados */
.veistin-related-posts[data-element="related_posts"][style*="display: none"] {
    display: none !important;
}

/* ========================================
   Ajustes de Espaçamento
   ======================================== */

/* Reduzir espaçamento quando elementos são removidos */
body:not(.show-breadcrumbs) .veistin-content-area {
    padding-top: var(--veistin-spacing-xl);
}

body:not(.show-post_meta) .veistin-post-header {
    margin-bottom: var(--veistin-spacing-md);
}

body:not(.show-post_thumbnail) .veistin-post-content {
    margin-top: 0;
}

/* ========================================
   Widgets
   ======================================== */

/* Widget de Busca */
.widget-search[data-element="widget_search"][style*="display: none"] {
    display: none !important;
}

/* Widget Posts Recentes */
.widget-recent-posts[data-element="widget_recent_posts"][style*="display: none"] {
    display: none !important;
}

/* Widget Categorias */
.widget-categories[data-element="widget_categories"][style*="display: none"] {
    display: none !important;
}

/* Widget Tags */
.widget-tags[data-element="widget_tags"][style*="display: none"] {
    display: none !important;
}

/* Widget Newsletter */
.widget-newsletter[data-element="widget_newsletter"][style*="display: none"] {
    display: none !important;
}

/* ========================================
   Botão Voltar ao Topo
   ======================================== */

body:not(.show-back_to_top) .veistin-back-to-top {
    display: none !important;
}

/* ========================================
   Responsividade
   ======================================== */

@media (max-width: 768px) {
    /* Em mobile, forçar largura total em alguns casos */
    body.content-width-centered .veistin-content-area,
    body.content-width-wide .veistin-content-area {
        max-width: 100%;
        padding: 0 20px;
    }
    
    /* Ajustar padding em mobile */
    body.content-width-centered .veistin-main-content,
    body.content-width-wide .veistin-main-content,
    body.content-width-full .veistin-main-content {
        padding: 0 15px;
    }
}

/* ========================================
   Animações de Transição
   ======================================== */

.veistin-content-area,
.veistin-main-content,
.veistin-sidebar {
    transition: max-width 0.3s ease, padding 0.3s ease, margin 0.3s ease;
}

/* ========================================
   Estados de Loading
   ======================================== */

.veistin-element-loading {
    opacity: 0.5;
    pointer-events: none;
}

.veistin-element-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #22c55e;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

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

/* ========================================
   Debug Mode (apenas para admins)
   ======================================== */

.admin-bar [data-element]::before {
    /* Mostrar nome do elemento em modo debug */
    /* content: attr(data-element); */
    /* position: absolute; */
    /* top: 0; */
    /* left: 0; */
    /* font-size: 10px; */
    /* background: rgba(34, 197, 94, 0.8); */
    /* color: white; */
    /* padding: 2px 5px; */
    /* border-radius: 3px; */
    /* z-index: 9999; */
}

/* ========================================
   Melhorias de Acessibilidade
   ======================================== */

/* Garantir que elementos ocultos não sejam acessíveis por teclado */
[data-element][style*="display: none"] * {
    visibility: hidden;
    pointer-events: none;
}

/* Manter foco visível em elementos interativos */
[data-element]:focus-within {
    outline: 2px solid #22c55e;
    outline-offset: 2px;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    /* Ocultar elementos não essenciais na impressão */
    [data-element="header_search"],
    [data-element="sidebar_ads"],
    [data-element="post_share"],
    [data-element="back_to_top"],
    [data-element="footer_widgets"] {
        display: none !important;
    }
}
