/* ===== VARIABLES Y RESET (TEMA AZUL) ===== */
:root {
  /* Tema Azul Claro (Modo Claro) */
  --primary-color: #007aff; /* Azul primario brillante */
  --primary-dark: #0056b3; /* Azul oscuro para hover */
  --secondary-color: #5856d6; /* Un morado/azul secundario */
  --accent-color: #ff9500; /* Acento naranja */
  --text-color: #1d1d1f; /* Texto oscuro (casi negro) */
  --text-light: #515154; /* Texto gris */
  --bg-color: #f4f8ff; /* Fondo azul muy claro */
  --bg-card: #ffffff; /* Tarjetas blancas */
  --input-bg: #ffffff; /* Fondo blanco para inputs en modo claro */
  --border-color-light: #e0e8f5; /* Borde azulado claro */
  --delete-color: #ff3b30; /* Color para eliminar */
  --shadow: 0 4px 12px rgba(0, 122, 255, 0.1);
  --shadow-hover: 0 8px 24px rgba(0, 122, 255, 0.15);
  --border-radius: 12px;
  --transition: all 0.3s ease;
}

html[data-theme="dark"] {
  /* Tema Degradado Azul Oscuro (Modo Oscuro) */
  --primary-color: #0a84ff; /* Azul brillante para enlaces */
  --primary-dark: #3498db;
  --secondary-color: #bf5af2; /* Morado/Fucsia para acentos */
  --accent-color: #ff9f0a; /* Acento naranja */
  --text-color: #e6f1ff; /* Texto azul claro */
  --text-light: #a8b2d1; /* Texto azul grisáceo */
  /* ¡Aquí está el degradado! */
  --bg-color-gradient: linear-gradient(180deg, #1d2b4a 0%, #121f3a 100%);
  --bg-card: #1c2a45; /* Tarjetas de azul oscuro (un poco más claro que el fondo) */
  --input-bg: #2c3a58; /* Fondo azulado oscuro para inputs */
  --border-color-light: #3a5078; /* Borde azulado */
  --delete-color: #ff453a; /* Color para eliminar (oscuro) */
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color); /* Fondo sólido por defecto (modo claro) */
  transition: var(--transition);
  min-height: 100vh;
}

/* Aplicar el degradado SOLO en modo oscuro */
html[data-theme="dark"] body {
    background-image: var(--bg-color-gradient);
    background-attachment: fixed; /* Mantiene el degradado fijo */
    background-repeat: no-repeat; /* Evita repetición */
    background-size: cover; /* Asegura que cubra todo */
}


.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== TIPOGRAFÍA ===== */
h1, h2, h3 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding-top: 2rem;
}

h2 {
  font-size: 1.8rem;
  color: var(--primary-color);
  position: relative;
  padding-bottom: 0.5rem;
}

h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(to right, var(--primary-color), var(--accent-color));
  border-radius: 3px;
}

h3 {
  font-size: 1.3rem;
  color: var(--text-color);
}

p {
  margin-bottom: 1rem;
  color: var(--text-light);
}

/* ===== HEADER ===== */
header {
  text-align: center;
  padding: 3rem 0;
  position: relative;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color-light);
}

.header-top {
  position: absolute;
  top: 20px;
  right: 20px;
}

.theme-toggle-btn {
  background: var(--bg-color); /* Usa el fondo del body (puede ser degradado) */
  border: 1px solid var(--border-color-light); /* Borde sutil */
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: var(--transition);
  color: var(--text-color);
}
/* Asegura que el botón use color sólido en modo claro */
html:not([data-theme="dark"]) .theme-toggle-btn {
    background-color: var(--bg-color);
    background-image: none;
}


.theme-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

header > .container > p {
  font-size: 1.1rem;
  max-width: 700px;
  margin: 0 auto 2rem;
  color: var(--text-light);
}

/* ===== SECCIONES DE LOGIN ===== */
.login-section, .welcome-section {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  max-width: 500px;
  margin: 0 auto;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.login-section:hover, .welcome-section:hover {
  box-shadow: var(--shadow-hover);
}

.login-input { display: none; }
.login-section .btn-primary { display: none; }

.login-section p {
    font-size: 1rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    border: 1px solid var(--border-color-light);
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    background-color: var(--bg-card);
    color: var(--text-color);
}

.btn-google:hover {
    /* Fondo ligeramente más claro/oscuro que la tarjeta */
    background-color: var(--bg-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
/* Asegura que el botón use color sólido en modo claro */
html:not([data-theme="dark"]) .btn-google:hover {
    background-color: var(--bg-color);
    background-image: none;
}

.btn-google svg {
    width: 18px;
    height: 18px;
}


/* ===== BOTONES (generales) ===== */
.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px var(--shadow);
}

.btn-secondary {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
  background: rgba(0, 122, 255, 0.1);
}

/* ===== SECCIONES PRINCIPALES ===== */
main {
  padding: 2rem 0;
}

section {
  margin-bottom: 4rem;
}

/* ===== VIDEOS ===== */
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.video-wrapper:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ===== SECCIÓN DE REFLEXIÓN ===== */
.video-card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  transition: var(--transition);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.video-card:hover {
  box-shadow: var(--shadow-hover);
}

.video-card h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--secondary-color);
  margin-bottom: 1rem;
  text-align: center;
}

.reflection-prompt {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  font-style: italic;
  border-left: 4px solid var(--accent-color);
  color: var(--text-light);
  text-align: center;
  margin-top: 2rem;
}

/* ===== SECCIÓN DE OPINIONES ===== */
.opinion-section {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.opinion-textarea {
  width: 100%;
  min-height: 120px;
  padding: 15px;
  margin: 15px 0;
  border: 1px solid var(--border-color-light);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  transition: var(--transition);
  background-color: var(--input-bg); /* <-- CORREGIDO */
  color: var(--text-color);
}

.opinion-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.opinions-list {
  margin-top: 2rem;
}

.opinion-item {
  background-color: var(--bg-card); /* <-- CORREGIDO */
  padding: 1.5rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
  border: 1px solid var(--border-color-light); /* Borde añadido */
}

.opinion-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.opinion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.opinion-author {
  font-weight: 600;
  color: var(--primary-color);
}

.opinion-date {
  color: var(--text-light);
}

.opinion-content {
  color: var(--text-color);
  line-height: 1.5;
  word-wrap: break-word;
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border-color-light);
  background-color: var(--bg-card);
}

.footer-link {
  color: var(--text-light);
  text-decoration: none;
  transition: var(--transition);
}

.footer-link:hover {
  color: var(--primary-color);
}

footer h3 {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ===== ESTILOS PARA LA PÁGINA 404 ===== */
.body-404 {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: var(--bg-color); /* Usa el fondo del body */
}
/* Asegura que el body 404 use color sólido en modo claro */
html:not([data-theme="dark"]) .body-404 {
    background-color: var(--bg-color);
    background-image: none;
}

.container-404 {
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.card-404 {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card-404:hover {
    box-shadow: var(--shadow-hover);
}

.card-404 h1 {
    font-size: 6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding: 0;
}

.card-404 h2 {
    font-size: 1.75rem;
    color: var(--text-color);
    margin-bottom: 1rem;
    padding-bottom: 0;
}

.card-404 h2::after {
    display: none;
}

.card-404 p {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.card-404 .btn-primary {
    width: 100%;
    max-width: 250px;
}

/* ===== UTILIDADES ===== */
.hidden {
  display: none !important;
}

/* ===== ESTILOS DE RESPUESTAS ADAPTADOS ===== */

.opinion-actions {
  margin-top: 15px;
  display: flex;
  gap: 15px;
}

.btn-reply {
  background: none;
  border: none;
  color: var(--primary-color);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 5px 0;
  transition: var(--transition);
}

.btn-reply:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.btn-delete {
  background: none;
  border: none;
  color: var(--delete-color);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 5px 0;
  transition: var(--transition);
}

.btn-delete:hover {
    text-decoration: underline;
}

.btn-delete-reply {
    background: none;
    border: none;
    color: var(--delete-color);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0 5px;
    margin-left: 10px;
    transition: var(--transition);
}

.btn-delete-reply:hover {
    text-decoration: underline;
}


.reply-form {
  margin-top: 15px;
  margin-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reply-textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px;
  border: 1px solid var(--border-color-light);
  border-radius: 8px;
  font-size: 0.95rem;
  resize: vertical;
  background-color: var(--input-bg); /* <-- CORREGIDO */
  color: var(--text-color);
  font-family: inherit;
  transition: var(--transition);
}

.reply-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.reply-form-actions {
  display: flex;
  gap: 10px;
}

.btn-reply-submit, .btn-reply-cancel {
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  font-size: 0.9rem;
  transition: var(--transition);
}

.btn-reply-submit {
  background-color: var(--primary-color);
  color: #ffffff;
}

.btn-reply-submit:hover {
  background-color: var(--primary-dark);
}

.btn-reply-cancel {
  background-color: var(--input-bg); /* <-- CORREGIDO */
  color: var(--text-color);
  border: 1px solid var(--border-color-light);
}

.btn-reply-cancel:hover {
  background-color: var(--border-color-light);
}

.replies-container {
  margin-top: 15px;
  margin-left: 20px;
  padding-left: 20px;
  border-left: 2px solid var(--border-color-light);
}

.reply-item {
  background-color: var(--bg-card); /* <-- CORREGIDO */
  border: 1px solid var(--border-color-light);
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 10px;
  font-size: 0.95rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

/* ===== ESTILOS PARA EDICIÓN DE PERFIL ===== */

.user-actions {
    display: flex;
    gap: 1rem; /* Espacio entre botones */
    margin-top: 1rem;
    margin-bottom: 1rem; /* Espacio antes del texto inferior */
    flex-wrap: wrap; /* Para pantallas pequeñas */
    justify-content: center;
}

.modal {
    position: fixed; /* Se queda fijo en la pantalla */
    z-index: 1000; /* Por encima de todo */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Permite scroll si el contenido es largo */
    background-color: rgba(0, 0, 0, 0.6); /* Fondo semitransparente */
    display: flex; /* Para centrar el contenido */
    align-items: center;
    justify-content: center;
    opacity: 0; /* Empieza oculto */
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    width: 90%;
    max-width: 500px;
    position: relative; /* Para posicionar el botón de cerrar */
    text-align: left; /* Alinea el contenido a la izquierda */
}

.modal-content h2 {
    text-align: center; /* Centra el título */
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}
.modal-content h2::after {
    display: none; /* Sin línea debajo del título del modal */
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    color: var(--text-light);
    font-size: 2rem;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1; /* Alineación vertical */
}

.close-btn:hover,
.close-btn:focus {
    color: var(--text-color);
    text-decoration: none;
}

#profile-form label {
    display: block; /* Etiqueta en su propia línea */
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.modal-input {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color-light);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--input-bg);
    color: var(--text-color);
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

#profile-form .btn-primary {
    width: 100%; /* Ocupa todo el ancho */
}


/* ===== RESPONSIVIDAD ===== */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  .container { padding: 0 15px; }
  header { padding: 2rem 0; }

  .login-section, .welcome-section, .opinion-section {
    padding: 1.5rem;
  }

  .replies-container {
    margin-left: 10px;
    padding-left: 10px;
  }
  .reply-form {
    margin-left: 10px;
  }
}

@media (max-width: 480px) {
  h1 { font-size: 1.8rem; }

  .header-top {
    position: static;
    margin-bottom: 1rem;
    display: flex;
    justify-content: flex-end;
  }

  h1 {
    padding-top: 0;
  }

  .btn-primary, .btn-secondary {
    width: 100%;
    margin-bottom: 10px;
  }

  .btn-google {
    width: 100%;
  }

  /* Ajuste botones de acción de usuario en móvil */
  .user-actions {
      flex-direction: column; /* Botones uno debajo del otro */
  }

  .login-input {
    margin-bottom: 10px;
  }
}
/* ===== ESTILOS ADICIONALES PARA LOGIN ===== */

/* Separador "hr" */
.divider {
    border: none;
    border-top: 1px solid var(--border-color-light);
    margin: 1.5rem 0;
    width: 80%; /* Más corto que el ancho total */
}

/* Inputs específicos para teléfono */
.login-input-phone {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 1rem; /* Espacio antes del botón */
  border: 1px solid var(--border-color-light);
  border-radius: 8px;
  font-size: 1rem;
  transition: var(--transition);
  background: var(--input-bg);
  color: var(--text-color);
}

.login-input-phone:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2); /* Usa el color primario del tema */
}

/* Contenedor invisible para reCAPTCHA */
/* Firebase lo usará para mostrar el widget (a veces invisible) */
#recaptcha-container {
    margin-top: 1rem;
}

/* Mensaje de error */
.error-message {
    color: var(--delete-color); /* Rojo de error */
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Ajustes para los botones en el paso 2 del teléfono */
#phone-form-step2 .btn-primary,
#phone-form-step2 .btn-secondary {
    margin-top: 0.5rem; /* Menos espacio arriba */
}

/* En móvil, asegurar que los inputs y botones ocupen el ancho */
@media (max-width: 480px) {
    .login-input-phone {
        margin-bottom: 10px;
    }
    #phone-form-step1 .btn-primary,
    #phone-form-step2 .btn-primary,
    #phone-form-step2 .btn-secondary {
        width: 100%;
        margin-bottom: 10px;
    }
}