/* шрифты */
@font-face {
  font-family: "PT Astra Fact";
  src: url("/local/templates/termidesk25/fonts/PTAstraFact-Regular.ttf")
    format("truetype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "PT Astra Fact";
  src: url("/local/templates/termidesk25/fonts/PTAstraFact-Bold.ttf")
    format("truetype");
  font-weight: 700;
  font-style: normal;
}

#calculator h3 {
  font-size: 32px;
  line-height: 42px;
  font-weight: 400;
  color: #fff;
}

#calculator h3.bold {
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 32px;
}

#calculator h4 {
  font-size: 28px;
  line-height: 38px;
  font-weight: 400;
  color: #fff;
}

#calculator h4.bold {
  font-weight: 700;
}

#calculator h5 {
  font-size: 24px;
  line-height: 34px;
  font-weight: 400;
  color: #fff;
}

#calculator h5.bold {
  font-weight: 700;
}

#calculator h6 {
  font-size: 20px;
  line-height: 30px;
  font-weight: 400;
  color: #fff;
  margin-top: 0;
  margin-bottom: 24px;
}

#calculator h6.bold {
  font-weight: 700;
}

#calculator .text-xlarge {
  font-size: 18px;
  line-height: 28px;
  font-weight: 400;
  color: #fff;
}

#calculator .text-large {
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: #fff;
  margin: 0;
}

#calculator .text-regular {
  font-size: 14px;
  line-height: 22px;
  font-weight: 400;
  color: #fff;
}

#calculator .text-small {
  font-size: 12px;
  line-height: 20px;
  font-weight: 400;
  color: var(--neutral-400);
  margin: 0;
}

body {
  margin: 0;
  padding: 0;
  border: 0;
}

/* переменные - цвета*/
#calculator {
  --accent-900: #002e52;
  --accent-700: #0071a8;
  --accent-600: #008dd4;
  --accent-500: #00aaff;
  --accent-400: #57c7ff;

  --neutral-900: #14161b;
  --neutral-700: #43485b;
  --neutral-500: #788295;
  --neutral-400: #abb2bd;
  --neutral-50: #84919e;

  font-family: "PT Astra Fact", "Arial", "Verdana", sans-serif !important;

  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--neutral-900);
  background-image: url(assets/img/bg_2.webp);
  background-repeat: no-repeat;
  background-position: top 96px right 0;
  background-size: cover;
}

#calculator header {
  height: 56px;
  width: 100vw;
  margin-bottom: 40px;
  background-color: var(--neutral-900);
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

#calculator header .container {
  display: flex;
  flex-direction: row;
  width: 100%;
  max-width: 1400px;
  padding: 0 24px;
  align-items: center;
  justify-content: space-between;
}

#calculator header .back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-radius: 10px;
  background-color: var(--accent-500);
  transition: all ease 0.3s;
  height: 40px;
  padding: 0 16px;
  text-decoration: none;
}

#calculator header .back-btn:hover {
  background-color: var(--accent-600);
}

#calculator header .back-btn:hover back-btn__img svg path {
  fill: var(--accent-600);
}

#calculator header .back-btn:active {
  background-color: var(--accent-700);
}

#calculator header .back-btn:active back-btn__img svg path {
  fill: var(--accent-700);
}

#calculator header .back-btn__img {
  width: 20px;
  height: 20px;
  border-radius: 8px;
  display: flex;
  background-color: #fff;
  align-items: center;
  justify-content: center;
}
#calculator header .back-btn__img svg path {
  transition: all ease 0.3s;
}

#calculator header p {
  font-size: 12px;
  line-height: 20px;
  font-weight: 700;
  color: #fff;
}

/* Добавьте эти стили в секцию header */

#calculator header .header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

#calculator .language-selector {
  position: relative;
}

#calculator .language-selector select {
  background: transparent;
  border: 1px solid var(--accent-500);
  border-radius: 8px;
  color: #fff;
  padding: 8px 32px 8px 12px;
  font-size: 14px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: all ease 0.3s;
  height: 40px;
  min-width: 120px;
}

#calculator .language-selector select:hover {
  border-color: var(--accent-400);
  background-color: rgba(0, 170, 255, 0.1);
}

#calculator .language-selector select:focus {
  outline: none;
  border-color: var(--accent-400);
  box-shadow: 0 0 0 2px rgba(0, 170, 255, 0.2);
}

#calculator .language-selector::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--accent-500);
  pointer-events: none;
}

#calculator .language-selector select option {
  background: var(--neutral-900);
  color: #fff;
  padding: 8px;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  #calculator .header-controls {
    gap: 12px;
  }

  #calculator .language-selector select {
    min-width: 100px;
    padding: 8px 28px 8px 10px;
    font-size: 13px;
  }

  #calculator header .back-btn p {
    display: none; /* На мобильных скрываем текст, оставляем только иконку */
  }

  #calculator header .back-btn {
    padding: 0 12px;
  }

  #calculator
    .bottom-section
    #overheadForServiceVms
    thead
    tr
    th:not(:first-child) {
    writing-mode: sideways-lr;
  }
}

#calculator .bottom-section #overheadForServiceVms thead tr th:first-of-type {
  width: 37%;
}

#calculator .bottom-section #overheadForServiceVms thead tr th,
#calculator
  .bottom-section
  #overheadForServiceVms
  tbody
  tr
  td:not(:first-child) {
  align-items: center;
  justify-items: center;
}

#calculator .container {
  width: 1000px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  box-sizing: border-box;
}

#calculator .section {
  box-sizing: border-box;
  padding: 32px;
  background: transparent;
  border: 1px solid var(--neutral-700);
  border-radius: 24px;
  flex-grow: 1;
  flex: 1 1 50%;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

#calculator .block-section {
  flex: 1 1 50%;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-grow: 1;
  box-sizing: border-box;
}

#calculator .head-section .section {
  background-image: url("assets/img/header_bg.webp");
  background-repeat: no-repeat;
  background-position: top right;
}

#calculator .row-section,
.column-section {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  position: relative;
}

#calculator .column-section {
  flex-direction: column;
}

/* #calculator
  #bpmParamsSection
  .form-row:first-of-type
  .form-group:first-of-type {
  flex: 2;
} */

/* #calculator #bpmParamsSection .form-row:first-of-type .form-group:last-of-type {
  flex: 1;
} */

/* Широкие экраны (до 2600px) */
@media (max-width: 2600px) {
  #multithreadingBoost,
  #avgResourceTraffic {
    padding-top: 52px !important;
  }

  /* Сложное условие: применяется только когда оба элемента видны */
  .form-row:has(.form-group:not(.hide) > #avgVdiTraffic):has(
      .form-group:not(.hide) > #avgStorageTraffic
    )
    #avgVdiTraffic,
  .form-row:has(.form-group:not(.hide) > #avgVdiTraffic):has(
      .form-group:not(.hide) > #avgStorageTraffic
    )
    #avgStorageTraffic {
    padding-top: 52px;
  }
}

/* Средние экраны (до 1048px) */
@media (max-width: 1048px) {
  #multithreadingBoost,
  #avgResourceTraffic,
  #avgVdiTraffic,
  #avgStorageTraffic {
    padding-top: 32px !important;
  }
}

/* Планшеты и небольшие десктопы (до 476px) */
@media (max-width: 476px) {
  #avgResourceTraffic {
    padding-top: 52px !important;
  }

  #connectedUsers {
    padding-top: 32px;
  }

  #multithreadingBoost {
    padding-top: 72px !important;
  }
}

/* Мобильные устройства (до 380px) */
@media (max-width: 380px) {
  #avgResourceTraffic {
    padding-top: 72px !important;
  }

  #connectedUsers,
  #avgStorageTraffic {
    padding-top: 52px !important;
  }
}

#calculator .row-section:last-of-type,
.column-section:last-of-type {
  margin-bottom: 40px;
}

#calculator .form-row {
  width: 100%;
  display: flex;
  gap: 16px;
  margin: 0;
}

#calculator .form-group {
  position: relative;
  flex: 1;
  flex-grow: 1;
  margin-bottom: 20px;
}

#calculator .form-input {
  width: 100%;
  padding: 32px 20px 10px 20px;
  border: 1px solid var(--neutral-500);
  border-radius: 12px;
  font-size: 16px;
  line-height: 24px;
  transition: all 0.3s ease;
  background: transparent;
  box-sizing: border-box;
  min-height: 66px;
  color: #fff;
}

#calculator .form-input:focus {
  outline: none;
  border-color: var(--accent-400);
}

#calculator .form-input:hover {
  outline: none;
  border-color: var(--accent-500);
}

#calculator .form-label {
  position: absolute;
  left: 20px;
  top: 26px;
  color: var(--neutral-400);
  font-size: 16px;
  line-height: 24px;
  pointer-events: none;
  transition: all 0.3s ease;
  padding: 0;
}

#calculator .form-input:focus + .form-label,
#calculator .form-input:not(:placeholder-shown) + .form-label {
  top: 7px;
  font-size: 12px;
  line-height: 20px;
  max-width: calc(100% - 40px);
}

#calculator .form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 48px;
}

#calculator .select-group {
  position: relative;
}

#calculator .form-group.select-group::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  transform: translateY(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #fff;
  opacity: 0.8;
}

#calculator select option {
  background: var(--neutral-900);
  color: #fff;
  font-size: 16px;
}

#calculator select option:hover {
  background: var(--accent-500);
}

#calculator .form-select:focus + .form-label,
#calculator .form-select:valid + .form-label {
  top: 12px;
  font-size: 12px;
}

/* Chrome, Edge, Safari */
#calculator input[type="number"]::-webkit-inner-spin-button,
#calculator input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
#calculator input[type="number"] {
  -moz-appearance: textfield;
}

#calculator .checkbox-group {
  margin-top: 32px;
}

#calculator .checkbox-group:has(#useCustomLoad),
#calculator .checkbox-group:has(#useMultithreading),
#calculator .checkbox-group:has(#gatewayNeeded) {
  margin-top: 16px;
  margin-bottom: 16px;
}

#calculator .custom-checkbox {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  font-size: 14px;
  line-height: 22px;
  color: #fff;
}

#calculator .custom-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

#calculator .checkmark {
  width: 20px;
  height: 20px;
  background: transparent;
  border: 1px solid var(--accent-600);
  border-radius: 6px;
  margin-right: 12px;
  margin-top: 3px;
  flex-shrink: 0;
  transition: all 0.3s ease;
  position: relative;
}

#calculator .custom-checkbox input[type="checkbox"]:checked + .checkmark {
  background: var(--accent-600);
  border-color: var(--accent-600);
}

#calculator
  .custom-checkbox
  input[type="checkbox"]:checked
  + .checkmark::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

#calculator .checkbox-text {
  margin-top: 3px;
  color: #fff;
  font-size: 16px;
}

#calculateBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 40px;
  gap: 12px;
  border-radius: 12px;
  background-color: var(--accent-500);
  transition: all ease 0.3s;
  margin-top: 0;
  margin-bottom: 40px;
  cursor: pointer;
  border: none;
  outline: none;
}

#calculateBtn svg {
  transition: all ease 0.3s;
}

#calculateBtn p {
  font-size: 18px;
  line-height: 28px;
  margin: 0;
  font-weight: 400;
  color: #fff;
}

#calculateBtn:hover {
  background-color: var(--accent-400);
}

#calculateBtn:hover svg {
  transform: rotate(90deg);
}

#calculateBtn:active {
  background-color: var(--accent-600);
}

#calculateBtn:active svg {
  transform: rotate(90deg);
}

.hide {
  display: none !important;
}

#calculator .switch-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

#calculator .switch {
  position: relative;
  display: inline-block;
  width: 94px;
  height: 31px;
}

/* Hide default HTML checkbox */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* The slider */
#calculator .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #1e2028;
  border-radius: 999px;
  transition: background 0.3s ease;
  box-shadow: inset 0 0 0 1px var(--neutral-500);
}

#calculator .slider:before {
  content: "";
  position: absolute;
  height: 19px;
  width: 38px;
  left: 6px;
  top: 6px;
  background: #fff;
  border-radius: 28px;
  transition: transform 0.3s ease;
}

#calculator input:checked + .slider {
  background: var(--accent-500);
  box-shadow: inset 0 0 0 1px var(--accent-500);
}

#calculator .switch:hover .slider {
  box-shadow: inset 0 0 0 1px var(--accent-400);
}

#calculator input:focus + .slider {
  box-shadow: inset 0 0 0 1px var(--accent-400);
}

#calculator input:checked + .slider:before {
  -webkit-transform: translateX(44px);
  -ms-transform: translateX(44px);
  transform: translateX(44px);
}

#calculator .bottom-section {
  background-color: var(--accent-900);
  border-radius: 24px;
  padding: 32px;
}

#calculator .bottom-section .section {
  border-color: var(--accent-700);
}

#calculator .bottom-section .section.buy {
  background-color: rgba(127, 255, 212, 0.396);
  border: 1px solid rgba(127, 255, 212, 0.816);
}

#calculator .table-wrapper {
  width: 100%;
  position: relative;
}

#calculator table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th {
  background: transparent;
  padding: 0;
  text-align: left;
  position: relative;
}

th .text-small {
  max-width: 86%;
}

td {
  padding-top: 2px;
  background: transparent;
  word-break: break-word;
}

#storageGrowthTable td:first-of-type,
#storageGrowthTable th:first-of-type,
#storageResourcesGrowthTable td:first-of-type,
#storageResourcesGrowthTable th:first-of-type {
  width: 50%;
}

@media (max-width: 1065px) {
  #calculator {
    background-image: url(assets/img/bg_2_tablet.webp);
  }

  #calculator .container {
    width: 688px;
  }

  #calculator .head-section .section {
    background-image: url("assets/img/header_bg__mobile.webp");
    background-repeat: no-repeat;
    background-position: top -30px center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 175px 32px 32px 32px;
  }

  #calculator .row-section,
  column-section {
    flex-direction: column;
    gap: 24px;
  }

  #calculator .top-section {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* #avgResourceTraffic,
  #avgStorageTraffic,
  #avgVdiTraffic,
  #multithreadingBoost {
    padding-top: 32px !important;
  } */

  /* #multithreadingBoost {
    padding-top: 52px !important;
  } */
}

@media (max-width: 768px) {
  #calculator {
    background-image: url(assets/img/bg_2_mobile.webp);
  }

  #calculator header img {
    width: 128px;
    height: 26px;
  }

  /* #avgResourceTraffic {
    padding-top: 52px !important;
  } */

  #calculateBtn {
    width: 100%;
  }

  /* #calculator header {
  } */

  #calculator .container {
    width: 100%;
    padding: 0 20px;
  }

  #calculator .section {
    align-items: center;
  }

  #calculator h3 {
    text-align: center;
  }

  #calculator .head-section .section {
    background-image: url("assets/img/header_bg__mobile.webp");
    background-repeat: no-repeat;
    background-position: top -30px center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 175px 32px 32px 32px;
  }

  #calculator .row-section,
  column-section {
    flex-direction: column;
    gap: 24px;
  }

  #calculator .top-section {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  #calculator .form-row {
    flex-direction: column;
    gap: 0;
  }
}

/* Стилизация отключенного поля */
#calculator .form-row .disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

#calculator #oversubscriptionRatio {
  padding-top: 10px;
  /* margin: 0; */

  min-height: 20px;
  width: 70px;
}

.checkbox-group:has(#cpuOversubscription:not(:checked))
  ~ #oversubscriptionBlock {
  display: none;
}

.checkbox-group:has(#cpuOversubscription:checked) ~ #oversubscriptionBlock {
  display: block;
}

/* Блок по умолчанию скрыт */
.collapsible-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height 0.4s ease,
    opacity 0.3s ease,
    padding 0.4s ease,
    margin 0.4s ease;
  padding: 0 !important;
  margin: -10px 0 !important;
}

/* Раскрытый блок — применяется, когда у .section.expand есть класс active */
.wrapper .section.expand ~ .section.collapsible-content {
  max-height: 1000px;
  opacity: 1;
  padding: 32px !important;
  margin: 0 !important;
}

.toggle-icon {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 12px;
  height: 12px;
  cursor: pointer;
}

.toggle-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  transform: translate(-50%, -50%) rotate(45deg); /* стрелка вниз */
  transition: transform 0.2s ease;
}

.toggle-icon.active::after {
  transform: translate(-50%, -50%) rotate(-135deg); /* стрелка вверх */
}

.error-msg {
  color: tomato;
  padding: 5px 0 0 15px;
  font-size: small;
}

.top-section__table th,
.top-section__table td {
  padding: 5px 10px;
}

.top-section__table th {
  width: 80%;
  border-right: 1px solid #00aaff;
  border-bottom: 1px solid #00aaff;
}

.top-section__table tr:last-child th {
  border-bottom: none;
}

.top-section__table td {
  border-bottom: 1px solid #00aaff;
}

.top-section__table tr:last-child td {
  border-bottom: none;
}

#minTerminalValuesTable th {
  border-right: 1px solid #00aaff;
  border-bottom: 1px solid #00aaff;
  /* vertical-align: middle; */
  horizontal-align: middle;
}

#minTerminalValuesTable td {
  border-right: 1px solid #00aaff;
}

#minTerminalValuesTable th:last-of-type,
#minTerminalValuesTable td:last-of-type {
  border-right: none;
}

#minTerminalValuesTable p {
  text-align: center;
  max-width: 100%;
}

/* Базовые стили для кнопки и попапа */
.help-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4facfe, #00c3ff);
  border: none;
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.help-popup {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 280px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 18px 16px 16px 16px;
  z-index: 1000;
  display: none;
  animation: fadeIn 0.2s ease-out;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
}

/* Анимация появления */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Кнопка закрытия попапа */
.close-popup {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #888;
  transition: color 0.2s;
  line-height: 1;
  padding: 0;
}

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

/* Текст внутри попапа */
.help-popup h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: #0a58ca;
}

.help-popup p {
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.4;
  color: #2c3e50;
}

.help-popup .contact-email {
  margin-top: 12px;
  font-weight: 500;
  word-break: break-all;
}

.help-popup a {
  color: #0d6efd;
  text-decoration: none;
}

.help-popup a:hover {
  text-decoration: underline;
}

/* Адаптация для маленьких экранов */
@media (max-width: 480px) {
  .help-popup {
    width: 260px;
    bottom: 80px;
    right: 12px;
    padding: 14px 14px 12px 14px;
  }
  .help-button {
    width: 48px;
    height: 48px;
    font-size: 24px;
    bottom: 16px;
    right: 16px;
  }
}
