@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;600&display=swap');

/* ============================================================
   RESET E VARIÁVEIS GLOBAIS
   ============================================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --vatican-yellow:     #f4c518;
  --vatican-white:      #fffef3;
  --text-dark:          #333;
  --text-light:         #e0e0e0;
  --border-radius-main: 8px;
  --shadow-light:       0 2px 6px rgba(0, 0, 0, 0.1);

  /* Cores de fundo por categoria de marcação */
  --promessa-bg:  #C8E6C9;
  --ordem-bg:     #E1BEE7;
  --principio-bg: #FFE0B2;
}

/* ============================================================
   BASE — BODY E LAYOUT PRINCIPAL
   ============================================================ */

body {
  font-family: 'Quicksand', sans-serif;
  background-color: var(--vatican-white);
  color: var(--text-dark);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  align-items: stretch;
}

body.night {
  background-color: #121212;
  color: var(--text-light);
}

html {
  /* Evita redimensionamento de fonte em dispositivos móveis */
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

main.container {
  flex: 1;
  width: 100%;
}

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

.hidden {
  display: none !important;
}

h2 {
  color: var(--vatican-yellow);
  margin-bottom: 10px;
  text-align: center;
  font-size: 1.65rem;
}

hr {
  border: none;
  border-top: 1px solid #ccc;
  margin: 30px 0;
}

/* ============================================================
   CABEÇALHO
   ============================================================ */

.header-estudo {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  position: relative;
  min-height: 100px;
  background-color: var(--vatican-yellow);
  border-radius: var(--border-radius-main);
  border: 2px solid #000000;
  padding: 24px 20px 16px;
  margin: 5px 0 30px;
  box-shadow: var(--shadow-light);
  transition: background 0.3s, border-color 0.3s;
  width: 100%;
}

body.night .header-estudo {
  background-color: #1e1e1e;
  border: 2px solid var(--vatican-yellow);
}

/* Título central do header */
.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-center h1 {
  font-size: 2rem;
  margin: 0;
  color: var(--text-dark);
  text-shadow: #ffffff 0px 1px 1px;
}

body.night .header-center h1 {
  color: var(--vatican-yellow);
}

.header-icon-left,
.header-icon-right {
  width: 60px;
  height: 60px;
}

/* Controles do canto direito (tema + logout) */
.header-controls {
  position: absolute;
  right: 20px;
  top: 16px;
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 2;
}

/* Botão de alternância de tema */
.theme-toggle-square {
  width: 50px;
  height: 50px;
  border: none;
  background-color: transparent;
  background-image: url('https://cdn-icons-png.flaticon.com/128/42/42011.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 60%;
  cursor: pointer;
  transition: background-image 0.3s;
}

body.night .theme-toggle-square {
  background-image: url('https://cdn-icons-png.flaticon.com/128/9055/9055356.png');
}

/* Botão de logout */
.logout-btn {
  background: var(--text-dark);
  color: var(--vatican-white);
  border: none;
  padding: 10px;
  border-radius: var(--border-radius-main);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.3s;
}

.logout-btn:hover {
  background: #e1c967;
}

body.night .logout-btn {
  background: var(--vatican-yellow);
  color: #000000;
}

/* Badge de saudação (canto esquerdo) */
.header-saudacao {
  position: absolute;
  left: 10px;
  z-index: 2;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 10px 5px;
  background: var(--text-dark);
  color: #ffffff;
  border-radius: var(--border-radius-main);
  font-size: 0.85rem;
  font-weight: bold;
  width: auto !important;
}

body.night .badge {
  background: var(--vatican-yellow);
  color: #000000;
}

.saudacao-icon {
  width: 25px;
  height: 25px;
}

/* ============================================================
   TÍTULO DO CAPÍTULO
   ============================================================ */

#titulo-capitulo {
  text-align: center;
  margin: 16px 0 12px;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text-dark);
  position: relative;
}

#titulo-capitulo span {
  color: var(--vatican-yellow);
  font-weight: 700;
}

/* Linha decorativa abaixo do título */
#titulo-capitulo::after {
  content: "";
  display: block;
  width: 80px;
  height: 3px;
  background: var(--vatican-yellow);
  margin: 8px auto 0;
  border-radius: 2px;
}

body.night #titulo-capitulo {
  color: var(--vatican-yellow);
}

body.night #titulo-capitulo span {
  color: #fff;
}

body.night #titulo-capitulo::after {
  background: var(--text-light);
}

/* ============================================================
   AUTENTICAÇÃO — LOGIN E CADASTRO
   ============================================================ */

.auth-area {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-bottom: 40px;
}

.auth-area h3 {
  color: var(--vatican-yellow);
  margin-bottom: 12px;
}

.login-box,
.cadastro-box {
  background: var(--vatican-white);
  border: 1px solid #ccc;
  border-radius: var(--border-radius-main);
  padding: 20px;
  width: 100%;
  max-width: 350px;
  box-shadow: var(--shadow-light);
  transition: background 0.3s, border-color 0.3s, color 0.3s;
}

body.night .login-box,
body.night .cadastro-box {
  background: #1c1c1c;
  border-color: var(--vatican-yellow);
  color: var(--text-light);
}

/* ============================================================
   FORMULÁRIOS — LABELS, INPUTS, SELECTS, TEXTAREAS E BOTÕES
   ============================================================ */

label {
  display: block;
  margin-top: 15px;
  font-weight: 900;
  color: #6A1B9A;
}

/* Wrapper para input de senha + botão de mostrar/ocultar */
.senha-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-password {
  width: auto;
  padding: 0 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
}

input,
select,
textarea,
button {
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  font-size: 1rem;
  border-radius: 5px;
  border: 1px solid #ccc;
  background: #fff;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

body.night input,
body.night select,
body.night textarea {
  background: #2c2c2c;
  border-color: #444;
  color: #fff;
}

button {
  background: var(--vatican-yellow);
  color: var(--text-dark);
  border: none;
  cursor: pointer;
  transition: background 0.3s;
}

/* ============================================================
   BUSCA DE VERSÍCULOS
   ============================================================ */

.busca-verse {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  margin: 10px auto;
  max-width: 600px;
}

/* Labels na 1ª linha */
.busca-verse label {
  text-align: center;
  grid-row: 1;
  font-size: large;
  font-weight: bold;
}

/* Inputs na 2ª linha */
.busca-verse input {
  grid-row: 2;
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--vatican-yellow);
  border-radius: 4px;
}

/* Botão buscar: 3ª coluna, 2ª linha */
#buscar-btn {
  grid-column: 3;
  grid-row: 2;
  justify-self: center;
  align-self: center;
  padding: 0.5rem 1rem;
  border: none;
  background-color: var(--vatican-yellow);
  color: var(--text-dark);
  cursor: pointer;
  border-radius: 4px;
}

#buscar-btn .btn-icon {
  width: 20px;
  height: 20px;
}

#buscar-btn:hover {
  background-color: #e1c967;
}

/* ============================================================
   BOTÃO — VER VERSÍCULOS SALVOS
   ============================================================ */

#ver-marcados-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  background-color: var(--vatican-yellow);
  color: #000000;
  cursor: pointer;
}

#ver-marcados-btn .btn-icon {
  width: 20px;
  height: 20px;
}

#ver-marcados-btn:hover {
  background-color: #e1c967;
}

/* ============================================================
   CAIXA DE MARCAÇÃO (SALVAR VERSÍCULOS)
   ============================================================ */

.marcacao-box {
  background: #fff9e6;
  border: 1px solid var(--vatican-yellow);
  border-radius: var(--border-radius-main);
  padding: 20px;
  margin: 20px auto;
  max-width: 600px;
  transition: background 0.3s, border-color 0.3s;
}

.marcacao-box h3 {
  color: #6A1B9A;
  margin-bottom: 12px;
}

body.night .marcacao-box {
  background: #2c2c2c;
  border-color: #999;
}

/* Checkbox de favorito estilizado */
.favorito-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
}

.favorito-label input {
  display: none; /* Esconde o checkbox nativo */
}

.favorito-label .estrela {
  font-size: 18px;
  color: #ccc;
  transition: color 0.2s;
}

.favorito-label input:checked + .estrela {
  color: gold;
  content: "★";
}

/* ============================================================
   GRID DE CARDS DE VERSÍCULOS SALVOS
   ============================================================ */

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

/* Título de livro que separa grupos no grid */
.grid-cards h4 {
  grid-column: 1 / -1;
  border-bottom: 2px solid #ccc;
  padding-bottom: 5px;
  margin-bottom: 10px;
  color: #6A1B9A;
}

/* Card base */
.versiculo-card {
  background: #fff;
  border-radius: var(--border-radius-main);
  padding: 16px;
  box-shadow: var(--shadow-light);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.versiculo-card p {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-dark);
}

body.night .versiculo-card p {
  color: var(--text-light);
}

/* Cores por categoria */
.versiculo-card.promessa {
  background-color: var(--promessa-bg);
  border-left: 4px solid #4CAF50;
}

.versiculo-card.ordem {
  background-color: var(--ordem-bg);
  border-left: 4px solid #6A1B9A;
}

.versiculo-card.principio {
  background-color: var(--principio-bg);
  border-left: 4px solid #F57C00;
}

/* Cores no modo noturno */
body.night .versiculo-card.promessa  { background-color: #2e4731; }
body.night .versiculo-card.ordem     { background-color: #422753; }
body.night .versiculo-card.principio { background-color: #5e4524; }

/* ============================================================
   CARDS — INPUTS E AÇÕES
   ============================================================ */

.versiculo-inputs {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.versiculo-actions {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
  gap: 15px;
}

.group-comment {
  min-height: 80px;
  height: 120px;
  resize: vertical;
  font-size: 1rem;
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
}

/* Botões de ação circulares (editar, salvar, excluir) */
.btn-save,
.btn-delete,
.btn-edit {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-save           { background: #4CAF50; }
.btn-save:hover     { background: #43A047; }
.btn-save img       { width: 16px; height: 16px; filter: invert(1); }

.btn-delete         { background: #E53935; }
.btn-delete:hover   { background: #D32F2F; }
.btn-delete img     { width: 16px; height: 16px; filter: invert(1); }

.btn-edit           { background: #2196F3; }
.btn-edit:hover     { background: #1976D2; }
.btn-edit img       { width: 16px; height: 16px; filter: invert(1); }


/* ============================================================
   LAYOUT DOS VERSÍCULOS (LEITURA)
   ============================================================ */

#versiculos {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.55rem;
}

.versiculo {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  background: #bbbbbc51;
  border-left: 10px solid var(--vatican-yellow);
  border-radius: var(--border-radius-main);
  box-shadow: var(--shadow-light);
  transition: background 0.3s;
  font-weight: bold;
  font-size: large;
}

body.night .versiculo {
  background: #2e2c28;
}

.versiculo-checkbox {
  cursor: pointer;
}

.versiculo-numero {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Número do versículo em círculo amarelo */
.num-versiculo {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1rem;
  color: #fff;
  background: var(--vatican-yellow);
  border-radius: 50%;
  margin-right: 0.55rem;
}

body.night .num-versiculo {
  color: #010101;
}

.versiculo-conteudo {
  flex: 1;
  line-height: 1.6;
  color: var(--text-dark);
}

body.night .versiculo-conteudo {
  color: var(--text-light);
}

/* ============================================================
   RODAPÉ
   ============================================================ */

.rodape {
  width: 100%;
  margin-bottom: 5px;
  background-color: var(--vatican-yellow);
  color: var(--text-dark);
  font-family: 'Quicksand', sans-serif;
  border: 2px solid var(--text-dark);
  border-radius: var(--border-radius-main);
  padding: 1rem;
  text-align: center;
}

body.night .rodape {
  background-color: #1e1e1e;
  border-color: var(--vatican-yellow);
}

.rodape a {
  color: var(--text-dark);
  font-weight: bold;
  text-decoration: underline;
}

body.night .rodape a,
body.night .rodape p {
  color: var(--vatican-yellow);
}

footer#rodape p {
  font-size: clamp(15px, 2.5vw, 15px);
  line-height: 1.0;
  word-break: break-word;
  hyphens: auto;
}

/* ============================================================
   BOTÃO — VOLTAR AO TOPO
   ============================================================ */

#btn-topo {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: var(--vatican-yellow);
  color: #000;
  border: none;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  font-size: 20px;
  cursor: pointer;
  display: none;
  z-index: 999;
}

#btn-topo:hover {
  background: #e1c967;
}

/* ============================================================
   RESPONSIVIDADE — TABLET E SMALL DESKTOP (até 1200px)
   ============================================================ */

@media (max-width: 1200px) {
  .container {
    padding: 0 16px;
  }

  .header-estudo {
    display: grid;
    grid-template-areas:
      "saudacao controles"
      "center   center";
    grid-template-columns: 1fr auto;
    flex-direction: column;
    align-items: center;
    padding: 16px 20px;
    gap: 8px;
    row-gap: 12px;
    margin-bottom: 30px;
  }

  .header-saudacao,
  .header-center,
  .header-controls {
    position: static !important;
    transform: none !important;
    width: 100%;
    display: flex;
    justify-content: flex-end;
    grid-area: controles;
    justify-self: end;
  }

  .header-saudacao {
    justify-content: flex-start;
    grid-area: saudacao;
  }

  .header-center {
    justify-content: center;
    gap: 12px;
    grid-area: center;
    justify-self: center;
  }

  .header-controls .logout-btn {
    width: auto;
    flex: 0 0 auto;
  }
}

/* ============================================================
   RESPONSIVIDADE — MOBILE (até 750px)
   ============================================================ */

@media (max-width: 750px) {
  .container {
    padding: 0 8px;
  }

  h2 {
    font-size: 1rem;
  }

  .header-estudo {
    padding: 16px 8px 10px;
  }

  .header-center h1 {
    font-size: 1.9rem;
    text-align: left;
  }

  .login-box,
  .cadastro-box {
    max-width: 100%;
    padding: 14px;
  }

  .busca-verse {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 6px;
    max-width: 100%;
  }

  .marcacao-box {
    padding: 12px;
    max-width: 100%;
  }

  .grid-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* ============================================================
   RESPONSIVIDADE — DISPOSITIVOS PEQUENOS (até 500px)
   ============================================================ */

@media (max-width: 500px) {
  .header-center h1 {
    font-size: clamp(1.3rem, 5vw, 2.2rem);
  }

  .header-icon-left,
  .header-icon-right {
    width: 40px;
    height: 40px;
  }

  input,
  select,
  textarea,
  button {
    font-size: clamp(1rem, 3.5vw, 1.25rem);
    padding: 0.75rem 1rem;
  }

  .badge {
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    padding: 0.4rem 0.8rem;
  }

  .rodape {
    font-size: clamp(0.8rem, 2.2vw, 1rem);
    padding: 0.75rem 0;
  }

  /* Garante área de toque mínima acessível */
  button,
  .header-icon-left,
  .header-icon-right {
    min-width: 44px;
    min-height: 44px;
  }
}