/* 
  =========================================
  GLOBAL STYLES 
  =========================================
*/

/* Płynne przewijanie */
html {
  scroll-behavior: smooth;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif; /* A more Bubble-like font */
  line-height: 1.4;
  color: #333;
  background-color: #fafafa; 
}

a {
  text-decoration: none;
  color: inherit; 
}

header, section, footer {
  padding: 16px;
  max-width: 1024px;
  margin: 0 auto;
}

#headplate {
  position: relative; /* Dodane */
  background-color: #d6ffca;
  border: 0px solid #eee;     /* subtle border */
  padding: 25px;              /* spacing inside the box */
  width: calc(100% - 20px);
  max-width: 1024px;
  margin: 24px auto;      	  /* auto left/right => centers */
  border-radius: 8px;         /* rounded corners */
  font-size: 1.15rem;            /* adjust text size as desired */
  color: #333;                /* text color */
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  z-index: 1;
}

#headplate p{
  padding-left: 15px;
}

/* 
  =========================================
  NAVIGATION BAR 
  =========================================
*/
.navbar {
  width: 100%;
  height: 50px;
  background-color: #635BFF; /* Bubble-like purple accent */
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  position: sticky;
  top: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  z-index: 999; /* ensures menu stays on top */
}

.navbar-brand {
  font-size: 2.3rem;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.navbar-brand:hover {
  color: #eee;
  transition: color 0.2s ease;
}

.navbar-links {
  display: flex;
  list-style: none;
  gap: 1rem;
}

.navbar-links li {
  display: inline-block;
}

.navbar-links a {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.navbar-links a:hover {
  color: #d9d9ff; /* lighter hover color */
}

/* Hamburger icon (mobile) */
.navbar-toggle {
  display: none; /* hidden by default for desktop */
  font-size: 1.5rem;
  cursor: pointer;
}

/*
  =========================================
  RESPONSIVE MENU
  =========================================
*/
@media (max-width: 605px) {
  .navbar-links {
	position: absolute;
	top: 50px; /* just below the navbar */
	right: 0;
	background-color: #635BFF;
	width: 200px;
	flex-direction: column;
	align-items: flex-start;
	padding: 1rem;
	gap: 0.5rem;
	display: none; /* hidden by default, toggled via JS */
	border-bottom-left-radius: 6px;
	border-bottom-right-radius: 6px;
  }

  .navbar-links li {
	width: 100%;
  }

  .navbar-links a {
	display: block;
	width: 100%;
	padding: 0.5rem 0;
  }

  .navbar-toggle {
	display: block; /* hamburger shown on smaller screens */
  }
}

/* 
  =========================================
  HEADER & SECTIONS 
  =========================================
*/
header h1 {
  margin-bottom: 0;
  font-size: 2rem;
}
header p {
  margin-top: 0.3em;
  color: #555;
}

section h2 {
  margin-bottom: 0.5em;
  font-size: 1.5rem;
  color: #635BFF;
}

/* This adds 90px of breathing room above any element with an ID */
#calculator {
  scroll-margin-top: 92px;
}

/* This adds 90px of breathing room above any element with an ID */
#download {
  scroll-margin-top: 80px;
}

/* This adds 60px of breathing room above any element with an ID */
section[id] {
  scroll-margin-top: 60px;
}

section[id] p{
  padding-left: 15px;
}


section ul {
  margin: 10px 0 0 20px;
  padding: 0;
  list-style: disc;
}

.infoLink {
  background-color: #d6ffca;  /* a light-green pastel */
  border: 0px solid #eee;     /* subtle border */
  padding: 26px;              /* spacing inside the box */
  width: calc(100% - 20px);
  max-width: 1024px;
  margin: 24px auto;      	  /* auto left/right => centers */
  border-radius: 8px;         /* rounded corners */
  font-size: 1.15rem;            /* adjust text size as desired */
  color: #333;                /* text color */
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  /*text-align: center;*/
}

.infoLink a {
  font-weight: bold;
  color: #635BFF;  /* link color to match your brand/palette */
}

.infoLink ul {
  margin: 10px 0 0 20px;
  padding: 0;
  list-style: disc;
}

.explanation-section {
  margin: 24px auto;
  padding: 20px;
  width: calc(100% - 20px);
  max-width: 1024px;
  background-color: #ffe6f0; /* Light pink background */
  border-radius: 8px;
  font-size: 1rem;
  color: #333;
  line-height: 1.6;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.explanation-section h2 {
  font-size: 1.5rem;
  color: #b30059; /* Slightly darker pink for the heading */
  margin-bottom: 15px;
}

.explanation-section p {
  margin-bottom: 15px;
  padding-left: 15px;
}

.explanation-section strong {
  color: #800040; /* Darker pink for emphasis */
}

/* 
  =========================================
  CALCULATOR SECTION 
  =========================================
*/
.calculator-container {
  position: relative;
  background: #e6eeff;
  padding: 20px;
  width: calc(100% - 20px);
  max-width: 1024px;
  border-radius: 10px; /* bubble-like softer corners */
  margin: 24px auto;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08); /* subtle shadow */
}

.form-group {
  margin-bottom: 0.6em;
}

.form-group-colored {
  margin-bottom: 1.2em;
  color: red;
}

label {
  display: inline-block;
  margin-bottom: 0.1em;
  font-weight: bold;
}

input[type="text"],
select {
  width: 100%;
  max-width: 300px;
  padding: 8px;
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.95rem;
}

.inline-group {
  /*display: flex;*/
  gap: 1em;
  align-items: center;
  flex-wrap: wrap;
}
.inline-group label {
  margin-top: 6px;
  margin-bottom: 12px;
  font-weight: normal;
  /*font-style: italic;*/
  color: #555;
  padding-inline-start: 10px;
}

button {
  padding: 10px 16px;
  background: #635BFF; 
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  border-radius: 4px;
  transition: background 0.2s ease;
  border: 0.5px solid #635bff;
  box-shadow: 1px 1px 2px 0px #c7c7c7;
}
button:hover {
  background: #5047cc;
}

/* SAG PRESET Buttons Container */
.sag-preset-container {
  display: flex;
  flex-wrap: nowrap; /* Zapobiega zawijaniu przycisków */
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-start; /* Przyciski zaczynają od lewej */
  /* overflow-x: auto; /* Umożliwia przewijanie poziome na bardzo małych ekranach */
  padding-bottom: 0px; /* Opcjonalnie: dodaje trochę przestrzeni na dole */
}

/* Common SAG Preset Buttons */
.sag-preset-btn {
  /* padding: 5px 8px; Zmniejszone paddingi dla większej elastyczności */
  background: #eee;
  color: #696969;
  border: 0.5px solid #e1e1e1;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: bold;
  transition: background 0.2s ease, color 0.2s ease;
  
  flex: 1 1 auto; /* Przyciski rosną i kurczą się równomiernie */
  box-sizing: border-box; /* Uwzględnia padding i border w szerokości */
  
  display: flex; /* Umożliwia centrowanie tekstu */
  align-items: center; /* Vertikalne centrowanie */
  justify-content: center; /* Horyzontalne centrowanie */
  
  white-space: nowrap; /* Zapobiega zawijaniu tekstu */
  overflow: hidden; /* Ukrywa nadmiar tekstu */
  text-overflow: ellipsis; /* Dodaje ... gdy tekst jest za długi */
  box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.08);
}

.sag-preset-btn:hover {
  background: #ddd;
}

/* Highlight active button */
.sag-preset-btn.active {
  background: #635BFF;
  color: #f6f6f6;
  border: 0.5px solid #635bff;
  box-shadow: 1px 1px 2px 0px #c7c7c7;
}

/* Additional SAG Preset Buttons for Wide Screens */
.sag-preset-btn-wide {
  display: none; /* Ukryj przyciski wide na małych ekranach */
}

/* Result area */
#resultArea {
  font-size: 0.9rem;
  margin-top: 0px;
  white-space: pre-line;
  padding: 12px;
  border: 1px solid #ccc;
  background: #fdfdfd;
  min-height: 100px;
  border-radius: 4px;
  margin-bottom: 20px;
}
.line-green {
  color: green;
  /*font-weight: bold;*/
}
.line-orange {
  color: orange;
  /*font-weight: bold;*/
}
.line-red {
  color: red;
  /*font-weight: bold;*/
}
.BBD {
  color: #ff00ff;
}
.BBH {
  color: blue;
}

.error {
  color: red;
  font-weight: bold;
  margin-top: 1em;
}

.sag-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  margin-top: 16px;
}
.sag-line label {
  margin-bottom: 0; 
}
.sag-line input[type="range"] {
  flex: 1; 
}

#calculateBtn {
  /*margin-top: 20px;*/
  width: 100%;
  font-size: 1.5rem;
  font-weight: bold;
}

/* 
  =========================================
  RESPONSIVENESS 
  =========================================
*/
@media (min-width: 605px) {
  .sag-preset-btn-wide {
    display: flex; /* Wyświetl przyciski wide na dużych ekranach */
  }
}

/* Responsywność poniżej 600px */
@media (max-width: 605px) {
  .sag-preset-container {
    justify-content: flex-start; /* Przyciski zaczynają od lewej */
  }
  .sag-preset-btn {
    flex: 1 1 auto; /* Pozostaje elastyczne */
    max-width: none; /* Usuń ograniczenie maksymalnej szerokości */
  }
  .inline-group {
	flex-direction: column;
	align-items: flex-start;
  }
  input[type="text"],
  select {
	max-width: 100%;
  }
  .sag-line {
	flex-direction: column;
	align-items: flex-start;
  }
  .sag-line input[type="range"] {
	width: 100%;
	flex: unset;
  }
  #calculateBtn {
	width: 100%;
  }
  
  /* Ensure SVG maintains aspect ratio on very small screens */
  #visualizationContainer {
    padding-bottom: 37.5%; /* Maintains aspect ratio */
  }

  #visualization {
    min-height: 150px; /* Optional: reduce min-height on smaller screens */
  }
}

.disclaimer-section {
  margin-top: 20px;
  padding: 20px;
  font-size: 0.8rem;
  color: #555;
  background-color: #f9f9f9;
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  line-height: 1.5;
}

.disclaimer-section h3 {
  font-size: 1.2rem;
  color: #333;
  margin-bottom: 10px;
}

.disclaimer-section ul {
  margin: 10px 0 0 20px;
  padding: 0;
  list-style: disc;
}

.disclaimer-section a {
  color: #635BFF;
  text-decoration: none;
}

.disclaimer-section a:hover {
  text-decoration: underline;
}

/* Klasa ukrywająca elementy bez rezerwowania miejsca */
.hidden {
  display: none;
}

/* Klasa pokazująca elementy z animacją */
.visible {
  display: block; /* Możesz zmienić na flex, jeśli jest potrzebne */
  opacity: 0;
  transform: translateY(-25px);
  animation: fadeInSlideDown 1s forwards;
}

.io-hidden {
  display: none;
}

.io-visible {
  display: block; /* or flex, etc. */
}

@keyframes fadeInSlideDown {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 
  =========================================
  WIZUALIZATION CONTAINER 
  =========================================
*/
#visualizationContainer {
  margin-top: 20px;
  width: 100%;
  overflow: hidden;
  position: relative;
  padding-bottom: 37.5%; /* (450 / 1200) * 100 = 37.5% */
  height: 0;
}

#visualization {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 100px; /* Ensures visibility on very small screens */
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  /*cursor: grab;  Zmienia kursor, gdy można przeciągać 
}

#visualization:active {
  cursor: grabbing;*/
}

/* Dodatkowe style dla płynniejszych animacji */
#resultArea,
#errorArea {
  margin-top: 0px;
}

/* Optional: Using aspect-ratio */
@media (min-width: 606px) {
  #visualizationContainer {
    aspect-ratio: 1024 / 450; /* Maintains 8:3 aspect ratio */
  }

  #visualization {
    width: 100%;
    height: 100%;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-height: 200px;
  }
}

#sagLine {
    scroll-margin-top: 70px;
}

/* Instructions Tab */
.instructions-tab {
    position: absolute;
    top: -32px;
    right: 10px;
    /* transform: translateY(-50%); */
    transform-origin: right top;
    width: 120px;
    background-color: #635bffbf;
    color: #ffffffd1;
    text-align: center;
    padding: 6px 5px 3.5px 5px;
    border-top-right-radius: 8px;
    border-top-left-radius: 8px;
    cursor: pointer;
    /* transition: left 0.1s ease;
    z-index: 999; */
    font-weight: bold;
}
.instructions-tab:hover {
    top: -33px;
    right: 9px;
    padding: 6px 5px 4.5px 5px;	
	color: #FFF;
    background-color: #635BFF;
}

/* Instructions Tab when Open */
.instructions-tab.open {
    right: 0px;
    /* transform: translateY(-50%); */
    padding: 6px 5px 8px 5px;
    top: -40px;
    color: #FFF;
    background-color: #635BFF;
    z-index: 999;
    /* border-right: lightgray; */
    /* border: solid; */
}

/* Instructions Overlay */
.instructions-overlay {
    position: absolute;
    top: -6px;
    right: 0;
    /* width: 500px; */
    /* height: 35%; */
    background-color: #fff;
    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.1);
    padding: 40px;
    overflow-y: auto;
    /* transition: transform 0.1s ease; */
    /* transform: translateX(100%); */
    z-index: 1000;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Show the Overlay */
.instructions-overlay.visible {
  opacity: 1;
  transform: translateY(0px);
  animation: none;
}

/* Close Button inside Overlay */
.close-instructions {
  position: absolute;
  top: 0px;
  right: 34px;
  background: none;
  border: none;
  font-size: 2.2rem;
  cursor: pointer;
  color: #635BFF;
  box-shadow: none;
}
.close-instructions:hover {
  background: none;
}

/* Instructions Content Styling */
.instructions-content h2 {
  /* margin-top: 40px;  Space below the close button */
  color: #635BFF;
}

.instructions-content ul {
  margin-top: 10px;
  list-style: disc inside;
}

/* Image Section Styling */
.image-section {
  max-width: 1024px;
  margin: 0 auto; /* Center the section */
  padding: 20px;
}

.responsive-image {
  width: 100%;
  height: auto;
  cursor: pointer;
  transition: transform 0.2s ease;
  border-radius: 8px;
}

.example-svg {
  max-width: 1024px;
  margin: 0 auto;
  margin-top: -60px;
  width: 100%;
  height: auto;
  border: solid 1px #ddd;
  border-radius: 8px;
  z-index: 0;
}

.responsive-image:hover {
  transform: scale(1.05);
}

/* Modal Styling */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  padding-top: 60px; /* Location of the box */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.8); /* Black w/ opacity */
  transition: opacity 1s ease;
  opacity: 0;
}

.modal.show {
  display: block;
  opacity: 1;
}

.modal-content {
  display: block;
  margin: 0 auto;
  max-width: 90%;
  max-height: 80%;
  /* border: 2px solid white; */
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

#caption {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
}

.close {
  position: absolute;
  top: 15px;
  right: 25px;
  color: #ffffff;
  font-size: 40px;
  font-weight: bold;
  transition: color 0.3s;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .modal-content {
    max-width: 95%;
    max-height: 75%;
  }
  
  .close {
    top: 15px;
    right: 20px;
    font-size: 30px;
  }
}

.toast {
  position: fixed;
  bottom: 70%;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgb(144, 144, 144);
  color: #fff;
  padding: 8px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
  opacity: 0.8;
  z-index: 9999;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: opacity 0.4s ease-in-out;
}

/* Domyślnie chowamy to okienko (np. display: none albo visibility: hidden) */
.hidden {
  display: none;
}

/* Kontener dla sekcji Advanced Version */
.advancedVersion-flex {
  display: flex;
  align-items: flex-start;
  justify-content: space-between; 
  gap: 20px; /* Odstęp między tekstem a przyciskiem */
}

/* Prawa kolumna (jeśli potrzebujesz dodatkowego stylu) */
.av-right {
  display: flex;
  align-items: center;  /* Wycentruje przycisk pionowo, jeśli to potrzebne */
  justify-content: center; 
}

/* Styl przycisku Download */
.download-btn {
    display: inline-block;
    text-align: center;
    background: #635BFF;
    color: #fff;
    border: 0.5px solid #635bff;
    box-shadow: 1px 1px 4px 1px #c7c7c7;
    cursor: pointer;
    transition: background 0.2s ease;
    border-radius: 8px;
    font-size: clamp(2.3rem, 3vw, 4em);
    font-weight: bold;
    width: 100%;
    min-height: 150px;
    padding: 18px 24px;
    margin-top: 20px;
    box-sizing: border-box;
}

/* Efekt hover, jak przycisk Calculate */
.download-btn:hover {
  background: #5047cc;
}

/* Responsywność - poniżej 800px umieszczamy przycisk pod tekstem i rozszerzamy */
@media (max-width: 800px) {
  .advancedVersion-flex {
    flex-direction: column;    /* Ustawiamy kolumnę */
    align-items: center;       /* Wyśrodkuj w poziomie */
  }
  
  .av-right {
    width: 100%;              /* Prawa kolumna wypełnia szerokość */
    margin-top: 15px;         /* Odstęp od tekstu */
  }
  
  .download-btn {
	width: 80%;
	min-height: 150px;
	margin-top: 0;
  }
}
