/* Formulário */
form#form-materias {
  max-width: 600px;
  margin: auto;
  font-family: Arial, sans-serif;
}

form#form-materias label {
  display: block;
  margin-top: 15px;
  font-weight: bold;
  color: #004080; /* Azul escuro */
}

/* ------------------------------------------- */
/* ESTILOS PARA OPÇÕES SIM/NÃO (DESTAQUE MOBILE/DESKTOP) */
/* ------------------------------------------- */

.gostou-sim-nao-group {
  display: flex; 
  gap: 20px; 
  margin-top: 10px;
  flex-wrap: wrap; 
}

.gostou-option {
  display: flex; 
  align-items: center;
  cursor: pointer;
  padding: 10px 15px; 
  border: 2px solid #ccc; 
  border-radius: 8px; 
  transition: background-color 0.3s, border-color 0.3s;
  user-select: none; 
  width: auto; 
}

.gostou-option:hover {
  background-color: #f0f0f0;
}

.gostou-option img {
  width: 25px; 
  height: 25px;
  margin-right: 8px; 
}

/* ESTILO DE DESTAQUE (SIM - VERDE) GERENCIADO POR JAVASCRIPT */
.selecionado-sim {
  border-color: #4CAF50 !important; 
  background-color: #e6ffe6 !important; 
  color: #4CAF50 !important; 
  font-weight: bold !important;
  box-shadow: 0 0 5px rgba(76, 175, 80, 0.5); 
}

/* ESTILO DE DESTAQUE (NÃO - VERMELHO) GERENCIADO POR JAVASCRIPT */
.selecionado-nao {
  border-color: #D32F2F !important; 
  background-color: #ffe6e6 !important; 
  color: #D32F2F !important; 
  font-weight: bold !important;
  box-shadow: 0 0 5px rgba(211, 47, 47, 0.5); 
}

/* FIM ESTILOS SIM/NÃO */

/* ------------------------------------------- */

form#form-materias input,
form#form-materias select,
form#form-materias textarea,
form#form-materias button {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  box-sizing: border-box;
}

#contador {
  text-align: right;
  font-size: 12px;
  color: #666;
}

form#form-materias button {
  border: none;
  margin-top: 20px;
  cursor: pointer;
  background-color: #4CAF50;
  color: white;
  padding: 12px;
  font-size: 16px;
  border-radius: 5px;
}

form#form-materias button:hover {
  background-color: #45a049;
}

/* Estilo geral da página */
body {
  font-family: Arial, sans-serif;
  background: #f0f0f0;
  margin: 20px;
  padding: 0;
  color: #333;
}

h1, h2 { 
  text-align: center;
  color: #333;
}

/* ------------------------------------------- */
/* REGRAS DA TABELA (FORMATAÇÃO BASE) */
/* ------------------------------------------- */

table#tabela-materias {
  border-collapse: collapse;
  max-width: 1000px;
  margin: 20px auto;
  background: #fff;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  font-family: Arial, sans-serif;
}

#tabela-materias th {
  background-color: #4CAF50;
  color: white; 
  font-weight: bold;
  padding: 10px 15px;
  text-align: center; 
}

#tabela-materias td {
  background-color: #ffffff;
  border: 1px solid #ccc;
  padding: 10px 15px;
  text-align: left;
  color: #333;
}

/* Estilo para a mensagem de orientação (Agora visível, sem borda) */
#aviso-orientacao {
  display: none; /* Garante que o aviso seja visível */
  text-align: center; /* Centraliza o texto */
  padding: 10px;
  margin: 10px auto; /* CENTRALIZA O BLOCO */
  max-width: 600px;
  background-color: transparent; /* Fundo transparente */
  color: #856404; /* Cor do texto */
  border: none; /* Remove a borda */
}

/* Centraliza o conteúdo da segunda coluna (onde está Gostou?) */
#tabela-materias td:nth-child(2) {
  text-align: center;
}

/* LARGURA: Ajusta as colunas 2, 4 e 5 para o tamanho do conteúdo (Funciona no PC) */
#tabela-materias td:nth-child(2),
#tabela-materias th:nth-child(2),
#tabela-materias td:nth-child(4),
#tabela-materias th:nth-child(4),
#tabela-materias td:nth-child(5),
#tabela-materias th:nth-child(5) {
  width: 1px; 
  white-space: nowrap; 
}

#tabela-materias
tr:nth-child(even) {
  background-color: #f9f9f9;
}

#tabela-materias tr:hover {
  background-color: #d1e7dd;
}

/* ------------------------------------------- */
/* CORREÇÃO PARA ÍCONE FIXO "VOLTAR AO TOPO" (Versão Desktop) */
/* ------------------------------------------- */

.icone-voltar-topo {
  position: fixed; 
  bottom: 20px;    
  right: 20px;     
  z-index: 9999;
}

/* --- Seção de Responsividade --- */

/* MODO MOBILE GERAL: Telas menores que 1000px (para a tabela ficar responsiva) */
@media screen and (max-width: 1000px) { 
  .table-container {
    overflow-x: auto;
  }

  table {
    width: 100%;
    min-width: 600px;
    margin: 20px 0;
  }
}

/* MODO RETRATO ESPECÍFICO: Telas pequenas E orientação RETRATO (Onde esconde colunas e mostra mensagem) */
@media screen and (max-width: 600px) and (orientation: portrait) {
  /* 1. MOSTRAR A MENSAGEM */
  #aviso-orientacao {
    display: block;
    /* Garantindo centralização total no modo retrato */
    width: 90%; /* Ajusta a largura para 90% da tela */
    margin-left: auto;
    margin-right: auto;
    text-align: center; 
  }

  /* 2. ESCONDER AS COLUNAS 3, 4 e 5 (Descrição, Data, Hora) */
  #tabela-materias th:nth-child(3),
  #tabela-materias td:nth-child(3),
  #tabela-materias th:nth-child(4),
  #tabela-materias td:nth-child(4),
  #tabela-materias th:nth-child(5),
  #tabela-materias td:nth-child(5) {
    display: none !important; 
  }

  /* 3. Ajusta a largura da tabela para o espaço disponível */
  table#tabela-materias {
    max-width: 100%;
    min-width: unset; /* Remove o min-width para caber na tela pequena */
  }

  /* 4. CORREÇÃO DE LARGURA: Garante que as colunas 1 e 2 usem a largura total */
  #tabela-materias th:nth-child(1),
  #tabela-materias td:nth-child(1) {
    width: 70% !important; /* Nome pode ocupar mais espaço */
    white-space: normal !important; 
  }

  #tabela-materias th:nth-child(2),
  #tabela-materias td:nth-child(2) {
    width: 30% !important; /* Gostou? é pequeno */
    white-space: nowrap !important;
  }

  /* 5. CORREÇÃO DE FORÇA TOTAL PARA O ÍCONE FIXO */
  .icone-voltar-topo {
    position: fixed !important; 
    bottom: 20px !important;    
    right: 20px !important;     
    z-index: 9999 !important;   
    transform: translateZ(0); 
  }

  /* Ajustes móveis gerais */
  form#form-materias input,
  form#form-materias textarea,
  form#form-materias button {
    width: 100%;
    margin-bottom: 15px;
  }

  .gostou-sim-nao-group {
    flex-direction: column; 
    gap: 10px;
  }

  .gostou-option {
    width: 100%; 
    box-sizing: border-box;
    text-align: center;
    justify-content: center; 
  }
}

/* Remover a linha de rodapé */
footer {
  display: none !important;
}

/* Caso a linha seja uma borda no final do conteúdo */
body {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* Remover a borda inferior da tabela */
#tabela-materias {
  border-bottom: none !important;
}
