/*
Theme Name: Prefeitura de Iporanga - Service Oriented
Version: 2.3.0
Description: Tema governamental baseado em UX de serviços com sistema de abas e responsividade completa.
Author: Goose AI
*/

:root {
    --gov-blue-dark: #002d52;
    --gov-blue-main: #005aa3;
    --gov-blue-light: #e6f1f8;
    --gov-accent: #00a8e8;
    --gov-bg-gray: #f2f5f8;
    --gov-text: #2c3e50;
    --gov-text-muted: #5a6c7d;
    --gov-white: #ffffff;
    --gov-shadow: 0 10px 30px rgba(0,45,82,0.06);
    --gov-radius: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--gov-text);
    background-color: var(--gov-white);
    line-height: 1.6;
    margin: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 1. Top Bar & Accessibility */
.top-nav {
    background: var(--gov-blue-dark);
    color: #fff;
    padding: 6px 0;
    font-size: 0.7rem;
}

.top-nav a {
    color: #fff;
    opacity: 0.8;
    text-decoration: none;
    text-transform: uppercase;
    font-weight: 600;
    margin-right: 15px;
}

.top-nav a:hover {
    opacity: 1;
}

/* 2. Header & Search */
.main-header {
    padding: 40px 0;
    background: radial-gradient(circle at top right, #fff, var(--gov-bg-gray));
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.header-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    align-items: center;
    gap: 40px;
}

.search-container input {
    width: 100%;
    padding: 16px 30px;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 40px;
    font-size: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    transition: all 0.3s ease;
}

.search-container input:focus {
    border-color: var(--gov-accent);
    box-shadow: 0 4px 25px rgba(0,168,232,0.15);
    outline: none;
}

/* 3. Menu Navigation with Submenus & Mobile Toggle */
.nav-bar {
    background: var(--gov-blue-dark);
    position: relative;
    z-index: 100;
}

.menu-toggle {
    display: none;
    background: var(--gov-blue-main);
    border: none;
    color: white;
    padding: 15px 24px;
    font-size: 1rem;
    font-weight: 700;
    width: 100%;
    text-align: left;
    cursor: pointer;
    text-transform: uppercase;
}

.nav-bar ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-bar li {
    position: relative;
}

.nav-bar a {
    color: white;
    padding: 18px 25px;
    display: block;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    transition: background 0.2s;
}

.nav-bar a:hover,
.nav-bar li:hover > a {
    background: var(--gov-blue-main);
}

/* Submenus */
.nav-bar ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--gov-white);
    min-width: 240px;
    box-shadow: 0 12px 25px rgba(0,0,0,0.15);
    flex-direction: column;
    border-top: 4px solid var(--gov-accent);
    border-radius: 0 0 8px 8px;
}

.nav-bar ul ul li { width: 100%; }

.nav-bar ul ul a {
    color: var(--gov-blue-dark);
    padding: 14px 25px;
    text-transform: none;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
}

.nav-bar ul ul a:hover {
    background: var(--gov-bg-gray);
    color: var(--gov-blue-main);
}

.nav-bar li:hover > ul { display: flex; }

/* 4. Tabs & Grid de Mini Cards (Estilo Vitória-ES) */
.services-section {
    background: var(--gov-bg-gray);
    padding: 60px 0;
}

.tabs-container {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
}

.tabs-header {
    background: #f0f3f6;
    border-radius: 40px;
    display: flex;
    justify-content: space-between;
    padding: 5px;
    margin-bottom: 30px;
}

.tab-link {
    flex: 1;
    border: none;
    background: none;
    padding: 15px 20px;
    border-radius: 40px;
    font-weight: 700;
    color: var(--gov-blue-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 1rem;
    text-transform: none;
}

.tab-link.active {
    background: var(--gov-blue-dark);
    color: #fff;
}

.tab-content {
    display: none;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    animation: fadeIn 0.4s ease;
}

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

.tab-content.active {
    display: grid;
}

.tab-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px 10px;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.tab-card:hover {
    background: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    transform: translateY(-3px);
}

.tab-card i {
    font-size: 1.8rem;
    color: var(--gov-blue-main);
    margin-bottom: 12px;
}

.tab-card span {
    color: var(--gov-blue-main);
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1.2;
    display: block;
}

.tabs-footer-arrow {
    text-align: center;
    margin-top: 20px;
    color: var(--gov-blue-main);
    font-size: 1.5rem;
}

/* Carrossel Swiper Custom */
.home-slider {
    padding: 30px 0;
    background: var(--gov-bg-gray);
}

.swiper {
    width: 100%;
    height: auto;
    border-radius: var(--gov-radius);
    overflow: hidden;
    box-shadow: var(--gov-shadow);
}

.swiper-slide img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    display: block;
}

.swiper-button-next, .swiper-button-prev {
    color: var(--gov-white);
}

.swiper-pagination-bullet-active {
    background: var(--gov-white);
}

/* 6. Rodapé Robusto (Dark Footer) */
footer.site-footer {
    background: var(--gov-blue-dark) !important;
    color: #ffffff !important; /* Texto base branco */
    padding: 60px 0 0 !important;
    border-top: 4px solid var(--gov-accent) !important;
}

footer.site-footer h3 {
    color: #ffffff !important;
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    margin-bottom: 20px !important;
    text-transform: uppercase;
    letter-spacing: 1px;
}

footer.site-footer .footer-info, 
footer.site-footer .widget,
footer.site-footer p {
    color: #ffffff !important;
    font-size: 0.9rem !important;
    line-height: 1.6 !important;
}

footer.site-footer .footer-info i {
    color: var(--gov-accent) !important;
    width: 20px;
}

/* Reset de cores padrão para links em widgets */
.site-footer .widget_nav_menu .menu li a,
.site-footer .widget ul li a {
    color: #ffffff !important;
}

.footer-bottom {
    background: transparent !important; /* Remove a diferença de cor com o rodapé principal */
    padding: 25px 0 !important;
    margin-top: 40px !important;
    color: #ffffff !important;
    font-size: 0.85rem !important;
    border-top: 1px solid rgba(255,255,255,0.1); /* Linha divisória sutil */
}

.footer-bottom .copy {
    color: #ffffff !important;
    font-weight: 600;
    opacity: 0.9;
}

/* Garante que os selos no rodapé fiquem brancos e nítidos */
.footer-logos img {
    height: 35px;
    width: auto;
    filter: brightness(0) invert(1); /* Transforma qualquer cor em branco puro */
    opacity: 0.8;
    transition: opacity 0.3s;
}

.footer-logos img:hover {
    opacity: 1;
}

/* Responsividade Global */
@media (max-width: 992px) {
    .header-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .menu-toggle {
        display: block !important;
    }
    
    .nav-bar ul {
        display: none;
        flex-direction: column;
    }
    
    .nav-bar ul.show {
        display: flex;
    }
    
    .nav-bar li:hover > ul {
        display: none;
    }

    /* ============================================
       SUBMENU MOBILE - CORRIGIDO PARA LEGIBILIDADE
       ============================================ */
    
    /* Container do submenu: fundo branco sólido, sombra, borda visível */
    .nav-bar li.active > ul {
        display: flex;
        position: static;
        width: 100%;
        min-width: 0 !important;
        box-shadow: none;
        background: var(--gov-white) !important;
        border-left: 4px solid var(--gov-accent);
        margin: 0;
        padding: 0;
        border-radius: 0;
        border-top: none;
        flex-direction: column;
    }
    
    /* Itens do submenu: separador visível */
    .nav-bar li.active > ul li {
        border-bottom: 1px solid #e8eef3;
        margin: 0;
        padding: 0;
    }
    
    .nav-bar li.active > ul li:last-child {
        border-bottom: none;
    }
    
    /* LINKS do submenu no mobile: AZUL ESCURO sobre BRANCO (legível) */
    .nav-bar li.active > ul a {
        color: var(--gov-blue-dark) !important;
        background: var(--gov-white) !important;
        padding: 14px 20px 14px 40px !important;  /* indentação mostra hierarquia */
        font-weight: 600 !important;
        font-size: 0.9rem !important;
        text-transform: none !important;
        border-bottom: none !important;
        display: block !important;
    }
    
    /* Hover/focus nos submenus: destaque em azul claro */
    .nav-bar li.active > ul a:hover,
    .nav-bar li.active > ul a:focus {
        background: var(--gov-blue-light) !important;
        color: var(--gov-blue-dark) !important;
        padding-left: 48px !important;  /* leve deslocamento na hover */
    }

    /* Seta indicadora ao lado de itens com submenu no mobile */
    .nav-bar .menu-item-has-children > a::after {
        content: '\f078';  /* chevron-down do FontAwesome */
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        margin-left: 8px;
        font-size: 0.75rem;
        transition: transform 0.3s ease;
        display: inline-block;
        opacity: 0.7;
    }
    
    .nav-bar .menu-item-has-children.active > a::after {
        transform: rotate(180deg);
        opacity: 1;
    }
    
    /* Itens principais no menu mobile: contraste forte */
    .nav-bar > .container > ul > li > a {
        padding: 16px 24px !important;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        font-size: 0.95rem;
    }

    .tab-content {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .tab-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tabs-header {
        flex-direction: column;
        border-radius: 15px;
    }
    
    .logo-area h1 {
        font-size: 1.8rem;
    }
}

/* Formatação de Menus em Widgets (Rodapé e Sidebar) - CORREÇÃO DEFINITIVA */
.widget h2, .widget h3, .widget-title {
    margin-bottom: 10px !important;
}

.widget ul, 
.widget ol,
.widget_nav_menu ul,
.widget_pages ul,
.sidebar-wrapper ul,
.site-footer ul {
    list-style: none !important;
    list-style-type: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.widget li,
.widget_nav_menu li,
.widget_pages li {
    margin-bottom: 10px !important;
    padding: 0 !important;
    list-style: none !important;
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
    padding-bottom: 8px !important;
}

/* Links no Corpo do Site (Azul) */
.widget a,
.widget_nav_menu a,
.widget_pages a,
.sidebar-wrapper a {
    text-decoration: none !important;
    color: var(--gov-blue-main) !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    display: block !important;
    transition: all 0.2s ease !important;
}

/* Links no Rodapé Escuro (BRANCO PURO) */
.site-footer .widget a,
.site-footer .widget_nav_menu a,
.site-footer .widget_pages a,
.site-footer .footer-info a,
.site-footer ul li a {
    color: #ffffff !important;
    text-decoration: none !important;
    opacity: 1 !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    display: block !important;
    padding: 5px 0 !important;
    visibility: visible !important;
}

.site-footer .widget li {
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
}

.widget a:hover,
.widget_nav_menu a:hover,
.widget_pages a:hover {
    color: var(--gov-accent) !important;
    padding-left: 8px !important;
}

.site-footer .widget a:hover,
.site-footer .footer-info a:hover {
    color: var(--gov-accent) !important;
    opacity: 1 !important;
    padding-left: 8px !important;
}

/* Reset de contêineres específicos do WordPress */
.menu-menu-principal-container, .menu-teste-container {
    padding: 0 !important;
    margin: 0 !important;
}

/* Acessibilidade - Alto Contraste */
body.high-contrast {
    background: #000 !important;
    color: #fff !important;
}

body.high-contrast * {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}

body.high-contrast a {
    color: #ffff00 !important;
}
