@import "modal.css";

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

:root {
  --primary-color: #007bff; /* Blue for CTAs, links, selected states */
  --secondary-color: #333; /* Dark grey for main headings */
  --text-color: #333; /* General text color */
  --text-color-light: #666; /* Lighter text color for paragraphs */
  --background-color: #f4f4f4; /* Body background */
  --background-color-dark: #222; /* Sidebar background, or dark card background */
  --card-bg-color: #fff; /* Card background */
  --border-color: #ccc; /* General border color */
  --hover-color: #444; /* Hover state for dark elements */
  --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Soft shadow */
  --box-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.12); /* More pronounced shadow on hover */
}

body {
    background-color: #f4f4f4;
    min-height: 100vh;
    zoom: 0.9;
}

/* Classe específica para o corpo da página de login */
.login-page-body {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* --- Sidebar --- */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.sidebar {
    width: 250px;
    background-color: #222;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    position: fixed;
    height: 100%;
    z-index: 1000; /* Explicitly set z-index for clarity and control */
}

.sidebar .logo {
  text-align: center;
  margin-bottom: 40px;
}

.sidebar .logo img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
}

.sidebar .logo h1 {
  font-size: 18px;
  margin-top: 10px;
}

.sidebar nav ul {
    list-style: none;
    width: 100%;
}

.sidebar nav ul li {
    width: 100%;
}

.sidebar nav ul li a {
  display: block;
  padding: 15px 20px;
  color: white;
  text-decoration: none;
  transition: background 0.3s;
}

.sidebar nav ul li a:hover {
    background-color: #444;
}

/* --- Main content --- */
.main-content {
    width: calc(100% - 250px); /* Adjust width to account for sidebar */
    margin-left: 250px; /* Add margin to push content past the fixed sidebar */
    padding: 20px;
}

/* --- Topbar --- */
.topbar {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 10px 20px;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  gap: 12px;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #333;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
}

.menu-toggle:hover,
.menu-toggle:focus {
    background-color: rgba(0, 0, 0, 0.05);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.welcome-flash {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #1f7a1f, #2ecc71);
    color: #fff;
    padding: 8px 12px;
    border-radius: 999px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
    font-weight: 600;
    font-size: 0.95rem;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.welcome-flash.fade-out {
    opacity: 0;
    transform: translateY(-8px);
}

.welcome-message--hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
    width: 300px; /* opcional — define a largura total */
}

.search-bar input {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
    outline: none;
    flex: 1;
    height: 36px; /* altura fixa para alinhar */
}

/* botão */
.search-bar button {
    position: relative;
    width: 40px; /* largura mais equilibrada */
    height: 36px; /* igual à altura do input */
    border: none;
    background-color: #333;
    color: white;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0; /* remove espaçamento extra */
}

/* ícone por cima do botão */
.search-bar button i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%); /* sobe ligeiramente */
    font-size: 16px; /* menor tamanho da lupa */
    color: white;
    pointer-events: none; /* o clique ainda acerta no botão */
}

body.fade-in {
  opacity: 1;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: flex-end;
    min-width: fit-content;
}

.user-actions a {
    display: inline-flex; /* Makes padding and width/height apply */
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 5px; /* Slightly rounded corners */
    font-weight: bold;
    transition: all 0.3s ease; /* Smooth transition for hover effects */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
}

/* Styles for "Perfil" and "Sair" (Logout) buttons when logged in */
.user-actions a[href="perfil.php"],
.user-actions a[href="logout.php"],
.user-actions a[href="meus-planos.php"],
.user-actions a[href="index.php"] {
    background-color: #007bff; /* Primary blue */
    color: white;
    border: 1px solid #007bff;
}

.user-actions a[href="perfil.php"]:hover,
.user-actions a[href="logout.php"]:hover,
.user-actions a[href="index.php"]:hover {
    background-color: #0056b3; /* Darker blue on hover */
    border-color: #0056b3;
    transform: translateY(-1px); /* Slight lift */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Styles for "Registe-se" and "Iniciar Sessão" (Login) buttons when logged out */
/* Assuming 'user-action' class is still used for these */
.user-actions a.user-action {
    background-color: #28a745; /* Success green */
    color: white;
    border: 1px solid #28a745;
}

.user-actions a.user-action:hover {
    background-color: #218838; /* Darker green on hover */
    border-color: #218838;
    transform: translateY(-1px); /* Slight lift */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.user-actions a.user-action i {
    margin-right: 5px; /* Space for icon */
}
/* --- Page content --- */
.page-content {
  margin-top: 30px;
  /* O fundo branco foi removido para um look mais clean. Cada secção terá o seu próprio estilo. */
}

/* --- Formulário de Perfil --- */
.profile-form {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 500px; /* Limita a largura do formulário */
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 5px;
  font-weight: bold;
  color: #555;
}

.form-group input {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 16px;
}

.btn-save {
  padding: 12px 20px;
  background-color: #222;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
  align-self: flex-start; /* Alinha o botão à esquerda */
}

.btn-save:hover {
  background-color: #444;
}

/* --- Menu Dropdown do Utilizador --- */
.user-dropdown {
  position: relative;
  display: inline-block;
}

.user-menu-button {
  background-color: transparent;
  border: none;
  color: #333;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background-color: white;
  min-width: 140px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
  border-radius: 5px;
  overflow: hidden; /* Garante que os cantos dos links ficam arredondados */
}

.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  transition: background-color 0.2s;
}

.dropdown-content a:hover { background-color: #f1f1f1; }

.show { display: block; }

/* --- Banner da Página Inicial (Estilo Equilibrado) --- */
.welcome-banner {
    background-image: url('../imgs/index.png');
    background-size: cover;
    background-position: center;
    color: #fff;
    padding: 80px 40px;
    border-radius: 12px;
    margin-bottom: 80px;
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.45), rgba(20, 20, 20, 0.40));
    pointer-events: none;
    z-index: 1;
}

.welcome-banner-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    text-align: center;
}

.welcome-banner-image {
    display: none;
}

.welcome-banner-text {
    flex: 1 1 100%;
    text-align: center;
}

.welcome-banner-text {
    flex: 1 1 100%;
    text-align: center;
}

.welcome-banner h1 {
    font-size: 3rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.welcome-banner p {
    font-size: 1.1rem;
    color: #f0f0f0;
    max-width: 600px;
    margin: 0 auto 30px auto;
}

/* Estilo para os botões de chamada de ação principais (e.g., no banner, nos cartões de nutrição) */
.welcome-banner .cta-button, .diet-card-content .cta-button {
    background-color: #007bff;
    color: #fff;
    padding: 14px 28px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    border: none; /* Garante que não há borda por defeito */
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.welcome-banner .cta-button:hover, .diet-card-content .cta-button:hover {
    background-color: #0056b3; /* Cor mais escura no hover */
}

.quick-access h2, .featured-article h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2rem;
    color: #333;
}

.card-container {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    flex-wrap: wrap;
}

.card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Sombra suave para profundidade */
    padding: 30px;
    text-align: center;
    width: 30%;
    min-width: 280px;
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* Transição suave */
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12); /* Sombra mais pronunciada no hover */
}

.card i {
    font-size: 3rem;
    color: #007bff;
    margin-bottom: 20px;
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.card p {
    font-size: 1rem;
    color: #666;
    margin-bottom: 20px;
}

.card a {
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
}

.featured-article {
    margin-top: 80px;
}

.article-preview {
    display: flex;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    overflow: hidden; /* Garante que os cantos arredondados sejam aplicados aos filhos */
}

.article-image {
    width: 40%;
    background-image: url('../imgs/artigo-destaque.jpg');
    background-size: cover;
    background-position: center;
    min-height: 250px; /* Garante uma altura mínima para a imagem */
}

.article-preview .article-content {
    padding: 30px;
    width: 60%;
}

.article-preview h3 {
    font-size: 1.8rem;
    margin-top: 0;
}

/* --- Página de Planos --- */
.plans-intro {
    background-image: url('../imgs/planos.png');
    background-size: cover;
    background-position: center;
    color: #fff;
    padding: 80px 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 60px;
    position: relative;
    overflow: hidden;
}

.plans-intro::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.45), rgba(20, 20, 20, 0.40));
    pointer-events: none;
    z-index: 1;
}

.plans-intro h1 {
    font-size: 2.8rem;
    margin-bottom: 15px;
    font-weight: 600;
    position: relative;
    z-index: 2;
}

.plans-intro p {
    color: #f0f0f0; /* Cor ligeiramente mais suave para o parágrafo */
    position: relative;
    z-index: 2;
}

/* --- Dropdown da Sidebar --- */
.nav-item-dropdown {
    position: relative;
}

.nav-item-dropdown .nav-link {
    width: calc(100% - 40px); /* Deixa espaço para a seta */
}

.dropdown-arrow {
    position: absolute;
    right: 15px;
    top: 16px;
    color: white;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.dropdown-arrow.open {
    transform: rotate(180deg);
}

.dropdown-content-sidebar {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background-color: #1c1c1c; /* Um pouco mais escuro que o fundo do item */
}

.dropdown-content-sidebar li a {
    padding-left: 40px; /* Indentação para o item do submenu */
    background-color: #333;
    font-size: 0.9em;
}

/* --- Página de Exercícios --- */
.exercises-intro {
    background-image: url('../imgs/exercicios.png');
    background-size: cover;
    background-position: center;
    color: #fff;
    padding: 80px 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.exercises-intro::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.45), rgba(20, 20, 20, 0.40));
    pointer-events: none;
    z-index: 1;
}

.exercises-intro h1 {
    font-size: 2.8rem;
    margin-bottom: 15px;
    font-weight: 600;
    position: relative;
    z-index: 2;
}

.exercises-intro p {
    color: #fff;
    position: relative;
    z-index: 2;
}

/* --- Página de Artigos --- */
.articles-intro {
    background-image: url('../imgs/artigos.png');
    background-size: cover;
    background-position: center;
    color: #fff;
    padding: 80px 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 60px;
    position: relative;
    overflow: hidden;
}

.articles-intro::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.45), rgba(20, 20, 20, 0.40));
    pointer-events: none;
    z-index: 1;
}

.articles-intro h1 {
    font-size: 2.8rem;
    margin-bottom: 15px;
    font-weight: 600;
    line-height: 1.2;
    word-break: break-word;
    position: relative;
    z-index: 2;
}

.articles-intro p {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    line-height: 1.5;
    word-break: break-word;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.article-card {
    background-color: var(--card-bg-color);
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--box-shadow-hover);
}

.article-card-image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
}

.article-card-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.article-category {
    display: inline-block;
    background-color: #e7f1ff;
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    margin-bottom: 15px;
    align-self: flex-start;
}

.article-card-content a.btn-read-more {
    margin-top: auto; /* Empurra o botão para o fundo do cartão */
    align-self: flex-start; /* Alinha o botão à esquerda */
}

.article-card-content h3 {
    font-size: 1.4rem; /* Tamanho ajustado para os títulos */
    font-weight: 600; /* Mais negrito */
    color: var(--secondary-color); /* Cor principal para títulos */
    margin-bottom: 10px; /* Adiciona espaço entre o título e a descrição */
}

.article-card-content p {
    margin-bottom: 20px; /* Adiciona espaço entre a descrição e o botão */
    font-size: 1.05rem; /* Descrição ligeiramente maior */
    line-height: 1.6; /* Melhora a legibilidade */
}


/* Botão genérico para "Ler Mais" / "Ler Artigo" */
.btn-read-more {
    display: inline-block;
    margin-top: 15px;
    text-decoration: none;
    color: #fff;
    background-color: var(--primary-color);
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-read-more:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

/* --- Página de Artigo Individual --- */
.article-full-content {
    max-width: 800px;
    margin: 0 auto;
    background-color: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
}

.article-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.article-header h1 {
    font-size: 2.5rem;
    color: var(--secondary-color);
    line-height: 1.2;
}

.article-meta {
    margin-top: 15px;
    color: var(--text-color-light);
    font-size: 0.9em;
}

.article-main-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 30px;
}

.article-full-content h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-top: 40px;
    margin-bottom: 15px;
}

.article-full-content p, .article-full-content ul {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-color);
    margin-bottom: 20px;
}

.article-full-content ul {
    padding-left: 25px;
}

/* Estilo para blockquotes dentro dos artigos */
.article-full-content blockquote { /* Citação em Destaque (Pull Quote) */
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-color);
    text-align: center;
    margin: 40px auto;
    max-width: 80%;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    padding: 20px 0;
}

.article-full-content p,
.article-full-content li {
    text-align: justify; /* Justifica o texto em todos os parágrafos e itens de lista */
}

/* --- ESTRUTURAS DE ARTIGOS ÚNICAS --- */

/* Artigo Erros Treino: Layout de Cartões Numerados */
.error-card {
    display: flex;
    align-items: flex-start; /* Alinha o número com o topo do texto */
    gap: 25px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
}
.error-number {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 0.8; /* Ajusta a altura da linha para melhor alinhamento */
}
.error-content h2 {
    margin-top: 0;
}
.error-content h3 { /* Adicionado para dar espaço entre o título e o parágrafo */
    margin-bottom: 10px;
    margin-top: 0;
}

/* Artigo Proteína: Layout Clássico com Citação Central */
.protein-article .pull-quote {
    font-size: 1.5rem;
    font-style: italic;
    text-align: center;
    margin: 40px auto;
    padding: 20px;
    max-width: 75%;
    border-left: 4px solid var(--primary-color);
    background-color: #f8f9fa;
}
 .protein-article .food-list {
    list-style-position: inside;
}

.protein-article .food-list li:not(:last-child) {
    margin-bottom: 10px; /* Adiciona um pequeno espaço entre os itens da lista */
}

/* Artigo Descanso: Layout com Ícones e Colunas */
.recovery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}
.recovery-point h3 {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    line-height: 1.3;
}
.recovery-point h3 i {
    font-size: 1.8rem;
    color: var(--primary-color);
    flex-shrink: 0;
}
.recovery-point p {
    padding-left: 43px; /* Alinha o parágrafo com o texto do título */
    line-height: 1.6;
}

@media (max-width: 768px) {
    .recovery-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .recovery-point h3 {
        align-items: flex-start;
    }

    .recovery-point p {
        padding-left: 0;
        margin-top: 8px;
    }
}
/* Artigo Cardio vs Musculação: Layout de Comparação Lado a Lado */
.comparison-layout {
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    gap: 30px;
    align-items: start;
    margin: 30px 0;
}
.comparison-divider {
    width: 1px;
    background-color: var(--border-color);
    height: 100%;
}
.comparison-column h2 {
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

@media (max-width: 768px) {
    .comparison-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .comparison-divider {
        display: none;
    }

    .comparison-column h2 {
        font-size: 1.6rem;
    }
}
/* Artigo Mentalidade: Layout de Lista de Passos */
.mindset-step {
    position: relative;
    padding-left: 40px;
    margin-bottom: 30px;
}
.mindset-step::before {
    content: counter(step-counter);
    counter-increment: step-counter;
    position: absolute;
    left: 0;
    top: -5px;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}
.article-full-content.mindset-article {
    counter-reset: step-counter;
}
.mindset-step h3 + p {
    margin-top: 10px; /* Adiciona espaço ACIMA do parágrafo, separando-o do título */
}


/* Artigo Suplementos: Layout de Tabela Informativa */
.supplement-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
    margin-bottom: 60px; /* Adiciona espaçamento extra abaixo da tabela */
}
.supplement-table th,
.supplement-table td {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 15px;
    text-align: left;
}
.supplement-table th {
    background-color: var(--secondary-color);
    color: white;
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
}
.supplement-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Separador genérico */
.stylish-hr {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0));
    margin: 50px 0;
}

/* --- Media Queries para Layout Responsivo --- */
@media (max-width: 768px) {
    .articles-intro {
        padding: 40px 16px;
        margin-bottom: 30px;
    }

    .articles-intro h1 {
        font-size: 2rem;
        line-height: 1.15;
    }

    .articles-intro p {
        font-size: 0.95rem;
    }

    /* --- Sidebar --- */
    .sidebar-overlay {
        display: block;
    }

    .sidebar {
        position: fixed; /* Fica fixa na tela */
        left: 0;
        top: 0;
        height: 100%;
        width: 250px;
        transform: translateX(-100%);
        z-index: 1000; /* Garante que fica por cima do outro conteúdo */
        transition: transform 0.3s ease; /* Animação suave ao aparecer/desaparecer */
        background-color: #222;
    }

    .sidebar.active {
        transform: translateX(0); /* Mostra a sidebar quando tem a classe 'active' */
    }

    .sidebar nav {
        width: 100%;
        overflow-y: auto;
        max-height: calc(100vh - 120px);
        padding-bottom: 20px;
    }

    /* --- Main Content --- */
    .main-content {
        margin-left: 0; /* Remove a margem esquerda para ocupar todo o espaço */
        width: 100%;
        position: relative;
    }

    /* --- Topbar --- */
    .menu-toggle {
        display: block; /* Mostra o botão hambúrguer */
        font-size: 24px;
        color: #333; /* Ajuste a cor conforme o seu design */
        margin-right: 0;
    }

    .topbar {
        padding: 10px 12px;
        gap: 10px;
        width: 100%;
        justify-content: flex-start;
        align-items: center;
        flex-wrap: wrap;
    }

    .topbar > * {
        min-width: 0;
    }

    .welcome-message {
        order: 2;
        width: auto;
        flex: 1;
        text-align: right;
        min-width: 0;
    }

    .welcome-message span {
        display: inline-block;
        width: 100%;
        font-size: 0.9rem;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .user-actions {
        order: 3;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .user-actions a {
        width: 100%;
        text-align: center;
        margin-left: 0;
        font-size: 0.9rem;
        padding: 10px 8px;
    }

    .search-bar {
        flex-grow: 1; /* Permite que a barra de pesquisa cresça */
        width: auto; /* Remove a largura fixa para se adaptar */
        min-width: 100px; /* Define uma largura mínima para não desaparecer */
    }

    /* --- Page Content --- */
    .card-container {
        flex-direction: column; /* Empilha os cartões verticalmente */
        align-items: center;
    }

    .card {
        width: 90%; /* Ajusta a largura dos cartões */
        max-width: 520px;
        margin-bottom: 20px;
    }

    .article-preview {
        flex-direction: column; /* Empilha a imagem e o texto do artigo */
    }

    .article-preview .article-content {
        width: 100%;
    }

    .article-preview img,
    .article-image {
        width: 100%;
        margin-bottom: 15px;
    }

    .welcome-banner {
        padding: 40px 20px;
        margin-bottom: 40px;
    }

    .welcome-banner h1 {
        font-size: 2rem;
    }

    .welcome-banner p {
        font-size: 1rem;
        max-width: 100%;
    }
}

/* Esconde o botão hambúrguer apenas em ecrãs maiores */
@media (min-width: 769px) {
    .menu-toggle {
        display: none;
    }
}

/* =================================== ESTILOS PÁGINA SOBRE =================================== */

.sobre-container {
    padding: 25px 30px;
    background-color: #fff;
    border-radius: 12px;
    margin: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: box-shadow 0.3s ease-in-out;
}

.sobre-container:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.sobre-container h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 15px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
    display: inline-block;
}

.sobre-container h2 {
    font-size: 1.8rem;
    color: #34495e;
    margin-top: 40px;
    margin-bottom: 20px;
}

.sobre-container p {
    line-height: 1.7;
    color: #555;
}

/* --- Estilos do Formulário de Contacto --- */
.contact-form {
    display: flex;
    flex-direction: column;
    max-width: 600px; /* Limita a largura do formulário */
}

.form-group {
    margin-bottom: 20px;
}

.contact-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    transition: color 0.3s;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 1rem;
    background-color: #f8f9fa;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.contact-form button {
    padding: 12px 25px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
    align-self: flex-start; /* Alinha o botão à esquerda */
}

.contact-form button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

.contact-form button:active {
    transform: translateY(0);
    box-shadow: none;
}

/* --- Message Status (Success/Error) --- */
.form-status-message {
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 15px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.form-status-message.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-status-message.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* =================================== ESTILOS PÁGINA VER PLANO =================================== */
.ver-plano-container {
    padding: 30px;
    background-color: var(--card-bg-color);
    border-radius: 12px;
    margin: 20px auto; /* Centered with auto margins, some margin from sides */
    max-width: 900px; /* Limit width for better readability */
    box-shadow: var(--box-shadow);
    transition: box-shadow 0.3s ease-in-out;
}

.ver-plano-container:hover {
    box-shadow: var(--box-shadow-hover);
}

.ver-plano-container h1 {
    font-size: 2.5rem; /* Slightly larger title */
    color: var(--secondary-color);
    margin-bottom: 10px; /* Reduced margin */
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    display: inline-block; /* Makes border-bottom only as wide as the text */
}

.ver-plano-container p {
    font-size: 1.05rem; /* Slightly smaller and more readable */
    color: var(--text-color-light);
    margin-bottom: 15px; /* Increased margin for better separation */
}

.plan-meta {
    margin-bottom: 10px;
}

.plan-meta p {
    margin-bottom: 0;
}

.plan-empty-msg {
    color: var(--text-color-light);
    text-align: center;
    padding: 18px 0;
}

.page-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

.ver-plano-container .message {
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
}

.ver-plano-container .message.error {
    background-color: #f8d7da; /* Light red */
    color: #721c24; /* Dark red */
    border: 1px solid #f5c6cb;
}

.ver-plano-container .delete-btn {
    background-color: #dc3545; /* Red for delete action */
    color: white;
    padding: 12px 25px; /* Slightly larger padding */
    border: none;
    border-radius: 8px; /* More rounded corners */
    cursor: pointer;
    font-size: 1.05rem; /* Slightly larger font */
    font-weight: 600;
    margin-top: 25px; /* Increased margin */
    margin-bottom: 35px; /* Increased margin */
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Subtle shadow */
}

.ver-plano-container .delete-btn:hover {
    background-color: #c82333; /* Darker red on hover */
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15); /* More pronounced shadow */
}

.ver-plano-container .exercise-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); /* Subtle shadow for the table */
    border-radius: 8px; /* Rounded corners for the entire table */
    overflow: hidden; /* Ensures rounded corners are applied */
}

.ver-plano-container .exercise-table th,
.ver-plano-container .exercise-table td {
    padding: 18px 15px; /* Increased vertical padding */
    text-align: left;
    border-bottom: 1px solid #e0e0e0; /* Lighter, more subtle border */
}

.ver-plano-container .exercise-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.95em; /* Slightly larger font */
    border-bottom: 2px solid #0056b3; /* Darker primary color for bottom border */
}

.ver-plano-container .exercise-table tbody tr:nth-child(even) {
    background-color: #f8f9fa; /* Lighter background for even rows */
}

.ver-plano-container .exercise-table tbody tr:hover {
    background-color: #e6f7ff; /* Lighter blue on hover for better contrast */
    cursor: pointer; /* Indicate interactivity */
}

.ver-plano-container .exercise-table td a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.ver-plano-container .exercise-table td a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Style for the "Voltar para Meus Planos" link (now button-like) */
.ver-plano-container .back-to-plans,
.main-content > p > .back-to-plans { /* Target both cases */
    display: inline-block;
    margin-top: 30px;
    padding: 12px 25px;
    background-color: var(--primary-color); /* Changed to primary color for more prominence */
    color: white;
    text-decoration: none;
    border-radius: 8px; /* Rounded corners */
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Subtle shadow */
}


/* For the parent paragraph of the back-to-plans button that is NOT inside ver-plano-container */
.main-content > p:last-child {
    text-align: center; /* Center the button at the very bottom */
}

.ver-plano-container .back-to-plans:hover,
.main-content > p > .back-to-plans:hover {
    background-color: #0056b3; /* Darker blue on hover */
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15); /* More pronounced shadow */
}

/* Responsive adjustments for tables */
@media (max-width: 768px) {
    .ver-plano-container {
        padding: 20px 12px;
    }

    .ver-plano-container h1 {
        font-size: 1.8rem;
        text-align: center;
    }

    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ver-plano-container .exercise-table {
        min-width: 520px;
        display: table;
        width: 100%;
        white-space: normal;
    }

    .ver-plano-container .exercise-table th,
    .ver-plano-container .exercise-table td {
        padding: 12px 10px;
    }

    .page-actions {
        justify-content: center;
    }

    .ver-plano-container .back-to-plans {
        width: 100%;
        text-align: center;
    }
}
.admin-menu-link {
    background-color: #007bff;;
    color: #fff;
    border: 1px solid #007bff;;
    font-weight: 700;
}

.admin-menu-link:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}