
* {
  box-sizing: content-box;
}

/* Aplicar fuente del sitio solo dentro de appLayout */
#appLayout,
#appLayout * {
  font-family: "pixel", sans-serif;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* LAYOUT PRINCIPAL */
#appLayout {
  display: grid;
  justify-content: center;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 16px;
  padding: 24px;
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* COLUMNA IZQUIERDA */
#leftColumn,
#rightColumn {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

#leftColumn {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* PANEL HORAS */
#hoursPanel {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

#hoursPanel p {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.4;
  word-break: break-word;
}

#hoursPanel input {
  width: 100%;
  font-size: 18px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #ccc;
  max-width: 100%;
}

/* CONTENEDOR GRÁFICO */
#chartContainer {
  background: #ffffff;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.08);
  max-width: 100%;
  overflow: hidden;
}

#tasksChart {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* COLUMNA DERECHA */
#rightColumn {
  padding-top: 8px;
}

#planner {
  max-width: 100%;
  width: 100%;
  min-width: 0;
}

/* MENSAJE TAREA ACTIVA */
#activeTaskLabel {
  margin-bottom: 20px;
  font-style: italic;
  opacity: 0.75;
  font-size: 16px;
}

/* AÑADIR TAREA */
.add-task {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 100%;
}

.add-task input,
.add-task button {
  max-width: 100%;
}

.add-task input {
  flex: 1 1 140px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 16px;
}

.add-task select {
  flex: 0 1 100px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 16px;
}

.add-task button {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 10px;
  border: none;
  background: #b8c7ff;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
  font-size: 16px;
}

.add-task button:hover {
  background: #a0b5ff;
}

/* LISTA TAREAS */
#taskList {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: all 0.2s ease;
  gap: 10px;
  overflow: hidden;
  max-width: 100%;
}

.task.active {
  background: #eef3ff;
  border-left: 4px solid #b8c7ff;
}

.task.completed {
  opacity: 0.5;
}

/* PARTE IZQUIERDA DE LA TAREA */
.task-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  flex: 1 1 auto;
}

.task-dot {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  margin-right: 2px;
}

.task-name {
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 400;
  font-size: 16px;
}

/* PARTE DERECHA DE LA TAREA */
.task-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin-left: auto;
}

/* TEMPORIZADOR */
.timer {
  font-weight: 600;
  font-family: monospace;
  min-width: 58px;
  text-align: right;
  font-size: 15px;
  color: #666;
  flex-shrink: 0;
}

/* BOTONES */
.start-btn,
.delete-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

/* Botón Start/Play - Verde pastel */
.start-btn {
  background: #a8e6cf;
  color: #2d5f4a;
  font-size: 18px;
}

.start-btn:hover {
  background: #8dd9b8;
  transform: scale(1.05);
}

/* Botón Delete/X - Rosa/Rojo pastel */
.delete-btn {
  background: #ffb3ba;
  color: #8b3a3a;
  font-weight: bold;
  font-size: 20px;
  line-height: 1;
}

.delete-btn:hover {
  background: #ff9aa2;
  transform: scale(1.05);
}

/* ========================================
   RESPONSIVE MÓVIL
   ======================================== */
@media (max-width: 780px) {
  #appLayout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 20px;
    padding: 12px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Reordenar elementos en móvil */
  /* 1. Panel de horas (primero) */
  #hoursPanel {
    order: 1;
    padding: 12px;
    width: 100%;
  }

  /* 2. Planner con tareas (segundo) */
  #rightColumn {
    order: 2;
    padding-top: 0;
    width: 100%;
  }

  #planner {
    width: 100%;
  }

  /* 3. Gráfico (último) */
  #chartContainer {
    order: 3;
    padding: 16px;
    width: 100%;
  }

  /* Reorganizar leftColumn para que hoursPanel salga primero */
  #leftColumn {
    display: contents; /* Esto hace que los hijos se comporten como si no existiera el contenedor */
  }

  #hoursPanel p {
    font-size: 13px;
  }

  #hoursPanel input {
    font-size: 15px;
  }

  /* Formulario de añadir tarea en columna */
  .add-task {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .add-task input,
  .add-task select,
  .add-task button {
    width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
  }

  /* Tareas más compactas */
  .task {
    padding: 10px 12px;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .task-right {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }

  .task-name {
    font-size: 14px;
  }

  .timer {
    min-width: 60px;
    font-size: 13px;
  }

  /* Botones más pequeños en móvil */
  .start-btn,
  .delete-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .start-btn {
    font-size: 16px;
  }

  .delete-btn {
    font-size: 18px;
  }

  /* Mensaje de tarea activa */
  #activeTaskLabel {
    font-size: 14px;
    margin-bottom: 16px;
  }

  /* Lista de tareas */
  #taskList {
    width: 100%;
  }
}

/* Para móviles muy pequeños */
@media (max-width: 480px) {
  #appLayout {
    padding: 8px;
  }

  .task {
    flex-wrap: nowrap;
    font-size: 13px;
  }

  .task-dot {
    font-size: 16px;
  }

  .task-name {
    font-size: 13px;
  }

  .timer {
    min-width: 55px;
    font-size: 12px;
  }

  .start-btn,
  .delete-btn {
    width: 30px;
    height: 30px;
  }

  .start-btn {
    font-size: 14px;
  }

  .delete-btn {
    font-size: 16px;
  }
}
