/* DEFINICIÓN DE VARIABLES CSS RAÍZ */
:root {
  --romu-bg: #FAF8F3;
  --romu-primario: #1B4B43;
  --romu-primario-dark: #123832;
  --romu-acento: #E3A008;
  --romu-texto: #2B2620;
  --romu-superficie: #FFFFFF;
  --romu-borde-suave: #E8E2D5;
  --romu-estado-pendiente: #94A3B8;
  --romu-estado-progreso: #E3A008;
  --romu-estado-completada: #1B4B43;
  --romu-estado-vencida: #C0392B;
  
  --font-heading: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* RESET BASE & TIPOGRAFÍA GLOBAL */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--romu-bg);
  color: var(--romu-texto);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 75px; /* Espacio para el bottom nav en móvil */
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--romu-primario);
  font-weight: 700;
  line-height: 1.25;
}

/* LAYOUT ESTRUCTURAL MOBILE-FIRST */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: 1rem;
  max-width: 100%;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.header-title h1 {
  font-size: 1.5rem;
  color: var(--romu-primario);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-title p {
  font-size: 0.875rem;
  color: var(--romu-texto);
  opacity: 0.8;
  margin-top: 0.15rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* BOTTOM NAV NAVEGACIÓN MÓVIL: Barra fija inferior tipo app nativa (Instagram/WhatsApp) con z-index elevado */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  background-color: var(--romu-primario);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
  padding: 0 0.5rem;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 600;
  gap: 0.15rem;
  padding: 0.25rem;
  flex: 1;
  text-align: center;
  transition: color 0.15s ease;
}

.bottom-nav-item .nav-icon {
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
  color: var(--romu-acento);
}

.bottom-nav-item.nav-logout-item {
  color: #ff8a80;
}

.bottom-nav-item.nav-logout-item:hover {
  color: #ff5252;
}

.desktop-sidebar {
  display: none;
}

/* CARDS CON SOMBRA EN 2 CAPAS Y BORDES */
.romu-card {
  background-color: var(--romu-superficie);
  border-radius: 14px;
  border: 1px solid var(--romu-borde-suave);
  box-shadow: 0 4px 20px -2px rgba(43, 38, 32, 0.05), 0 2px 6px -1px rgba(43, 38, 32, 0.08);
  padding: 1.15rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.romu-card:hover {
  box-shadow: 0 8px 24px -2px rgba(43, 38, 32, 0.08), 0 4px 10px -2px rgba(43, 38, 32, 0.1);
}

/* Bordes de estado para tarjetas de tareas */
.card-pendiente { border-left: 4px solid var(--romu-estado-pendiente); }
.card-en_progreso { border-left: 4px solid var(--romu-estado-progreso); }
.card-pendiente_revision { border-left: 4px solid var(--romu-acento); }
.card-rechazada { border-left: 4px solid var(--romu-estado-vencida); }
.card-completada { border-left: 4px solid var(--romu-estado-completada); }
.card-vencida { border-left: 4px solid var(--romu-estado-vencida); }

/* BOTONES ROBUSTOS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background-color: var(--romu-primario);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--romu-primario-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(27, 75, 67, 0.25);
}

.btn-accent {
  background-color: var(--romu-acento);
  color: var(--romu-texto);
}

.btn-accent:hover {
  background-color: #c98e07;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(227, 160, 8, 0.3);
}

.btn-secondary {
  background-color: var(--romu-superficie);
  color: var(--romu-texto);
  border: 1px solid var(--romu-borde-suave);
}

.btn-secondary:hover {
  background-color: #f3efe6;
  border-color: #d1c9b8;
  transform: translateY(-1px);
}

.btn-danger {
  background-color: var(--romu-estado-vencida);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #a02e22;
  transform: translateY(-1px);
}

/* CHIPS DE INTEGRANTES FAMILIARES */
.family-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--romu-texto);
  background-color: #f1ede4;
  padding: 0.25rem 0.6rem 0.25rem 0.35rem;
  border-radius: 20px;
  border: 1px solid var(--romu-borde-suave);
}

.avatar-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: var(--romu-primario);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.mono-time {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
}

/* FORMULARIOS MOBILE-FIRST */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--romu-texto);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid var(--romu-borde-suave);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--romu-texto);
  background-color: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--romu-primario);
  box-shadow: 0 0 0 3px rgba(27, 75, 67, 0.15);
}

/* TABLERO KANBAN & ACCORDEONES EN MÓVIL */
.kanban-board {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

details.kanban-col {
  background: #f3efe6;
  border-radius: 14px;
  border: 1px solid var(--romu-borde-suave);
  padding: 0.875rem 1rem;
  transition: background-color 0.2s ease;
}

details.kanban-col summary.col-header {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

details.kanban-col summary.col-header::-webkit-details-marker {
  display: none;
}

details.kanban-col summary.col-header h3 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-heading);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

details.kanban-col summary.col-header h3::after {
  content: '▾';
  font-size: 0.8rem;
  margin-left: 0.3rem;
  transition: transform 0.2s ease;
  color: var(--romu-primario);
}

details.kanban-col[open] summary.col-header h3::after {
  transform: rotate(180deg);
}

details.kanban-col[open] summary.col-header {
  padding-bottom: 0.75rem;
  margin-bottom: 0.875rem;
  border-bottom: 2px solid var(--romu-borde-suave);
}

.col-count {
  background-color: var(--romu-superficie);
  color: var(--romu-texto);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 12px;
  border: 1px solid var(--romu-borde-suave);
}

.task-card {
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
}

.task-title {
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--romu-texto);
  margin-bottom: 0.35rem;
}

.task-desc {
  font-size: 0.85rem;
  color: var(--romu-texto);
  opacity: 0.85;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.task-info-extra {
  font-size: 0.75rem;
  color: var(--romu-texto);
  opacity: 0.75;
  margin-bottom: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.correction-note {
  background-color: #fee2e2;
  border-left: 3px solid var(--romu-estado-vencida);
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: var(--romu-texto);
  margin-bottom: 0.65rem;
}

.btn-full {
  width: 100%;
}

.empty-text {
  text-align: center;
  color: var(--romu-texto);
  opacity: 0.6;
  font-size: 0.85rem;
  padding: 0.75rem 0;
}

/* LOGIN LAYOUT Y PANEL VERDE */
body.login-page {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background-color: var(--romu-bg);
}

.login-bg-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40vh;
  background: linear-gradient(135deg, var(--romu-primario) 0%, var(--romu-primario-dark) 100%);
  z-index: 1;
}

.login-card-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  padding: 1.25rem;
}

.login-card {
  width: 100%;
  padding: 2.25rem 1.75rem;
}

/* TOAST / SNACKBAR DE NOTIFICACIONES */
.romu-toast {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  background-color: var(--romu-estado-completada, #1B4B43);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: romuToastFade 3s forwards;
}

@keyframes romuToastFade {
  0% { opacity: 0; transform: translateY(-10px); }
  10% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); visibility: hidden; }
}

.push-denied-text {
  font-size: 0.75rem;
  color: var(--romu-estado-vencida, #C0392B);
  opacity: 0.9;
  font-weight: 500;
  display: block;
  margin-top: 0.25rem;
}

/* BREAKPOINT PRINCIPAL 768px: Transición de layout móvil app-like a layout desktop con sidebar */
@media (min-width: 768px) {
  body {
    padding-bottom: 0;
  }

  .bottom-nav {
    display: none;
  }

  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    background-color: var(--romu-primario);
    color: #ffffff;
    padding: 1.5rem 1.15rem;
    z-index: 100;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.08);
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  .sidebar-brand svg {
    width: 32px;
    height: 32px;
    fill: var(--romu-acento);
  }

  .sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
  }

  .sidebar-menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.75rem 0.875rem;
    border-radius: 10px;
    transition: all 0.15s ease;
  }

  .sidebar-menu-link:hover,
  .sidebar-menu-link.active {
    background-color: rgba(255, 255, 255, 0.12);
    color: var(--romu-acento);
  }

  .sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
  }

  .sidebar-user {
    margin-bottom: 0.875rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
  }

  .main-content {
    margin-left: 240px;
    padding: 2rem 2.25rem;
  }

  .header-title h1 {
    font-size: 1.85rem;
  }

  .kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.15rem;
  }

  details.kanban-col {
    min-height: 420px;
    padding: 1.15rem;
  }

  details.kanban-col summary.col-header {
    cursor: default;
    border-bottom: 2px solid var(--romu-borde-suave);
    padding-bottom: 0.5rem;
    margin-bottom: 1.15rem;
  }

  details.kanban-col summary.col-header h3::after {
    display: none;
  }
}
