/**
 * Periódico Tchê Química - Main Stylesheet
 * Cores: Azuis (#2c5f7f, #1a3a52) e Amarelos (#d4a574, #f4c542)
 * Versão: 2.3 - Fade suave (0.5s) + área estendida em todos os dropdowns
 */

/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Source Sans Pro', Arial, sans-serif;
    font-size: 11pt;
    color: #000;
    background: #fff;
}

a {
    text-decoration: none;
    color: #2c5f7f;
    transition: all 0.3s ease;
}

a:hover {
    color: #d4a574;
}

h1, h2, h3, h4, h5, h6 {
    color: #1a3a52;
    font-weight: 700;
}

/* ========== CORREÇÃO PARA ANCORAGEM COM HEADER FIXO ========== */
html {
    scroll-padding-top: 100px;
}

section[id] {
    scroll-margin-top: 100px;
}

/* ========== HEADER ========== */
#page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-header {
    background: linear-gradient(135deg, #2c5f7f, #1a3a52);
    color: white;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-top {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

/* Logo */
.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-box {
    background: #c99b76;
    color: #2c4a5e;
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    border-radius: 10px;
}

.logo-text h1 {
    font-size: 1.6rem;
    margin: 0 0 5px 0;
    color: white;
    font-weight: 600;
}

.logo-text h1 a {
    color: white;
}

.logo-text h1 a:hover {
    color: #f4c542;
}

.tagline {
    font-size: 0.75rem;
    margin: 0;
    color: #f4f4f4;
}

/* ========== Language Dropdown com área estendida e fade ========== */
.language-dropdown {
    position: relative;
    display: inline-block;
}

.language-selector {
    padding: 8px 15px;
    background: rgba(255,255,255,0.15);
    border-radius: 5px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.language-selector:hover {
    background: rgba(255,255,255,0.25);
}

.language-options {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 180px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    border-radius: 5px;
    margin-top: 8px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.5s ease, visibility 0.5s, transform 0.3s;
    pointer-events: none;
}

/* Área estendida para evitar fechamento acidental */
.language-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    height: 12px; /* cobre margin-top + margem de segurança */
}

.language-options a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: #333;
    border-bottom: 1px solid #e8e8e8;
}

.language-options a:last-child {
    border-bottom: none;
}

.language-options a:hover {
    background: #f8f9fa;
    color: #2c5f7f;
}

.language-dropdown:hover .language-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.2s ease, visibility 0.2s, transform 0.2s;
    pointer-events: auto;
}

/* ========== NAVIGATION - DESKTOP ========== */
nav {
    background: #1a3a52;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 15px 0;
    position: relative;
}

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

.nav-container > ul {
    margin: 0;
    padding: 0;
    list-style: none;
    text-align: center;
}

.nav-container > ul > li {
    display: inline-block;
    margin: 0 0.35em;
    position: relative;
    list-style: none;
}

.nav-container > ul > li > a {
    display: inline-block;
    border-radius: 5px;
    color: white;
    padding: 0.6em 1.2em;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.nav-container > ul > li > a:hover {
    background: #2c5f7f;
    color: #ffd700;
    font-weight: 700;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* ========== Dropdowns principais com fade e área estendida ========== */
.nav-container ul ul {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 300px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    border-top: 3px solid #d4a574;
    z-index: 1000;
    list-style: none;
    margin: 10px 0 0 0;
    padding: 10px 0;
    border-radius: 5px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.5s ease, visibility 0.5s, transform 0.3s;
    pointer-events: none;
}

/* Triângulo do submenu */
.nav-container ul ul::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 30px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #d4a574;
}

/* Área estendida para evitar fechamento acidental */
.nav-container > ul > li.has-submenu {
    position: relative;
}

.nav-container > ul > li.has-submenu::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 14px; /* cobre margin-top (10px) + margem extra */
}

/* Mostrar submenu ao hover */
.nav-container > ul > li.has-submenu:hover > ul {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.2s ease, visibility 0.2s, transform 0.2s;
    pointer-events: auto;
}

.nav-container ul ul li {
    border-bottom: 1px solid #e8e8e8;
    list-style: none;
}

.nav-container ul ul li:last-child {
    border-bottom: none;
}

.nav-container ul ul a {
    display: block;
    padding: 12px 25px;
    color: #333;
    font-size: 0.9rem;
    text-transform: none;
    font-weight: 400;
    transition: all 0.3s ease;
}

.nav-container ul ul a:hover {
    background: #f8f9fa;
    color: #2c5f7f;
    font-weight: 700;
    padding-left: 35px;
}

/* Search - DESKTOP */
.nav-container .search-item {
    display: inline-block;
    margin: 0 0 0 1em;
    list-style: none;
    vertical-align: middle;
}

.nav-container form {
    display: inline-block;
    margin: 0;
}

.nav-container input[type="text"] {
    border-radius: 5px;
    border: 1px solid #ddd;
    background: #f3f3f3;
    color: #5d5d5d;
    padding: 0.4em 0.8em;
    vertical-align: middle;
    width: 150px;
    font-family: 'Source Sans Pro', Arial, sans-serif;
    font-size: 14pt;
    outline: none;
}

.nav-container button {
    border-radius: 5px;
    background: #d4a574;
    color: white;
    border: none;
    cursor: pointer;
    padding: 0.4em 0.8em;
    font-size: 14pt;
    vertical-align: middle;
    margin-left: 2px;
    transition: all 0.3s ease;
}

.nav-container button:hover {
    background: #ffd700;
    transform: scale(1.05);
}

/* ========== MENU HAMBURGER - Escondido no Desktop ========== */
#menu-toggle {
    display: none;
}

.hamburger {
    display: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    flex-direction: column;
    align-items: center;
}

.hamburger-box {
    width: 30px;
    height: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
    width: 30px;
    height: 3px;
    background-color: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.hamburger-inner {
    position: relative;
}

.hamburger-inner::before,
.hamburger-inner::after {
    content: '';
    position: absolute;
    left: 0;
}

.hamburger-inner::before {
    top: -10px;
}

.hamburger-inner::after {
    top: 10px;
}

#menu-toggle:checked + .hamburger .hamburger-inner {
    background-color: transparent;
}

#menu-toggle:checked + .hamburger .hamburger-inner::before {
    transform: rotate(45deg);
    top: 0;
    background-color: #ffd700;
}

#menu-toggle:checked + .hamburger .hamburger-inner::after {
    transform: rotate(-45deg);
    top: 0;
    background-color: #ffd700;
}

.menu-label {
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
}

.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ========== SISTEMA DE SEÇÕES ========== */
.section-white {
    background: #ffffff;
    color: #333;
    padding: 80px 20px;
}

.section-white h2,
.section-white h3 {
    color: #1a3a52;
}

.section-white p {
    color: #666;
}

.section-blue {
    background: linear-gradient(135deg, #1a3a52, #2c5f7f);
    color: white;
    padding: 80px 20px;
}

.section-blue h2,
.section-blue h3 {
    color: white;
}

.section-blue p {
    color: rgba(255, 255, 255, 0.95);
}

.section-blue a:not(.btn) {
    color: #f4c542;
}

.section-blue a:not(.btn):hover {
    color: #ffd700;
}

/* ========== LAYOUTS ========== */
.layout-full {
    max-width: 1200px;
    margin: 0 auto;
}

.layout-2col,
.layout-3col,
.layout-left-large,
.layout-right-large,
.layout-top-bottom {
    display: grid;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.layout-2col { grid-template-columns: 1fr 1fr; }
.layout-3col { grid-template-columns: repeat(3, 1fr); }
.layout-left-large { grid-template-columns: 2fr 1fr; }
.layout-right-large { grid-template-columns: 1fr 2fr; }
.layout-top-bottom { grid-template-columns: 1fr 1fr; }
.layout-top-bottom .full-width { grid-column: 1 / -1; }

/* Boxes */
.box {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.section-blue .box {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Botões */
.btn {
    display: inline-block;
    padding: 15px 35px;
    border-radius: 5px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #d4a574;
    color: white;
}

.btn-primary:hover {
    background: #f4c542;
    color: #1a3a52;
    font-weight: 700;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: transparent;
    border: 2px solid white;
    color: white;
}

.btn-secondary:hover {
    background: white;
    color: #1a3a52;
    transform: translateY(-2px);
}

/* ========== FOOTER ========== */
footer {
    background: linear-gradient(135deg, #1a3a52, #2c5f7f);
    color: white;
    padding: 60px 20px 20px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

footer h3 {
    color: #f4c542;
    margin-bottom: 15px;
}

footer p {
    color: rgba(255,255,255,0.9);
    margin: 0;
}

footer a {
    color: rgba(255,255,255,0.9);
}

footer a:hover {
    color: #ffd700;
}

.copyright {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
}

/* ========== RESPONSIVE - TABLET (992px) ========== */
@media (max-width: 992px) {
    .layout-3col {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-container > ul > li > a {
        padding: 0.5em 0.8em;
        font-size: 0.85rem;
    }
}

/* ========== RESPONSIVE - MOBILE (768px) ========== */
@media (max-width: 768px) {
    
    .hamburger {
        display: flex;
    }
    
    nav {
        padding: 0;
        min-height: 50px;
        display: flex;
        align-items: center;
    }
    
    .nav-container {
        width: 100%;
        position: relative;
    }
    
    .nav-container > ul {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: linear-gradient(180deg, #1a3a52, #2c5f7f);
        flex-direction: column;
        padding: 80px 0 30px 0;
        margin: 0;
        text-align: left;
        overflow-y: auto;
        transition: left 0.3s ease;
        z-index: 999;
        box-shadow: 5px 0 20px rgba(0,0,0,0.3);
        display: flex;
    }
    
    #menu-toggle:checked ~ ul,
    #menu-toggle:checked + .hamburger + .menu-overlay + ul {
        left: 0;
    }
    
    #menu-toggle:checked + .hamburger + .menu-overlay {
        display: block;
        opacity: 1;
    }
    
    .nav-container > ul > li {
        display: block;
        margin: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .nav-container > ul > li > a {
        display: block;
        padding: 15px 25px;
        font-size: 1rem;
        border-radius: 0;
    }
    
    .nav-container > ul > li > a:hover {
        background: rgba(255,255,255,0.1);
        transform: none;
        box-shadow: none;
        padding-left: 35px;
    }
    
    .nav-container ul ul {
        position: static;
        width: 100%;
        min-width: 100%;
        box-shadow: none;
        border-top: none;
        border-radius: 0;
        margin: 0;
        padding: 0;
        background: rgba(0,0,0,0.2);
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        pointer-events: auto !important;
    }
    
    .nav-container ul ul::before {
        display: none;
    }
    
    .nav-container ul ul li {
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    .nav-container ul ul a {
        padding: 12px 25px 12px 40px;
        color: rgba(255,255,255,0.9);
        font-size: 0.9rem;
    }
    
    .nav-container ul ul a:hover {
        background: rgba(255,255,255,0.1);
        color: #ffd700;
        padding-left: 50px;
    }
    
    .nav-container > ul > li.has-submenu > a::after {
        content: ' ▼';
        font-size: 0.7em;
        margin-left: 8px;
    }
    
    .nav-container .search-item {
        display: block;
        margin: 20px 25px;
        padding-top: 20px;
        border-top: 1px solid rgba(255,255,255,0.2);
    }
    
    .nav-container form {
        display: flex;
        gap: 10px;
    }
    
    .nav-container input[type="text"] {
        flex: 1;
        width: 100%;
    }
    
    .layout-2col,
    .layout-3col,
    .layout-left-large,
    .layout-right-large,
    .layout-top-bottom {
        grid-template-columns: 1fr;
    }
    
    .section-white,
    .section-blue {
        padding: 50px 15px;
    }
    
    .header-top {
        padding: 15px;
    }
    
    .logo-box {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .logo-text h1 {
        font-size: 1.2rem;
    }
    
    .tagline {
        font-size: 0.65rem;
    }
    
    .language-selector {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .btn {
        padding: 12px 25px;
        font-size: 0.9rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* ========== RESPONSIVE - MOBILE PEQUENO (480px) ========== */
@media (max-width: 480px) {
    
    .header-top {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .logo-section {
        justify-content: center;
    }
    
    .language-dropdown {
        align-self: center;
    }
    
    .section-white,
    .section-blue {
        padding: 40px 15px;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    .box {
        padding: 20px;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
        text-align: center;
    }
}

/* ========== UTILITÁRIOS ========== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.has-submenu > a {
    position: relative;
}

body.menu-open {
    overflow: hidden;
}

a, button {
    transition: all 0.3s ease;
}

a:focus,
button:focus,
input:focus {
    outline: 2px solid #f4c542;
    outline-offset: 2px;
}

@media print {
    .main-header,
    nav,
    .hamburger,
    footer {
        display: none;
    }
    
    .section-blue {
        background: white;
        color: black;
    }
    
    .section-blue h2,
    .section-blue h3,
    .section-blue p {
        color: black;
    }
}