/* ============================= */
/* ESTILO BASE - SIMPLES E ANTIGO */
/* ============================= */
body {
    font-family: Arial, Verdana, sans-serif;
    background: #fff;
    margin: 0;
    padding: 0;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
}

/* ============================= */
/* CONTAINER PRINCIPAL */
/* ============================= */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    min-height: 100vh;
    padding: 0 15px;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* ============================================================= */
/* SECÇÕES FULL-WIDTH (CABEÇALHO, NAVEGAÇÃO) */
/* ============================================================= */
.header,
.nav {
    box-sizing: border-box;
    width: calc(100% + 30px);
    margin-left: -15px;
    margin-right: -15px;
}

/* ============================= */
/* CABEÇALHO */
/* ============================= */
.header {
    background: #f8f8f8;
    padding: 10px 15px;
    border-bottom: 3px solid #c33;
    text-align: center;
}

.logo {
    font-family: 'Times New Roman', serif;
    font-size: 36px;
    color: hsl(0, 60%, 50%);
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo img {
    height: 50px;
    margin-right: 15px;
}

/* ============================= */
/* MENU DE NAVEGAÇÃO */
/* ============================= */
.nav {
    background: #333;
    padding: 8px 15px;
    text-align: left;
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
}

.nav a {
    color: #fff;
    text-decoration: none;
    padding: 8px 15px;
    margin: 0 5px;
    font-weight: bold;
    display: inline-block;
}

.nav a:hover {
    color: #cc3333;
}

/* ============================= */
/* MENU DROPDOWN */
/* ============================= */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #333;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0px 8px 16px 0px #00000033;
    z-index: 1;
    left: 0;
    text-align: left;
}

.dropdown-content a {
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
    margin: 0;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* ============================= */
/* BARRA DE PESQUISA NA NAV */
/* ============================= */
.search-container {
    margin-left: 15px;
    display: flex;
    align-items: center;
    flex-grow: 1;
    max-width: 300px;
}

.search-container input[type="text"] {
    padding: 6px 10px;
    border: 1px solid #555;
    background-color: #222;
    color: #fff;
    border-radius: 3px;
    font-size: 0.9em;
    flex-grow: 1;
    margin-right: 5px;
}

.search-container input[type="text"]::placeholder {
    color: #bbb;
}

.search-container button {
    background-color: #c33;
    color: #fff;
    border: none;
    padding: 6px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.search-container button:hover {
    background-color: #a00;
}

/* ============================= */
/* CATEGORIAS NA NAV DIREITA */
/* ============================= */
.nav-categories {
    margin-left: auto;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.nav-categories a {
    color: #fff;
    text-decoration: none;
    padding: 8px 15px;
    margin: 0 5px;
    font-weight: bold;
    display: inline-block;
    white-space: nowrap;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.nav-categories a:hover,
.nav-categories a.active {
    color: #cc3333;
}

/* ============================= */
/* CONTEÚDO PRINCIPAL */
/* ============================= */
.content {
    display: flex;
    padding: 15px 0;
    flex-wrap: wrap;
    justify-content: center;
}

/* ============================= */
/* LAYOUT DE 2 COLUNAS */
/* ============================= */
.content.two-columns {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 20px 0;
    align-items: flex-start;
    gap: 20px;
}

.left-column {
    flex: 1;
    min-width: 300px;
    max-width: calc(30% - 10px);
    box-sizing: border-box;
}

.main-column {
    flex: 2;
    min-width: 600px;
    max-width: calc(70% - 10px);
    box-sizing: border-box;
}
.left-column h3,
.main-column h3 {
    color: #333;
    margin-top: 0;
    border-bottom: 2px solid #c33;
    padding-bottom: 5px;
    margin-bottom: 15px;
    font-size: 1.2em;
}

/* ============================= */
/* CARTÕES E NOTÍCIAS */
/* ============================= */
.column-post-item,
.main-news .main-secondary {
    background: #f8f8f8;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    padding: 12px 15px;
    transition: all 0.3s ease;
    position: relative;
    height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    overflow: hidden;
    margin-bottom: 15px;
    color: #333;
    box-sizing: border-box;
}

.column-post-item:hover,
.main-news .main-secondary:hover {
    background-color: #f0e6e6;
    border-color: #c33;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.column-post-item h4,
.main-news .main-secondary h4 {
    margin: 0;
    font-weight: bold;
    font-size: 16px;
    line-height: 1.3;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.column-post-item h4 a,
.main-news .main-secondary h4 a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.column-post-item:hover a,
.main-news .main-secondary:hover a {
    color: #c33;
}

/* REGRA GERAL QUE LIMITA A DESCRIÇÃO A 2 LINHAS */
.column-post-item p.description,
.main-news .main-secondary p.description {
    font-size: 13px;
    color: #555;
    margin: 0;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.column-post-item .category-info,
.main-news .main-secondary .category-info {
    font-size: 12px;
    color: #666;
    margin-top: auto;
    font-style: italic;
}

.main-news {
    display: flex;
    flex-direction: column;
    gap: 0rem;
}

.main-news .main-highlight {
    background-color: #222;
    border-radius: 10px;
    padding: 20px;
    color: white;
    height: 650px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #e1e1e1;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.main-news .main-highlight:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.main-news .main-highlight h4 a {
    color: #fff;
    font-size: 1.5em;
    text-decoration: none;
}

.main-news .main-highlight .description {
    font-size: 1em;
    line-height: 1.4;
    flex-grow: 1;
    margin: 10px 0;
    overflow: visible;
    max-height: none;
    -webkit-line-clamp: unset;
    text-overflow: clip;
}

.main-news .main-highlight .category-info {
    font-size: 0.9em;
    background-color: #ffffff;
    color: #222;
}

/* ============================= */
/* RODAPÉ */
/* ============================= */
.footer {
    background: #333;
    color: #fff;
    padding: 15px;
    text-align: center;
    font-size: 12px;
    border-top: 3px solid #c33;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ============================= */
/* IMAGEM E DESCRIÇÃO PADRÃO */
/* ============================= */
.post-image {
    width: 100%;
    height: 450px;
    object-fit: cover;
    display: block;
    border-radius: 5px;
}

.description {
    max-height: 3.6em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

/* ============================================== */
/* ELEMENTOS MOBILE (SIDEBAR, OVERLAY, BOTÃO) */
/* ============================================== */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 15px;
}

.sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100%;
    background-color: #333;
    z-index: 1001;
    transition: right 0.3s ease-in-out;
    padding: 20px;
    box-shadow: -5px 0 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-sizing: border-box;
}

.sidebar.open {
    right: 0;
}

.sidebar h3 {
    color: #fff;
    padding-bottom: 5px;
    text-transform: uppercase;
    font-size: 13px;
    font-weight: bold;
    border-bottom: 1px solid #555;
    margin-bottom: 10px;
}

.sidebar h3:first-of-type {
    margin-top: 25px;
}

/* Adiciona espaço entre as secções da sidebar */
.sidebar div + h3 {
    margin-top: 20px;
}

.close-sidebar {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
}

.sidebar-content, 
.sidebar-pages,
.sidebar-main-pages {
    padding: 0;
}

/* Estilo unificado para todos os links da sidebar */
.sidebar-content a, 
.sidebar-pages a,
.sidebar-main-pages a {
    display: block;
    color: #fff;
    text-decoration: none;
    padding: 10px 0;
    font-size: 14px;
    border-bottom: 1px solid #444;
    transition: color 0.2s ease;
}

/* Remove a borda do último link em cada secção */
.sidebar-content a:last-child, 
.sidebar-pages a:last-child,
.sidebar-main-pages a:last-child {
    border-bottom: none;
}

/* Estilo unificado de hover/active */
.sidebar-content a:hover,
.sidebar-content a.active,
.sidebar-pages a:hover,
.sidebar-main-pages a:hover {
    color: #cc3333;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.overlay.active {
    display: block;
}

/* ============================= */
/* LINK EXPANSÍVEL PARA POSTS    */
/* ============================= */
.column-post-item {
    position: relative;
}

.post-link-expansivo::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
}
.column-post-item .category-info {
    align-self: flex-start; 
    margin-top: auto;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-style: italic;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.column-post-item:not(.main-highlight) .category-info {
    background-color: #222;
    color: #fff;
}
.column-post-item:not(.main-highlight):hover .category-info {
    background-color: #c33;
    color: #fff;
}

/* ======================================= */
/* ESTILOS DA SECÇÃO "MAIS POSTS" (DESKTOP) */
/* ======================================= */
.more-posts-section {
    box-sizing: border-box; 
    margin-bottom: 30px;
}

.more-posts-section h3 {
    color: #333;
    margin-top: 0;
    border-bottom: 2px solid #c33;
    padding-bottom: 5px;
    margin-bottom: 20px;
    font-size: 1.2em;
}

.more-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px 15px;
}

.more-posts-grid .column-post-item {
    height: auto;
    margin-bottom: 0;
}

.more-posts-grid .column-post-item .description {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    max-height: none;
}


/* ============================= */
/* RESPONSIVIDADE (MEDIA QUERIES) */
/* ============================= */

/* Ecrãs de Tablet e Telemóvel (até 1024px) */
@media (max-width: 1024px) {
    /* Esconde o layout de topo em tablets e telemóveis */
    .content.two-columns {
        display: none;
    }

    /* Mostra a secção de lista de posts */
    .more-posts-section {
        display: block !important;
        margin-top: 20px;
    }

    /* Regras do menu de navegação para colapsar */
    .nav {
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding: 8px 10px;
        align-items: center;
    }
    .nav > a,
    .nav .dropdown {
        flex-shrink: 0;
        margin-right: 10px;
        white-space: nowrap;
        order: 0;
    }
    .search-container {
        order: 1;
        flex-grow: 1;
        margin: 0 10px;
        max-width: none;
    }
    .search-container input[type="text"] {
        width: 100%;
    }
    .menu-toggle {
        display: block;
        order: 2;
        margin-left: auto;
    }
    .nav-categories {
        display: none;
    }
}

/* Ecrãs Médios (Apenas Tablet: 768px a 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Força a grelha a ter 2 colunas */
    .more-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Ecrãs Pequenos (Apenas Telemóvel: até 767px) */
@media (max-width: 767px) {
    .container {
        padding: 0 10px;
    }

    .header,
    .nav {
        width: calc(100% + 20px);
        margin-left: -10px;
        margin-right: -10px;
    }

    .header, .footer {
        padding: 10px;
    }

    /* Força a grelha a ter 1 coluna */
    .more-posts-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================================== */
/* AVISO DE ORIENTAÇÃO PARA TABLET */
/* ==================================== */
#orientation-warning {
  display: none; /* Escondido por defeito */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  color: #fff;
  z-index: 9999;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 30px;
}

#orientation-warning .warning-content {
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 25px;
  align-items: center;
}

#orientation-warning p {
  font-size: 22px;
  line-height: 1.6;
  font-weight: bold;
}

#orientation-warning button {
  background: #c33;
  color: #fff;
  border: none;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

#orientation-warning button:hover {
  background: #fff;
  color: #000;
}

/* Mostra o aviso apenas em tablets na vertical */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  #orientation-warning {
    display: flex;
  }
}
a, button, input {
  -webkit-tap-highlight-color: transparent;
}