/* RESET BÁSICO */
* {
  margin: 0; 
  padding: 0; 
  box-sizing: border-box;
}
body {
  font-family: Arial, sans-serif;
  background: #f8f8f8;
  height: 100vh;
  overflow: hidden; /* Para ocultar scroll de la ventana principal */
  position: relative;
}
h1 {
  text-align: center;
  margin: 10px 0;
  font-family: 'Trebuchet MS', sans-serif;
}

/* BOTONES SUPERIORES */
#filters-panel {
  color: #8e8e8e;
  width: 100%;
  margin: 0px;
  padding: 0px 10px 10px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 1rem;
  justify-content: center;
  position: relative;
  flex-wrap: wrap;
  z-index: 100;
  box-shadow: 0 6px 5px rgba(0,0,0,0.4);
}

/* Botones de Expandir/Reducir */
#expand-btn, #reduce-btn {
  background: #333;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  padding: 6px 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  user-select: none;
}
#expand-btn:hover,
#reduce-btn:hover {
  filter: brightness(1.2);
}
#expand-btn {
  margin: 0px 30px 0px 0px;
}

/* Botón descarga */
#download-btn {
  background: #333;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  padding: 6px 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  user-select: none;
  margin-left: 60px;
}
#edit-btn {
  background: #d6d6d6;
  color: #111111;
  border-radius: 4px;
  cursor: pointer;
  padding: 6px 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  user-select: none;
  margin-left: 10px;
}
#download-btn:hover,
#edit-btn:hover {
  filter: brightness(1.2);
}

/* BOTONES DE FILTRO */
.filter-button {
  font-size: 1em;
  display: inline-block;
  padding: 6px 10px;
  border-radius: 4px;
  color: #424242;
  cursor: pointer;
  filter: opacity(0.30);
  user-select: none;
  margin: 5px 3px;
}
.filter-button.active {
  filter: saturate(1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.filter-button:hover {
  filter: brightness(1.1);
}

/* CONTENEDOR PRINCIPAL */
#timeline-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 100px);
  overflow: hidden;
  cursor: grab;
}

/* Contenedor interno con scroll horizontal */
#timeline-content {
  position: relative;
  min-height: 100%;
  background: url('img/fondo-tiled.png') repeat;
}

/* LÍNEA PRINCIPAL */
#timeline-line {
  position: absolute;
  top: 55px;
  left: 0;
  height: 5px;
  background: #5a5a5a;
  z-index: 1;
}
/* Flecha a la derecha (futuro) */
@keyframes moverDerecha {
  from { left: 0px; }
  to   { left: 100%; }
}
#future-arrow {
  position: absolute;
  top: 43px;
  width: 0;
  height: 0;
  border-top: 14px solid transparent;
  border-bottom: 16px solid transparent;
  border-left: 25px solid #444;
  z-index: 1;
  animation: moverDerecha 0.9s linear;
}

/* MARCAS DE AÑO */
.u-year-mark {
  position: absolute;
  width: 2px;
  height: 100%;
  background: rgba(0, 0, 0, 0.025);
  z-index: 0;
  top: 0;
}
.year-mark {
  position: absolute;
  width: 2px;
  height: 100%;
  background: rgba(0,0,0,0.15);
  z-index: 0;
  top: 0;
}
.year-label {
  position: absolute;
  top: 13px;
  font-weight: bold;
  color: #444;
  font-size: 1.8rem;
  transform: translateX(-50%);
  z-index: 2;
}

/* PUNTO DEL MILESTONE */
.milestone-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  z-index: 3;
  top: calc(55px - 6px);
}

/* TARJETA DEL MILESTONE */
.milestone-card {
  position: absolute;
  width: 300px;
  padding: 10px 15px;
  border-radius: 8px;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.3);
  color: #000;
  font-size: 0.9rem;
  z-index: 5;
  opacity: 0; /* Para que empiece invisible (fadeIn) */
}
.milestone-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.0), rgba(0, 0, 0, 0.1));
  border-radius: 8px;
  pointer-events: none;
}
.milestone-card h3 {
  display: flex;
  text-align: center;
  align-items: center;
  margin-bottom: 5px;
  font-size: 1.05rem;
  color: #161616;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}
.milestone-card p {
  margin-bottom: 5px;
  line-height: 1.3rem;
  color: #313131;
}
.milestone-card a {
  color: #000;
  text-decoration: underline;
}
.year-card {
  font-size: 1.6em;
  font-weight: 300;
  color: #4d4d4d;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

/* ANIMACIÓN SLIDE */
.animate-slide {
  transition: top 0.4s ease-in-out, opacity 0.4s ease-in-out;
}

/* CONECTOR ENTRE PUNTO Y TARJETA */
.connector-line {
  position: absolute;
  width: 3px;
  z-index: 2;
  opacity: 0; /* Aparece tras la transición */
}

/* TIPOS 1-20 (colores) */
.type-1  { background: #7facdc; }
.type-2  { background: #ffe760; }
.type-3  { background: #ff6b6c; }
.type-4  { background: #5be27f; }
.type-5  { background: #c08dec; }
.type-6  { background: #ffac80; }
.type-7  { background: #81c3d7; }
.type-8  { background: #ff7bbd; }
.type-9  { background: #d2f89a; }
.type-10 { background: #cd9161; }
.type-11 { background: #16bac5; }
.type-12 { background: #9f86c0; }
.type-13 { background: #ef7b45; }
.type-14 { background: #b8f2e6; }
.type-15 { background: #ffbc42; }
.type-16 { background: #d81159; }
.type-17 { background: #8f2d56; }
.type-18 { background: #218380; }
.type-19 { background: #73d2de; }
.type-20 { background: #ff784f; }

/* Al ocultar por filtro */
.hidden {
  display: none !important;
}

/* COPYRIGHT */
#copyright {
  position: absolute;
  left: 20px;
  top: 70px;
  transform: rotate(90deg);
  transform-origin: left center;
  font-size: 1rem;
  color: #899a9e;
}

/* POPUP EDIT DATA */
#edit-popup-overlay {
  display: none;
  position: fixed;
  top: 0; 
  left: 0; 
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.4);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}
#edit-popup {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  width: 95%;
  max-width: 95%;
  height: 80%;
  box-shadow: 0 3px 6px rgba(0,0,0,0.5);
}
#edit-popup textarea {
  width: 100%;
  height: 80%;
  box-sizing: border-box;
}
#popup-btns {
  margin-top: 10px;
  text-align: right;
}
#popup-btns button {
  background: #333;
  color: #fff;
  border: none;
  padding: 8px 12px;
  margin-left: 10px;
  border-radius: 4px;
  cursor: pointer;
}
#popup-btns button:hover {
  filter: brightness(1.2);
}
