body {
    font-family: Arial, sans-serif;
    background-color: #daf9e0;
    padding: 25px;
    left: 35px;
    margin: 0;
}

.timeline {
    position: relative;
    top: 0px; /* Position the timeline 15px from the top of the screen */
    padding-bottom: 0.1px;
    width: 4100px; /* Set the width of the timeline */
    margin-bottom: 10px;
}

.region {
    border-style: solid;
    border-width: 0.2px;
    border-color: rgb(235, 146, 146);
    top: 0px; /* between top of Region and timeline */
    padding-left: 15px;
    padding-top: 0px;
    padding-bottom: 6px; /*between bottom Area and bottom Region */
    padding-right: 15px;
    margin-top: 5px;/* between top Region and item above */
    margin-bottom: 15px;
    position: relative;
    font-size: 9.5px;
    height: auto;
}
.region h2 {
    margin-top: 7px; /* between Region name and the top of the container */
    line-height: 1.2; /* Adjust line height if needed to bring the text closer */
    position: relative;
    top: 0px;
    left: -8px;
    z-index: 2;
}

.area {
    border-style: dotted;
    border-width: 0.01px;
    border-color: #ababe9; 
    height: auto;   
    top: -8px; /*between top of Area and top of Region */
    padding-left: 10px;
    padding-top: 0px; /* between Area name and the top of the container */
    padding-bottom: 0px;
    margin-top: 10px; /* between Area container and the Area above */
    position: relative;
    font-size: 12px;
}
.area h3 {
    margin-top: 0px; /* Reduce the margin at the top of the title */
    padding-top: 5px; /* Remove any padding at the top of the title */
    line-height: 1.2; /* Adjust line height if needed to bring the text closer */
    position: relative; /* Make the header absolute */
    top: 0px; /* Position at the very top of the Area */
    left: 0px; /* Adjust left position if needed */
    z-index: 2; /* Ensure the header is above the rows */
}

[data-region="europe"][data-area="history and trends"] {
    background-image: url('https://res.cloudinary.com/dev6urqir/image/upload/v1735743671/Europe_History_6_dflsk3.jpg');
    background-size: cover;
    background-position: center;
    background-size: auto; /* Keep the original size of the image */
    background-repeat: repeat; /* Repeat the image to cover the container */
    background-position: top left; /* Align the image to the top-left corner */
}

.row {
    height: 63px;
    position: relative;
    top: -8px; /* Make sure rows start from the top */
}

.area .box {
    background: none; /* Ensure the boxes don’t inherit the area’s background */
    position: relative; /* Keep relative positioning for proper placement */
}

.box {
    position: relative;
    border-radius: 8px;
    top: -55px;
    height: 48px;
    padding: 6px; /* If you change this value, remember to adapt the boxes width in the js code, that is set 2xPadding shorter than my excel, to offset the padding*/
    margin-top: 0px;
    overflow: hidden;
    font-size: 9px;
}

.box .box-title {
    font-weight: bold; /* Make the title bold */
    cursor: pointer;
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden; /* Hide overflow content */
    text-overflow: ellipsis; /* Show ellipsis for overflowing text */
    display: block; /* Ensure proper layout for text truncation */
}

.box .box-date {
    font-style: italic; /* Make the date italic */
}

.box span, .box a {
    z-index: 2;
    position: relative;
}

.custom-tooltip {
    position: fixed; /* Absolute position relative to the box */
    background-color: black;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 10px;
    white-space: pre-wrap; /* Enable line breaks in tooltip */
    z-index: 99999; /* Ensure tooltip is above other elements */
    visibility: hidden; /* Hide tooltip initially */
    opacity: 0; /* Start invisible */
    transition: opacity 0.1s ease-in-out; /* Smooth appearance */
    width: auto; /* Dynamic width based on content */
    max-width: none; /* Ensure there is no width restriction */
}

.box:hover .custom-tooltip {
    visibility: visible; /* Make the tooltip visible on hover */
    opacity: 1;
    top: -25px; /* Position the tooltip above the box */
    left: 10px; /* Slight horizontal offset for clarity */
}

/* Ensure the box allows overflow for the tooltip to appear */
.box {
    overflow: visible; /* Tooltip can extend beyond the box boundaries */
    position: relative; /* Make the box the reference for the tooltip */
}

.themebox {
    z-index: -1000;
    color: white;
    font-size: medium;
}

.themebox .see-relations {
    display: none;
}

#modal-map {
    display: block;
    min-width: 100%;  /* Minimum width */
    max-width: 100%;   /* Ensures it doesn’t overflow */
    height: auto;      /* Maintain aspect ratio */
    margin-top: 10px;
}

#theme-modal #theme-modal-image {
    display: block;
    min-width: 100%;  /* Minimum width */
    max-width: 100%;   /* Ensures it doesn’t overflow */
    height: auto;      /* Maintain aspect ratio */
    margin-top: 10px;
    min-width: 200px; min-height: 120px;
}

.sticky-horizontal {
    position: sticky;
    top: 0; /* Anchors the header to the top of its container */
    z-index: 9999; /* Ensures it stays above other content */
    background-color: white; /* Optional: Prevents content behind from showing through */
    border-bottom: 1px solid #ccc; /* Optional: Adds a visual separator */
}

.modal {
    display: none;
    position: fixed;
    z-index: 2;
    left: 0;
    top: 0;
    height: auto;
    width: 1000px;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    text-align: justify;
    padding: 15px;
    border: 1px solid #888;
    border-radius: 8px;
    width: 80%;
    font-size: 11px;
    max-height: 80vh; /* Maximum height set to 80% of the viewport */
    overflow-y: auto; /* Enable vertical scrolling */
}

.modal img {
    width: 200px;
    height: auto;
    display: block;
    margin-top: 10px;
}

#modal-close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

#filters {
    position: fixed;
    top: 42px;
    left: 40px;
    width: 425px;
    height: 63px;
    display: flex;
    align-items: top;
    background-color: transparent;
    border: none;
    z-index: 9999;
    padding-top: 7px;
    flex-direction: column; /* Stack elements vertically */
    gap: 0px; /*Space between elements*/
}

#buttons-row {
    display: flex;
    gap: 10px; /* Space between buttons */
    height: 40px;
}

#filters button {
    background-color: #f0f0f0;
    border: 1px solid #888;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 9px;
    border-radius: 4px;
    z-index: 1;
}

#zoomable-timeline {
    position: relative;
    width: 4100px; /* Match the timeline width */
    margin: 0 auto;
    transition: transform 0.3s ease-in-out;
}

.timeline-arrow {
    position: sticky;
    top: -10px;
    margin-top: 125px;
    height: 30px;
    border-bottom: 2px solid black;
    margin-bottom: 35px;
    width: 4100px;
    z-index: 8888;
}

.time-marker-circle {
    top: 14px; /* Align circles vertically with the timeline arrow */
    width: 30px; /* Set size to 30x30px */
    height: 30px;
    border-radius: 50%;
    background-color: yellow;
    border: 2px solid black;
    display: flex;
    justify-content: center; /* Center text horizontally */
    align-items: center; /* Center text vertically */
    font-size: 8px; /* Font size for marker text */
    font-weight: bold; /* Make the font bold */
}

#filters, .timeline-arrow, .timeline {
    transition: transform 0.3s ease-in-out;
}

#reset-view {
    position: sticky; /* Relative within the Filters container */
    z-index: 1;
    height: 40px;
    background-color: #f0f0f0;
    border: 1px solid #888;
    padding: 5px 10px;
    cursor: pointer; /* Change cursor to pointer on hover */
    font-size: 9px;
    border-radius: 4px;
}

#filter-view {
    position: fixed;
    top: 70px;
    left: 10px;
    background-color: white;
    border: 1px solid black;
    padding: 20px;
    z-index: 9999;
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
}

.filter-section h4 {
    margin-top: 10px;
    font-size: 14px;
    font-weight: bold;
}

.filter-section ul {
    list-style: none;
    padding: 0;
    margin: 5px 0;
}

.filter-section li {
    margin-bottom: 5px;
}

#filter-view button {
    background-color: #f0f0f0;
    border: 1px solid #888;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

#filter-view button:hover {
    background-color: #e0e0e0;
}

#explanation-modal {
    display: none; /* Initially hidden */
    position: fixed;
    z-index: 9999; /* Ensure it appears above other elements */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
}

#explanation-modal .modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 70%; /* Adjust width as needed */
    text-align: justify;
    font-size: 14px;
    border-radius: 8px; /* Optional: Rounded corners */
    max-height: 80vh; /* Maximum height set to 80% of the viewport */
    overflow-y: auto; /* Enable vertical scrolling */
}

#explanation-modal ul {
    padding-left: 20px; /* Indent for list items */
    list-style-type: disc; /* Use bullet points */
}

#chapters {
    position: absolute;
    top: 25px; /* Fix it at the top of the page when scrolling vertically */
    height: 50px;
    width: 4100px; /* Same width as the timeline */
    margin-top: -12px;
    margin-bottom: 0px;
    z-index: 8888;
}

.chapter-button {
    position: absolute;
    padding: 3px;
    background-color: #9e5050;
    border: 1px solid #888;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    transition: background-color 0.3s;
}

.chapter-button:hover {
    background-color: #e0e0e0;
}

.chapter-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    margin-top: -200px;
    width: 100%;
    height: 200%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
    overflow: auto;
}

.chapter-modal-content {
    max-height: 80vh;
    overflow-y: auto;
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 70%;
    border-radius: 8px;
    text-align: justify;
    font-size: 13px;
    
}

.chapter-modal-close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.expand-on-hover {
    transition: width 0.15s ease, z-index 0.15s;
}

.expand-on-hover:hover {
    width: 112px !important; /* choose size you want */
    z-index: 1000;
}

/* Floating panel for the Countries colors key */
#color-key-panel {
  position: fixed;
  top: 120px;          /* below your filters area */
  left: 40px;
  width: 160px;
  max-height: 60vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #888;
  border-radius: 6px;
  padding: 10px;
  z-index: 9999;
  display: none;       /* toggled by JS */
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  font-size: 12px;
}

#color-key-panel h4 {
  margin: 0 0 8px 0;
  font-size: 13px;
}

.color-key-list {
  display: grid;
  grid-template-columns: 1fr; /* single column; switch to 2fr if you want two columns */
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.color-key-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-swatch {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(0,0,0,0.25);
  border-radius: 4px;
  flex: 0 0 auto;
}

#color-key-close {
  float: right;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  border: none;
  background: transparent;
}

.menu-panel {
  position: fixed;
  top: 90px;          /* adjust if needed to sit under your header/buttons */
  left: 40px;         /* align with your filters block */
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px;
  z-index: 10000;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  min-width: 220px;
}
.menu-panel a {
  display: block;
  padding: 6px 8px;
  font-size: 12px;
  text-decoration: none;
  color: #222;
  border-radius: 4px;
}
.menu-panel a:hover { background: #f2f2f2; }
.menu-panel a[aria-current="page"] { font-weight: bold; }
