/**
 * Mais Saber - Estilos do Layout
 *
 * @package Mais_Saber
 * @since 1.0.0
 */

/* Animações */
@keyframes ms-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ms-slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Classes de animação */
.ms-animate {
    animation: ms-fade-in 0.6s ease-out;
}

.ms-animate-slide {
    animation: ms-slide-in 0.6s ease-out;
}

/* Estado do menu mobile */
.ms-nav-menu.active {
    display: flex;
}

/* Formulário de contato */
.ms-form {
    position: relative;
}

.ms-form-status {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 0;
    font-size: 0.85rem;
}

.ms-form-status.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.ms-form-status.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* Loading no botão */
.ms-btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.ms-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: ms-spin 0.8s linear infinite;
}

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

/* Smooth scroll para links internos */
html {
    scroll-behavior: smooth;
}

/* Header fixo - compensação para o conteúdo */
.ms-main {
    padding-top: 65px;
}

/* Páginas de conteúdo (blog, single, arquivos, busca) precisam de mais
   espaço, pois o header fixo é mais alto que na home. */
body:not(.home) .ms-main {
    padding-top: 120px;
}

/* Paginação */
.navigation.pagination {
    margin-top: 50px;
    text-align: center;
}

.navigation.pagination .nav-links {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
}

.navigation.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border: 1px solid #ddd;
    font-size: 0.875rem;
    color: #333;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.navigation.pagination .page-numbers:hover,
.navigation.pagination .page-numbers.current {
    background-color: #8bc34a;
    border-color: #8bc34a;
    color: #fff;
}

/* Paginação com lista (ul) */
.ms-pagination {
    margin-top: 50px;
    text-align: center;
}

.ms-pagination ul.page-numbers {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ms-pagination ul.page-numbers li {
    margin: 0;
}

.ms-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border: 1px solid #ddd;
    font-size: 0.875rem;
    color: #333;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    text-decoration: none;
}

.ms-pagination .page-numbers:hover,
.ms-pagination .page-numbers.current {
    background-color: #8bc34a;
    border-color: #8bc34a;
    color: #fff;
}

.ms-pagination .page-numbers.dots {
    border: none;
    background: transparent;
}

/* Widget styles */
.ms-sidebar .widget {
    margin-bottom: 30px;
    padding: 25px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
}

.ms-sidebar .widget-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #8bc34a;
}

.ms-sidebar .widget ul,
.ms-sidebar .widget ol {
    list-style: none;
}

.ms-sidebar .widget ul li,
.ms-sidebar .widget ol li {
    margin-bottom: 10px;
    font-size: 0.875rem;
}

.ms-sidebar .widget a {
    color: #555;
}

.ms-sidebar .widget a:hover {
    color: #8bc34a;
}

.ms-sidebar .wp-block-search form,
.ms-sidebar .widget_search form {
    display: flex;
}

.ms-sidebar .wp-block-search__input,
.ms-sidebar .widget_search input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #ddd;
    font-size: 0.85rem;
}

.ms-sidebar .wp-block-search__button,
.ms-sidebar .widget_search button {
    background-color: #8bc34a;
    border: none;
    color: #fff;
    padding: 10px 15px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.ms-sidebar .wp-block-search__button:hover,
.ms-sidebar .widget_search button:hover {
    background-color: #7cb342;
}

/* Accessibilidade */
.ms-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #8bc34a;
    color: #fff;
    padding: 8px;
    z-index: 10000;
    transition: top 0.3s;
}

.ms-skip-link:focus {
    top: 0;
}

/* Focus states */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #8bc34a;
    outline-offset: 2px;
}

/* Screen reader only */
.ms-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;
}

/* ===== Layout de conteúdo (blog, single, páginas, arquivos, busca) ===== */
.ms-two-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 40px;
    padding: 40px 0 70px;
    align-items: start;
}

.ms-main-content {
    min-width: 0;
}

.ms-content-area {
    min-width: 0;
    padding: 40px 0 70px;
}

/* Posts */
.ms-post {
    margin-bottom: 45px;
}

.ms-post:not(:last-child) {
    padding-bottom: 45px;
    border-bottom: 1px solid #eee;
}

.ms-post-header {
    margin-bottom: 20px;
}

.ms-post-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #333;
    line-height: 1.3;
    margin-bottom: 10px;
}

.ms-post-title a {
    color: inherit;
}

.ms-post-title a:hover {
    color: #8bc34a;
}

body.single .ms-post-title {
    font-size: 2rem;
}

.ms-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    font-size: 0.8rem;
    color: #888;
}

.ms-post-meta .ms-post-author {
    font-style: italic;
}

.ms-post-meta .ms-post-categories a {
    color: #8bc34a;
    font-weight: 600;
}

.ms-post-meta .ms-post-categories a:hover {
    color: #558b2f;
}

.ms-post-thumbnail {
    margin-bottom: 25px;
}

.ms-post-thumbnail img {
    width: 100%;
    height: auto;
}

.ms-post-content {
    font-size: 0.95rem;
    color: #444;
    line-height: 1.8;
}

.ms-post-content p {
    margin-bottom: 1.2em;
}

.ms-post-content h2,
.ms-post-content h3,
.ms-post-content h4,
.ms-post-content h5,
.ms-post-content h6 {
    color: #333;
    font-weight: 700;
    line-height: 1.3;
    margin: 1.5em 0 0.6em;
}

.ms-post-content h2 {
    font-size: 1.5rem;
}

.ms-post-content h3 {
    font-size: 1.25rem;
}

.ms-post-content h4 {
    font-size: 1.1rem;
}

.ms-post-content ul,
.ms-post-content ol {
    margin: 0 0 1.2em;
    padding-left: 1.5em;
}

.ms-post-content ul {
    list-style: disc;
}

.ms-post-content ol {
    list-style: decimal;
}

.ms-post-content li {
    margin-bottom: 0.4em;
}

.ms-post-content a {
    color: #558b2f;
    text-decoration: underline;
}

.ms-post-content a:hover {
    color: #8bc34a;
}

.ms-post-content blockquote {
    margin: 0 0 1.2em;
    padding: 10px 20px;
    border-left: 4px solid #8bc34a;
    background-color: #f7faf3;
    color: #555;
    font-style: italic;
}

.ms-post-content img {
    margin-bottom: 1.2em;
}

.ms-post-content figure {
    margin: 0 0 1.2em;
}

.ms-post-content figcaption {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #888;
    text-align: center;
}

.ms-post-content table {
    width: 100%;
    margin-bottom: 1.2em;
    border-collapse: collapse;
}

.ms-post-content th,
.ms-post-content td {
    padding: 8px 12px;
    border: 1px solid #ddd;
    text-align: left;
}

.ms-post-content th {
    background-color: #f5f5f5;
    font-weight: 700;
}

.ms-post-footer {
    margin-top: 30px;
}

.ms-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
}

.ms-tag {
    display: inline-block;
    padding: 5px 12px;
    background-color: #f1f1f1;
    font-size: 0.75rem;
    color: #555;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.ms-tag:hover {
    background-color: #8bc34a;
    color: #fff;
}

.ms-post-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    font-size: 0.85rem;
}

.ms-post-navigation a {
    color: #333;
}

.ms-post-navigation a:hover {
    color: #8bc34a;
}

.ms-nav-next {
    margin-left: auto;
    text-align: right;
}

.ms-read-more {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #8bc34a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ms-read-more:hover {
    color: #558b2f;
}

/* Páginas estáticas */
.ms-page-header {
    margin-bottom: 20px;
}

.ms-page-title {
    font-size: 2rem;
    font-weight: 800;
    color: #333;
    margin-bottom: 25px;
}

.ms-page-content {
    font-size: 0.95rem;
    color: #444;
    line-height: 1.8;
}

.ms-page-content p {
    margin-bottom: 1.2em;
}

.ms-page-links {
    margin-top: 30px;
    font-size: 0.85rem;
    color: #333;
}

.ms-page-links a {
    display: inline-block;
    margin: 0 3px;
    padding: 4px 10px;
    border: 1px solid #ddd;
    color: #333;
}

.ms-page-links a:hover {
    border-color: #8bc34a;
    color: #8bc34a;
}

/* Cabeçalhos de arquivo e busca */
.ms-archive-header,
.ms-search-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #8bc34a;
}

.ms-archive-title,
.ms-search-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #333;
}

.ms-archive-description {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
}

/* Sem resultados / 404 */
.ms-no-results {
    padding: 60px 20px;
    text-align: center;
}

.ms-no-results h2 {
    margin-bottom: 15px;
    font-size: 1.4rem;
    font-weight: 800;
    color: #333;
}

.ms-no-results p {
    margin-bottom: 25px;
    color: #666;
}

.ms-error-404 {
    padding: 60px 20px;
    text-align: center;
}

.ms-error-title {
    font-size: 6rem;
    font-weight: 800;
    line-height: 1;
    color: #8bc34a;
}

.ms-error-subtitle {
    margin-bottom: 15px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.ms-error-message {
    margin-bottom: 30px;
    color: #666;
}


/* ===== Página de Artigos (grid com imagens destacadas) ===== */
.ms-post-grid-item {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 25px;
    margin-bottom: 45px;
    padding-bottom: 45px;
    border-bottom: 1px solid #eee;
}

.ms-post-grid-item:last-child {
    border-bottom: none;
}

.ms-post-grid-thumbnail {
    width: 100%;
}

.ms-post-grid-thumbnail a {
    display: block;
    overflow: hidden;
}

.ms-post-grid-thumbnail img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.ms-post-grid-thumbnail a:hover img {
    transform: scale(1.03);
}

.ms-post-grid-content {
    min-width: 0;
}

.ms-post-excerpt {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.7;
    margin-top: 15px;
}

/* Responsivo para a página de artigos */
@media (max-width: 768px) {
    .ms-post-grid-item {
        grid-template-columns: 1fr;
    }

    .ms-post-grid-thumbnail img {
        height: 250px;
    }
}

/* Responsivo */
@media (max-width: 992px) {
    .ms-two-columns {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}
