/*======================================================================================================================================= */
/* Styling of visualisation page */


.form-box {
    padding: 0.5rem 0.5rem 1rem 0.5rem;
    margin-bottom:0.5rem;
    border: 1px solid var(--surreyBatterseaBlue);
    border-radius: 10px;
    background-color:white; 
    /* Bootstrap form-control class will handle width automatically */
}

/* prevent vertical overflow of graph */
.form-box svg#resultsSleepTiming {
  max-height: 100%;
}
.form-box {
  overflow: auto;
}

/* Blue border around main form-box */ 
.form-box-1 {
    margin: 0.2rem 0.2rem;
    padding: 0rem 0rem 0.5rem 0rem;
    border: 1px solid #ccc;
    border-radius: 10px;
    background-color:var(--surreyBatterseaBlue-light); /* white; */
    /* Bootstrap form-control class will handle width automatically */
}

.form-group {
  margin: 0.5rem 0.5rem;
  background-color: white;
}

.graph-box {
    margin: 0.5em auto;
    max-width: 800px;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 1em;
}

label {
    margin-bottom: .3em;
    color: var(--surreyBatterseaBlue);
    font-size: 1em;
}



/* Default: hide the container that hold the wake effort descriptor in simulation output (JS will turn this on if user sets a sleep schedule) */
#wakeEffortContainer {
  display: none;
}



/* Inner column containers fill their Bootstrap column */
.layout-column-left,
.layout-column-right {
  display: flex;
  border-radius: 10px;
  flex-direction: column;
  height: 100%;
  background: var(--surreyBatterseaBlue-light);
  border: 1px solid var(--surreyBatterseaBlue);
  padding: 0.5rem;
  box-sizing: border-box;
}

/* Rows: basic styling */
.layout-row {
  /* box-sizing: border-box; */
  background: #ffffff;
  /* border-bottom: 1px solid #ddd; */
  padding: 0.5rem;
}




/* ======================================================================================================================================= */
/* Styling of popup (as a superscript) */
/* Superscript SVG button */
.superscript-btn {
  vertical-align: super;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  line-height: 1;
  margin-left: -0.3em;
}
.superscript-btn img {
  width: 0.7em;;
  height: 0.7em;;
  display: inline-block;
  transition: fill 0.2s;
}
.superscript-btn:hover img {
  filter: brightness(0.8);
}

/* Full-screen centre modal popup */
.popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 1px solid #ccc;
  padding: 1rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  border-radius: 8px;
  z-index: 1001;
  max-width: 320px;
  width: 80%;
  text-align: center;
}

/* Dark overlay behind popups */
.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;                /* top:0; right:0; bottom:0; left:0; */
  background: rgba(0,0,0,0.3);
  z-index: 1000;
}

/* Close button (×) in top-right corner of popup */
.popup-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
}

.popup-close:hover {
  color: #000;
}


/*======================================================================================================================================= */
/* Styling of sliders and axes */

/* slider & axis container */
.slider-axis-container { 
  --_track-height: 4px;
  --_tooltip-bg-clr: rgb(255, 255, 255);
  --_tooltip-txt-clr: var(--surreyResearchParkBlue);
  --_thumb-width: 30px;
  --_thumb-height: 30px;
  --_track-visible-height: calc(var(--_thumb-height) / 10);  /* NEW: 1/10 thumb height */
  --_axis-height: 80px;          /* NEW: total height available for axis + chart + slider */
  --_axis-baseline-percent: 70%; /* NEW: where the axis line sits vertically */
  --_axis-to-track-offset: 1px; /* vertical gap from axis to slider track */
  --_axis-clr: #777777;
  width: 90%;
  max-width: 600px;
  margin: 20px auto; /* outer spacing in the layout */
  position: relative; /* parent for absolute children */
  height: 40px; /* enough room for ticks + labels */
  
}

/* slider container */
.slider-container { 
  width: 100%;
  max-width: 600px;
  height: var(--_axis-height);          /* was 40px */
  position: relative;      /* overlay inside slider-container */
  top: 50%;                /* vertical centre of parent */
  left: 50%;               /* horizontal centre of parent */
  transform: translate(-50%, -50%);  /* centre both axes */
  margin: 0; /* remove external margin so centring is controlled purely by top/left/transform */
}

/* Section shown/hidden via JS */
.schedule-section { 
  display: none;
}

/* Axis container */
.axis-container { 
  width: calc(100% - var(--_thumb-width));
  max-width: 600px;
  height: var(--_axis-height);          /* was 40px */
  /* centre within slider-container, same method as slider-container */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;            /* no auto-centre; use top/left/transform instead */
}

/*======================================================================================================================================= */
/* Styling of axes */

/* Main horizontal line: centred vertically */
.axis-line {
  position: absolute;
  top: var(--_axis-baseline-percent);
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--_axis-clr);
}

/* Tick container: distributes ticks evenly */
.axis-ticks {
  position: relative;              /* important: ticks line up to this */
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  height: 100%;
}

/* Each tick: relative so tick-line + labels can be positioned inside */
.tick {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;   /* horizontal centring of content */
}

/* Tick mark: centre lies on the axis line for ALL ticks */
.tick-line {
  position: absolute;
  top: var(--_axis-baseline-percent); /* same vertical centre as axis-line */
  transform: translateY(-50%);     /* centre of tick overlaps axis line */
  width: 1px;
  height: 10px;
  background-color: var(--_axis-clr);
  margin: 0;                       /* no vertical margins */
}

/* HHMM label: just below the lower edge of the tick */
.tick-label {
  position: absolute;
  top: calc(var(--_axis-baseline-percent) + 7px);     /*was 50% + half tick height (5px) + small gap */
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  color: var(--_axis-clr);
}

/* Day label (SUN/MON): further below the HHMM label */
.tick-day {
  position: absolute;
  top: calc(var(--_axis-baseline-percent) + 22px);    /* further down than tick-label */
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  color: var(--_axis-clr);
}

/* Let mouse events fall through axis elements to the SVG overlay */
.axis-line,
.axis-ticks,
.axis-ticks * {
  pointer-events: none;
}

/*======================================================================================================================================= */
/* Styling of sliders */


.slider-tooltip-bedtime,
.slider-tooltip-waketime {
  position: absolute;
  top: calc(
    var(--_axis-baseline-percent)
    + var(--_axis-to-track-offset)
    - 1.7 * var(--_thumb-height)
    - 0.5rem
  );
  left: 0;
  width: fit-content;
  background-color: none;
  color: var(--_tooltip-txt-clr);
  font-size: 0.8rem;
  font-weight: bold;
  border-radius: 4px;
  padding: 0.5rem 0.5rem;
  text-align: center;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: all;
  cursor: pointer;
  width: var(--_thumb-width); 
  height: var(--_thumb-height); 
  margin-top: calc((var(--_track-height) - var(--_thumb-height))*1.2);

}

input[type=range]::-moz-range-thumb {
  pointer-events: all;
  cursor: pointer;
  width: var(--_thumb-width); 
  height: var(--_thumb-height); 
  margin-top: calc((var(--_track-height) - var(--_thumb-height))*1.2);
}

#fromSlider1::-webkit-slider-thumb,
#fromSlider2::-webkit-slider-thumb,#fromSlider3::-webkit-slider-thumb,
#fromSlider4::-webkit-slider-thumb,#fromSlider5::-webkit-slider-thumb,
#fromSlider6::-webkit-slider-thumb,#fromSlider7::-webkit-slider-thumb{
  background: url("../img/visualisation/bedtime_ResearchParkBlue_up.svg") no-repeat center;
  background-size: contain; 
}
#toSlider1::-webkit-slider-thumb,
#toSlider2::-webkit-slider-thumb,#toSlider3::-webkit-slider-thumb,
#toSlider4::-webkit-slider-thumb,#toSlider5::-webkit-slider-thumb,
#toSlider6::-webkit-slider-thumb,#toSlider7::-webkit-slider-thumb{
  background: url("../img/visualisation/waketime_ResearchParkBlue_up.svg") no-repeat center;
  background-size: contain; 
}
#fromSlider1::-moz-range-thumb,
#fromSlider2::-moz-range-thumb,#fromSlider3::-moz-range-thumb,
#fromSlider4::-moz-range-thumb,#fromSlider5::-moz-range-thumb,
#fromSlider6::-moz-range-thumb,#fromSlider7::-moz-range-thumb{
  background: url("../img/visualisation/bedtime_ResearchParkBlue_up.svg") no-repeat center;
  background-size: contain;
}
#toSlider1::-moz-range-thumb,
#toSlider2::-moz-range-thumb,#toSlider3::-moz-range-thumb,
#toSlider4::-moz-range-thumb,#toSlider5::-moz-range-thumb,
#toSlider6::-moz-range-thumb,#toSlider7::-moz-range-thumb{
  background: url("../img/visualisation/waketime_ResearchParkBlue_up.svg") no-repeat center;
  background-size: contain; 
} 

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  position: absolute;
  height: var(--_thumb-height);     /* keep as you have it for thumb geometry */
  left: 0;
  top: calc(var(--_axis-baseline-percent) + var(--_axis-to-track-offset));
  transform: translateY(-50%);
  background: transparent;          /* IMPORTANT: no grey/blue bar here */
  pointer-events: none;

}








/* ======================================================================================================================================= */
/* Styling of loading spinner */
/* Adapted from https://www.divinectorweb.com/2022/08/css-infinite-loading-animation.html */
#spinner {
  display: none;
  margin-top: 0rem;
  font-size: 12px;
  text-align: center;
  padding: 0.5rem;
  }

.spinner-container{height:22px}

 .loader div {
	height: 10px;
	width: 10px;
	border-radius: 50%;
	transform: scale(0);
	animation: animate 1.5s ease-in-out infinite;
	display: inline-block;
	margin: 0 0 0.7rem;
}
.loader div:nth-child(0) {
	animation-delay: 0s;
}
.loader div:nth-child(1) {
	animation-delay: 0.2s;
}
.loader div:nth-child(2) {
	animation-delay: 0.4s;
}
.loader div:nth-child(3) {
	animation-delay: 0.6s;
}
.loader div:nth-child(4) {
	animation-delay: 0.8s;
}
.loader div:nth-child(5) {
	animation-delay: 1s;
}

@keyframes animate {
	0%, 100% {
		transform: scale(0.2);
		background-color: var(--surreyBatterseaBlue);
	}
	40% {
		transform: scale(1);
		background-color: var(--surreyResearchParkBlue);
	}
	50% {
		transform: scale(1);
		background-color: var(--surreyTeal);
	}
}




/* ------------------------------------------------------------------------------------------------------------------------



