/* ------------------------------------------------------
   Cozy, Elegant & Professional Theme
------------------------------------------------------ */
:root {
  /* Palette */
  --main-color: #00575b;        /* deep, elegant teal */
  --accent-color: #04848b;      /* lighter, warm teal accent */
  --light-bg: #f5f5f3;          /* soft cool background */
  --card-bg: #ffffff;           /* pure card background */
  --border-color: #d1d5da;      /* subtle border shade */
  --text-dark: #333333;         /* strong, legible text */
  --text-light: #444444;       /* secondary text */
  --radius: 8px;                /* gentle rounding */
  --transition: 0.25s ease;
  --font-base: Arial, Helvetica, sans-serif;
  --font-heading: Arial, Helvetica, sans-serif;
  --font-size-base: 1rem;       /* 16px */
  --line-height: 1.7;
  --accent2: #cbb69f;
  --shadow-light: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Global Reset & Typography */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  background: var(--light-bg);
  color: var(--text-dark);
  font-family: var(--font-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  /* padding: 2rem; */
  transition: background var(--transition);
}
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--main-color);
  margin-bottom: 1rem;
  line-height: 1.3;
}
input, select, textarea {
  resize: none;
}

a {
  text-decoration: none;
  color: #cbb69f;
}

/* ==== INTRO ==== */
#introScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:  var(--light-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 1s ease, transform 1s ease;
}

#introLogo {
  max-width: 300px;
  width: 80%;
  height: auto;
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.4));
  transition: transform 1s ease, opacity 1s ease;
}

#introScreen.hide {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.2);
}




/* Header */
header {
  position: relative;
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
}

.description {
  font-size: 1rem;
  color: #555;
  margin: 2rem auto 0 auto;
  max-width: 350px;
  font-weight: 400;
  line-height: 1.4;
}


.title-container {
  display: flex;
  justify-content: center; /* Centra el conjunto imagen + texto */
  align-items: center;     /* Alinea verticalmente */
  gap: -50px;               /* Espacio entre imagen y texto */
  margin-top: 2rem;        /* Para mantener margen superior */
  margin-bottom: -2rem;
}

.logo {
  width: 75px;
  height: 75px;
  object-fit: contain;
}

.title-container h1 {
  margin-top: 2rem;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

a:hover { color: var(--accent2); }

/* Navigation */
.main-menu ul {
  list-style: none;
  display: inline-flex;
  gap: 2rem;
}
.main-menu a {
  font-weight: 600;
  color: var(--text-dark);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}
.main-menu a:hover,
.main-menu a:focus {
  background: var(--accent-color);
  color: #fff;
}

/* Containers */
.question-form {
  max-width: 800px;
  margin: 0 auto 2rem;
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-light);
  animation: fadeIn 0.6s var(--transition);
}

.question-list  {
  max-width: 1000px;
  margin: 0 auto 2rem;
  padding: 2rem;
  border-radius: var(--radius);
}

/* Form Elements */
label {
  display: block;
  margin-top: 1.5rem;
  font-weight: 600;
  color: var(--text-dark);
}
input, select, textarea {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--main-color);
  box-shadow: 0 0 0 3px rgba(0, 87, 91, 0.2);
  outline: none;
}
button {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  background: var(--main-color);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform 0.15s;
}
button:hover {
  /* background: var(--accent-color); */
  transform: translateY(-2px);
}

/* Question Cards */
.question-card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-light);
  padding: 1.5rem;
  margin-bottom: 2rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border-color);
  animation: fadeInUp 0.5s ease forwards;
}

.question-card:hover {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
}


/* Espaciado entre múltiples preguntas */
.question-card + .question-card {
  border-top: none;
}



/* Cabecera de la pregunta */
.question-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Avatar */
.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--main-color);
}

/* Info del usuario y categoría */
.question-info {
  flex-grow: 1;
}

.question-category {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--main-color);
  background-color: #e8f6f6;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 0.25rem;
}

/* Texto de la pregunta */
.question-text {
  font-size: 1.05rem;
  color: var(--text-dark);
  line-height: 1.6;
  margin-top: 0.3rem;
}

/* Bloque para las respuestas existentes */
.answers-container {
  margin-top: 1.5rem;
}

.answer-item {
  background-color: #f6f9f9;
  border-left: 4px solid var(--main-color);
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--text-dark);
  line-height: 1.6;
  transition: background-color 0.3s ease;
}

.answer-item + .answer-item {
  border-top: 1px dashed #ccc;
  padding-top: 1rem;
}

.no-answers {
  font-style: italic;
  color: var(--text-light);
  margin-top: 0.5rem;
}

.answer-block button,
.question-form button {
  background: linear-gradient(135deg, var(--main-color), var(--accent-color));
  border: 2px solid var(--main-color);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 24px;
  font-weight: 600;
}

.edit-container {
  display: flex;
  align-items: stretch; /* <-- Alineación perfecta con el input */
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.answer-item {
  display: flex;
  align-items: flex-start;
  background-color: #f6f9f9;
  border: 1px solid var(--main-color);
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--text-dark);
  line-height: 1.4;
  transition: background-color 0.3s ease;
  gap: 12px; /* espacio entre avatar, texto y botón */
  position: relative;
}

/* Avatar */
.answer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

/* Texto de la respuesta */
.editing-input {
  flex-grow: 1;
  white-space: pre-wrap;
  margin: 0;
  user-select: text;
}

/* Botón eliminar */
.answer-item .icon-btn.delete {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #b00;
  transition: color 0.3s ease;
  flex-shrink: 0;
}

.answer-item .icon-btn.delete:hover {
  color: #800;
}

.icon-btn {
  background-color: #f5f5f5;
  border: none;
  border-radius: 6px;
  padding: 0.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
  width: 32px;
  height: 32px;
}

.icon-btn:hover {
  background-color: #e0e0e0;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  color: #333;
}

.icon-btn.delete {
  width: 48px;    /* Más ancho */
  height: 48px;   /* Más alto */
  padding: 0.5rem; /* Opcional, ajusta espacio interno */
  background-color: #ffeaea;
} 

.icon-btn.delete:hover {
  background-color: #ffd6d6;
}

.icon-btn.delete svg {
  width: 28px;    /* Más grande el icono */
  height: 28px;
  color: #d32f2f;
}


/* Footer */
footer {
  background: #004144 url('data:image/svg+xml;utf8,<svg…media-luna…opacity=0.1…/>') no-repeat center;
  color: #ddd;
  padding: 2rem;
  text-align: center;
  width: 100%;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
  header h1 { font-size: 2rem; }
  .main-menu ul { flex-direction: column; gap: 1rem; }
  .question-text { font-size: 1rem; }
  .answers-container { padding-left: 0.75rem; }
}


.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  background-color: var(--main-color);
  border-radius: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  max-width: 900px;
  margin: 2rem auto;
  font-family: 'Lora', serif;
  border: 1px solid #e1e1e1;
}

.filter-bar input,
.filter-bar select,
.filter-bar button {
  height: 44px;
  padding: 0 1rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-family: 'Lora', serif;
  box-sizing: border-box;
}

.filter-bar input,
.filter-bar select {
  background-color: #e8f6f6;
  min-width: 180px;
  flex: 1;
}

.filter-bar input:focus,
.filter-bar select:focus {
  outline: none;
  border-color: #007B7F;
  box-shadow: 0 0 6px rgba(0, 123, 127, 0.2);
}

.filter-bar button {
  margin-top: 0.5rem;
  background-color: #e8f6f6;
  color: var(--main-color);
  border: none;
  cursor: pointer;
  min-width: 120px;
  flex-shrink: 0;
  transition: background-color 0.3s ease;
}

.filter-bar button:hover {
  border: #fff;
}


@media (max-width: 768px) {
  /* Texto del encabezado */
  header h1 {
    font-size: 1.75rem;
    margin-top: 1.5rem;
    padding: 0 1rem; /* evita que toque los bordes */
  }

  .description {
    font-size: 0.9rem;
    max-width: 90vw; /* Que ocupe casi todo el ancho de pantalla */
  }

  /* Menú principal */
  .main-menu ul {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 1rem;
    margin-top: 1rem;
  }
  .main-menu a {
    padding: 0.6rem 1rem;
    display: block;
    text-align: center;
  }

  /* Formularios y contenedores */
  .question-form,
  .question-list,
  .filter-bar {
    padding: 1.25rem 1rem;
    margin: 1.5rem 1rem;
    width: auto;        /* que no haya ancho fijo */
    max-width: 100%;    /* que ocupe todo el ancho posible */
    box-sizing: border-box;
  }

  /* Tarjetas de preguntas */
  .question-card {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    width: auto;
    max-width: 100%;
  }

  /* Cabecera de la pregunta */
  .question-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* Texto de preguntas */
  .question-text {
    font-size: 1rem;
  }

  /* Contenedor de respuestas */
  .answers-container {
    padding-left: 0;
  }

  /* Items de respuesta */
  .answer-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
  }

  /* Input para editar respuesta */
  .editing-input {
    font-size: 0.95rem;
  }

  /* Contenedor de edición */
  .edit-container {
    flex-direction: column;
    gap: 0.5rem;
  }

  /* Botón borrar respuesta */
  .icon-btn.delete {
    align-self: flex-end;
  }

  /* Barra de filtro */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .filter-bar input,
  .filter-bar select,
  .filter-bar button {
    width: 100%;
    min-width: unset;
    padding: 10px;
  }

  /* Footer */
  footer {
    padding: 1.5rem 1rem;
    font-size: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    word-break: break-word;
  }
  footer a {
    font-size: 0.95rem;
    text-align: center;
  }
}
