/* ====================== GLOBAL STYLING ====================== */
:root {
  /**** FONTS *****/
  --header-font: 'Playfair Display', serif;
  --paragraph-font: 'Inter', sans-serif;

  /**** COLORS *****/
  --text-color: #ffffff;
  --main-color: #282c34;
  --secondary-color: #ff541d;
  --secondary-hover-color: #9d2700;
  --accent-color: rgba(255, 255, 255, 0.2);
  --background-color: linear-gradient(90deg, #444436 -27.95%, #1a1615 132.36%);
  --border-color: #ccc;

  /**** FONT SIZES *****/
  --h1-size: 67.5pt;
  --h3-size: 30pt;
  --p-size: 18pt;
  --nav-font-size: 13.5pt;
  --button-font-size: 18pt;

  /**** FONT WEIGHTS *****/
  --header-font-weight: 400;
  --paragraph-font-weight: 300;

  /**** MEASUREMENT VALUES *****/
  --nav-height: 10dvh;
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  scroll-behavior: smooth;
}

body {
  font-family: var(--paragraph-font);
  background: var(--background-color);
  background-repeat: no-repeat;
  color: var(--text-color);
  overflow-x: hidden;
  height: 100%;
  min-height: 100vh;
  width: 100dvw;
  position: relative;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--header-font);
  font-weight: var(--header-font-weight);
}

h1 {
  font-size: var(--h1-size);
}

h3 {
  font-size: var(--h3-size);
}

p {
  font-size: var(--p-size);
  font-family: var(--paragraph-font);
  font-weight: var(--paragraph-font-weight);
}

hr {
  color: var(--text-color);
  margin-top: 50px;
}

main {
  /* height: calc(100dvh - var(--nav-height));
  width: 100dvw; */
  overflow: hidden;
}

small {
  display: inline-block;
  white-space: nowrap;
  margin-top: 10px;
}

.cms {
  overflow: auto;
  height: 100dvh;
  /* width: 1600px;
  height: 1104px; */
}

/* ====================== NAVIGATION PAGE ====================== */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--nav-height);
  background-color: var(--main-color);
  padding: 0 20px;
}

/* Special classes used for repositioning the navbar when the user is logged in or not */
.nav-logged-out {
  justify-content: center;
  display: none;
}

.nav-logged-in {
  justify-content: space-between;
}

/* ============ LOGIN/LOGOUT FORM ============ */
.form-login {
  max-width: 400px;
  margin: 100px auto;
  background: var(--main-color);
  padding: 40px 30px;
  border-radius: 20px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  color: var(--text-color);
}

.login-title {
  font-size: var(--h3-size);
  margin-bottom: 30px;
  text-align: center;
  color: var(--secondary-color);
}

.form-group {
  margin-bottom: 25px;
  display: flex;
  flex-direction: column;
}

label {
  margin-bottom: 8px;
  font-size: 1rem;
}

.required {
  color: var(--secondary-color);
  font-weight: bold;
}

input[type='email'],
input[type='password'] {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--accent-color);
  color: var(--text-color);
  font-size: 1rem;
  transition: border-color 0.3s, background-color 0.3s;
}

input[type='email']:focus,
input[type='password']:focus {
  outline: none;
  border-color: var(--secondary-color);
  background-color: rgba(255, 255, 255, 0.1);
}

.btn {
  width: 100%;
  padding: 12px;
  background-color: var(--secondary-color);
  color: var(--text-color);
  font-size: var(--button-font-size);
  font-family: var(--paragraph-font);
  font-weight: bold;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.3s;
  letter-spacing: 1px;
}

.btn:hover {
  background-color: var(--secondary-hover-color);
}

.logout {
  width: unset !important;
  padding: 6px !important;
  font-size: 1rem !important;
  margin-left: 10px;
}

#username {
  color: var(--secondary-color);
  font-weight: bold;
  text-decoration: underline;
}

/* Center - Navigation Menu */
nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 20px;
}

nav ul li {
  display: inline-block;
}

nav ul li a {
  text-decoration: none;
  color: var(--text-color);
  font-size: var(--nav-font-size);
  font-weight: bold;
  padding: 10px 20px;
  border-radius: 5px;
}

nav ul li a:hover {
  background: var(--accent-color);
}

nav ul li a.active {
  background: var(--secondary-color);
  color: var(--text-color);
  border-radius: 5px;
}

/* ====================== TIMELINE CONTAINER ====================== */
.main-timeline-container {
  display: flex;
  /* height: calc(100vh - var(--nav-height));
  width: 100dvw; */
  height: 100dvh;
  background-repeat: no-repeat;
  background-image: url('../Images/Layer1.png');
  background-size: 100% 100%;
}

.timeline-container {
  width: 45%;
  /* border: 5px solid var(--secondary-color); */
  padding: 60px;
  position: relative;
}

.timeline-container h1 {
  font-size: 100pt;
}

.timeline-label {
  font-family: var(--header-font);
  font-size: var(--p-size);
  font-weight: 400;
}

.timeline-year {
  font-family: var(--paragraph-font);
  font-weight: var(--paragraph-font-weight);
  font-size: 14pt;
  margin-left: 0.3em;
}

.timeline-image-container-header {
  margin: 30px 0 30px 0;
  font-size: calc(var(--h1-size) - 45pt);
  color: var(--text-color) !important;
}

.vertical-image-hanging-line {
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  height: 70px;
  background: #fff;
  opacity: 0.5;
  transform: translateX(-50%);
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.timeline-divider {
  width: 100%;
  height: 1px;
  background-color: #ccc;
  border: none;
  margin: 35px 0 10px 0;
}

#timeline-image-container {
  position: relative;
  /* border: 5px solid blue; */
  width: 55%;
  padding: 0px 60px 60px 60px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-direction: column;
  overflow-y: auto;
}

#timeline-image-container img {
  width: 250px;
  height: auto;
  border: 2px solid #fff;
}

#timeline-image-container ul {
  scroll-snap-type: y mandatory;
}

#timeline-image-container li {
  scroll-snap-align: start;
}

/************************** TIMELINE ***********************/
#timeline {
  width: 500px;
  height: auto;
  /* overflow: hidden; */
  /* margin: 40px auto; */
  margin-top: 115px;
  position: relative;
  /* background: url('http://www.csslab.cl/ejemplos/timelinr/latest/images/dot.gif') 3px top repeat-y; */
  /* border: 5px dotted cyan; */
}

#timeline a {
  color: #ffffcc;
  text-decoration: none;
  transition: 0.5s;
}

#timeline a:hover,
#timeline a.selected {
  color: var(--secondary-color);
}

#timeline-header {
  position: absolute;
  width: 209px;
  height: 96px;
  left: 45px;
  top: -35px;
  font-weight: 400;
  font-size: 50pt;
  line-height: 96px;
  color: #ffffff;
  opacity: 0.1;
}

.date-timeline {
  position: absolute;
  left: 2px !important;
  /* width: 1px !important; */
  height: 100% !important;
  /* background: repeating-linear-gradient(to bottom, #fff, #fff 1px, transparent 1px, transparent 4px); */
  z-index: 0 !important;
  transition: border-color 0.5s ease;
  border: none !important;
}

/* .timeline-progress {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background-color: var(--secondary-color);
  transition: width 0.5s ease;
  z-index: -1;
} */

#dates {
  width: auto;
  height: auto;
  /* overflow: hidden; */
}

#dates li {
  position: relative;
  list-style: none;
  /* width: auto;
  height: 100px; */
  line-height: 65px;
  font-size: 24px;
  padding-left: 20px;
  /* background: url('http://www.csslab.cl/ejemplos/timelinr/latest/images/biggerdot.png') left center no-repeat; */
}

#dates li a {
  padding-left: 20px;
}

.timeline-dot {
  position: absolute;
  left: 0px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background-color: white;
  border-radius: 50%;
  z-index: 1;
}

/* only put the first timeline dot on the top */
#dates li:first-of-type .timeline-dot {
  top: 0%;
  transform: translateY(0);
}

.timeline-dot.selected {
  background-color: var(--secondary-color);
}

.timeline-dot.selected::before {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--secondary-color);
  opacity: 0.3;
  z-index: -1;
}

#dates a {
  line-height: var(--h3-size);
  padding-bottom: 10px;
}

#dates a.selected {
  font-size: var(--h3-size);
  color: var(--secondary-color);
  font-weight: bold;
}

#issues {
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  position: relative;
}

#issues li {
  position: relative;
  top: 0;
  left: 0;
  width: 420px;
  max-width: 90vw;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease;
  pointer-events: none;
  text-align: center;
  list-style: none;
}

#issues li.selected {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  position: relative;
}

#issues li.selected img {
  transform: scale(1.1, 1.1);
  z-index: 2;
  position: relative;
}

#issues li img {
  display: block;
  width: 200px;
  max-width: 100%;
  height: auto;
  margin: 70px auto 18px auto;
  border: 2px solid #fff;
  box-sizing: border-box;
  z-index: 3;
  position: relative;
}

#issues li h1 {
  width: 100%;
  margin: 100px 0 18px 0;
  color: var(--secondary-color);
  text-align: center;
  text-shadow: #000 1px 1px 2px;
  word-wrap: break-word;
}

#issues li p {
  padding: 18px 22px;
  /* margin: 39px 0 18px 0; */
  text-shadow: #000 1px 1px 2px;
  /* font-size: calc(var(--p-size) - 3pt); */
  font-size: 14.5pt !important;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
  white-space: normal;
  max-width: 100%;
  width: 100%;
  text-shadow: none;
  overflow: hidden;
  text-align: left;
  margin-left: 0;
  margin-right: 0;
}

#grad_top,
#grad_bottom {
  width: 500px;
  height: 80px;
  position: absolute;
}

#grad_top {
  top: 0;
  /* background: url('http://www.csslab.cl/ejemplos/timelinr/latest/images/grad_top.png') repeat-x; */
}

#grad_bottom {
  bottom: 0;
  /* background: url('http://www.csslab.cl/ejemplos/timelinr/latest/images/grad_bottom.png') repeat-x; */
}

#next,
#prev {
  position: absolute;
  left: 45%;
  /* left: 55%; */
  font-size: 70px;
  width: var(--h3-size);
  height: 22px;
  background-position: 0 -44px;
  background-repeat: no-repeat;
  text-indent: -9999px;
  overflow: hidden;
}

#next:hover,
#prev:hover {
  background-position: 0 0;
}

#next {
  bottom: 0;
  background-image: url('http://www.csslab.cl/ejemplos/timelinr/latest/images/next_v.png');
}

#prev {
  top: 0;
  background-image: url('http://www.csslab.cl/ejemplos/timelinr/latest/images/prev_v.png');
}

#next.disabled,
#prev.disabled {
  opacity: 0.2;
}

/* ====================== ERROR DIALOG ====================== */
#error-dialog {
  position: fixed;
  margin: auto;
  width: 500px;
  padding: 20px;
  background-color: #f44336;
  color: var(--text-color);
  text-align: center;
  border-radius: 16px;
  border: none;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#error-label {
  margin: 0;
  font-size: 1.5rem;
}

#btn-close-dialog {
  margin-top: 15px;
  padding: 8px 16px;
  border: none;
  border-radius: 5px;
  background-color: var(--text-color);
  color: #f44336;
  font-weight: bold;
  cursor: pointer;
  font-family: var(--paragraph-font);
  font-size: var(--button-font-size);
  letter-spacing: 0.2ch;
}

/* ====================== PAGE NOT FOUND ====================== */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: calc(100vh - var(--nav-height));
  text-align: center;
  background-color: var(--background-color);
  padding: 20px;
}

.error-container h1 {
  font-size: 5rem;
  color: var(--secondary-color);
}

.error-container p {
  font-size: 1.5rem;
  color: var(--secondary-color);
  margin-bottom: 25px;
}

.error-container .btn {
  width: 50% !important;
}

/* ====================== CMS GRID STYLING ====================== */
.main-cms-editor-container {
  margin: 20px;
}

.cms-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 columns */
  gap: 20px; /* Space between blocks */
}

.content-block {
  background-color: var(--main-color);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  color: var(--text-color);
}

.content-block label {
  font-weight: bold;
}

textarea,
input[type='text'] {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: var(--accent-color);
  color: var(--text-color);
  font-size: 1rem;
}

textarea:focus,
input[type='text']:focus {
  outline: none;
  border-color: var(--secondary-color);
  background-color: rgba(255, 255, 255, 0.1);
}

button[type='submit'] {
  margin-top: 20px;
  padding: 12px 20px;
  background-color: var(--secondary-color);
  color: var(--text-color);
  font-size: var(--button-font-size);
  font-weight: bold;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.3s;
}

button[type='submit']:hover {
  background-color: var(--secondary-hover-color);
}

/* CMS CATEGORIZATION AND PREVIEW BLOCK STYLING */
.categorized-block {
  padding: 20px;
  background-color: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  margin-bottom: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.block-heading {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--secondary-color);
  margin-bottom: 10px;
  text-transform: uppercase;
  border-left: 4px solid var(--secondary-color);
  padding-left: 10px;
}

.block-meta {
  margin: 15px 0 10px 0;
}

.block-position-input {
  width: 60px;
  padding: 5px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.block-preview {
  margin-bottom: 15px;
}

.preview-content {
  background-color: rgba(255, 255, 255, 0.05);
  padding: 10px;
  border-radius: 8px;
  font-size: var(--p-size);
  max-height: 150px;
  overflow: auto;
  margin-top: 10px;
}

.block-image-preview {
  max-width: 100%;
  height: auto;
  display: block;
  margin-top: 5px;
  border-radius: 8px;
}

.block-id {
  font-size: 0.98em;
  color: #aaa;
  margin-bottom: 10px;
}

/* ====================== CMS HEADER ====================== */
.cms-header {
  font-size: var(--h3-size);
  font-family: var(--header-font);
  color: var(--secondary-color);
  margin: 20px 0 20px 0;
  text-align: center;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* ====================== CMS FORM ====================== */
.cms-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px auto;
  max-width: 400px;
  background-color: var(--main-color);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.cms-form label {
  font-size: 1rem;
  font-weight: bold;
  color: var(--text-color);
  margin-bottom: 10px;
}

.cms-form select {
  padding: 10px;
  font-size: 1rem;
  color: var(--text-color);
  background-color: var(--accent-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: border-color 0.3s, background-color 0.3s;
}

.cms-form select:focus {
  outline: none;
  border-color: var(--secondary-color);
  background-color: rgba(255, 255, 255, 0.1);
}

.cms-form option {
  background-color: var(--main-color);
  color: var(--text-color);
}

/* ====================== CMS FORM BUTTON (submit) ====================== */
.cms-form button[type='submit'] {
  margin-top: 20px;
  padding: 12px 20px;
  background-color: var(--secondary-color);
  color: var(--text-color);
  font-size: var(--button-font-size);
  font-weight: bold;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.cms-form button[type='submit']:hover {
  background-color: var(--secondary-hover-color);
}

/* ====================== CMS FILTER FORM STYLING ====================== */
.cms-filter-form {
  background: rgba(40, 44, 52, 0.97);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  padding: 32px 28px 18px 28px;
  margin: 0 auto 32px auto;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 28px 32px;
  align-items: end;
  /* justify-items: start; */
}

.filter-group {
  display: flex;
  flex-direction: column;
  min-width: 180px;
  margin-bottom: 10px;
}

.filter-group label {
  font-family: var(--header-font);
  font-size: 1.05rem;
  color: var(--secondary-color);
  margin-bottom: 7px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input[type='date'] {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
  background: var(--accent-color);
  color: var(--text-color);
  font-size: 1rem;
  font-family: var(--paragraph-font);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.filter-group option {
  background: #222;
  color: #fff;
}

.filter-group select:focus,
.filter-group input[type='date']:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 2px rgba(255, 84, 29, 0.13);
}

.filter-actions {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-top: 18px;
}

.filter-btn {
  background: var(--secondary-color);
  color: #fff;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  padding: 12px 22px;
  font-size: 1.08rem;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(255, 84, 29, 0.08);
  margin-top: 0 !important;
}

.filter-btn:hover {
  background: var(--secondary-hover-color);
}

.reset-btn {
  background: #888;
  color: #fff;
  font-weight: 500;
  border-radius: 8px;
  padding: 12px 22px;
  font-size: 1.08rem;
  text-decoration: none;
  transition: background 0.2s;
}

.reset-btn:hover {
  background: #555;
}

@media (max-width: 900px) {
  .cms-filter-form {
    padding: 18px 8px 10px 8px;
  }

  .filter-group {
    min-width: unset;
  }
}

@media (max-width: 700px) {
  .filter-row {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  .filter-actions {
    grid-column: auto;
    justify-content: flex-start;
  }
}

/* ====================== CMS USER GUIDE ====================== */
.custom-dialog {
  background-color: var(--main-color);
  color: var(--text-color);
  border-radius: 10px;
  padding: 30px;
  width: 80%;
  max-width: 600px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  position: fixed;
  margin: auto;
}

.cms-user-guide-content h3 {
  font-size: var(--h3-size);
  color: var(--secondary-color);
  margin-bottom: 20px;
  text-align: center;
}

.cms-user-guide-content ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.cms-user-guide-content > ul > li {
  font-size: clamp(1rem, 1.5vw, var(--p-size));
  margin-bottom: 12px;
  line-height: 1.5;
  padding-left: 1rem;
  position: relative;
}

.cms-user-guide-content > ul > li::before {
  content: '\2023'; /* Unicode ‣ */
  color: var(--secondary-color);
  font-weight: bold;
  position: absolute;
  left: 0;
}

.cms-user-guide-content ul ul {
  margin-top: 5px;
  margin-left: 1.5rem;
  list-style: disc;
}

.cms-user-guide-content ul ul li {
  font-size: clamp(0.95rem, 1.4vw, var(--p-size));
  margin-bottom: 8px;
  padding-left: 0.5rem;
  list-style-type: disc;
  color: var(--text-color);
}

.cms-user-guide-content code {
  font-size: 0.95em;
  word-break: break-word;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 4px 6px;
  border-radius: 4px;
  color: red;
}

button#close-guide-btn {
  background-color: var(--secondary-color);
  color: var(--text-color);
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: var(--button-font-size);
  cursor: pointer;
  margin-top: 20px;
  transition: background-color 0.3s ease;
}

button#close-guide-btn:hover {
  background-color: var(--secondary-hover-color);
}

#cms-heading-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.hint-button {
  background-color: #ffeb3b;
  color: #000;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.375rem;
  box-shadow: 0 0 10px #ffeb3b80;
  animation: pulse 2s infinite;
  transition: transform 0.2s, box-shadow 0.3s;
}

.hint-button:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px #ffeb3b;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 10px #ffeb3b80;
  }
  50% {
    box-shadow: 0 0 20px #ffeb3b;
  }
  100% {
    box-shadow: 0 0 10px #ffeb3b80;
  }
}

@media (max-width: 500px) {
  .custom-dialog {
    padding: 20px;
    width: 95%;
  }

  button#close-guide-btn {
    width: 100%;
    font-size: 1rem;
  }
}

.img-shadow {
  position: absolute;
  width: 463px;
  height: 275.5px;
  left: 50%;
  top: -25px;
  background: rgba(255, 255, 255, 0.04);
  filter: blur(38px); /* strong blur for feathered edge */
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%); /* perfect triangle */
  pointer-events: none;
  transform: translateX(-50%);
}

/* ====================== TOOLTIP ====================== */
.tooltip {
  position: absolute;
  background-color: #222;
  color: #fff;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 0.9rem;
  pointer-events: none;
  white-space: nowrap;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.2s ease;
}
