:root {
  --pink-50: #FEF3F4;
  --pink-100: #A80A1A;
  --pink-200: #F99FA8;
  --pink-300: #F66F7C;
  --pink-400: #F43E51;
  --pink-500: #A80A1A;
  --pink-600: #C10B1E;
  --pink-700: #900916;
  --gray-50: #f2f2f2;
  --gray-100: #e6e6e6;
  --gray-200: #cccccc;
  --gray-300: #b3b3b3;
  --gray-400: #999999;
  --gray-500: #cfcfcf;
  --gray-600: #666666;
  --gray-700: #4d4d4d;
  --gray-900: #1a1a1a;
}

/* Base mobile optimizations */
* {
  -webkit-tap-highlight-color: rgba(168, 10, 26, 0.1);
  -webkit-touch-callout: none;
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.flaw-form {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

a {
  padding: none;
}

.header-text {
  font-size: clamp(14px, 0.5rem + 0.5vw, 16px);
  color: var(--pink-400);
  transition: ease-in-out 0.3s;
}

.header-text:hover {
  color: var(--pink-500);
}

.custom-title {
  color: var(--gray-900);
  text-align: start;
}
.custom-title h1 {
  font-size: clamp(24px, 2rem + 1vw, 40px); /* Общий размер заголовка */
  line-height: 1.2;
  margin: 0;
  font-weight: 500;
}
.custom-title .subtitle {
  font-size: clamp(22px, 1rem + 1vw, 26px); /* Размер для подзаголовка */
  display: block; /* Новый блок для подзаголовка */
  margin-top: 8px;
  font-weight: 400;
}

.card-custom {
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  padding: 30px;
  max-width: 800px;

}

.input-group-text {
  width: auto;
  font-size: clamp(10px, 1rem + 1vw, 12px);
}
.btn-group {
  width: 100%;
  height: 100%;
}
.field-label {
  font-weight: 400;
  font-size: clamp(16px, 2rem + 2vw, 18px);
  color: var(--gray-900);
}
.pop-up-link {
  cursor: pointer;
  color: var(--pink-300);
  text-decoration: underline;
  font-size: clamp(14px, 0.5rem + 0.5vw, 16px);
}
.form-control {
  width: auto;
  color: var(--gray-900);
}
.mb-3-custom {
  margin-bottom: 1.5rem;
}
.result-row {
  height: 180px;
  gap: 40px;
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  margin: 0 auto;
  z-index: 100;
  background-color: var(--pink-50);
  padding: 10px 40px !important;
  transition: all 0.3s ease-in-out;
  max-width: 700px;
  width: calc(100% - 100px);
  border: none !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
}

.result-placeholder {
  display: none; /* Hide the placeholder as we're using margin instead */
}

.result-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 0 0 200px;
  min-width: 200px;
}

.result-block .result-number {
  font-size: clamp(48px, 2rem + 2vw, 64px);
  color: var(--pink-500);
  align-items: flex-end;
  transition: all 0.3s ease-in-out;
}

.result-block .result-number.animate {
  animation: resultPulse 0.5s ease-in-out;
}
@keyframes resultPulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.result-block .unit {
  font-size: clamp(14px, 0.5rem + 0.5vw, 16px);
  color: var(--pink-500);
  white-space: nowrap;
  align-self: center;
}
.right-column {
  display: flex;
  justify-content: space-between;
}

.measure-text {
  font-size: clamp(10px, 1rem + 1vw, 12px);
}

.row-custom {
  display: flex;
  flex-wrap: wrap;          
  justify-content: space-between;
  padding: 30px 160px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  align-items: center;
}

.row-custom.result-row {
  padding: 20px 40px !important;
}

.field-wrapper-btn, .field-wrapper-inpt, .field-wrapper-dbl-inpt {
  flex: 0 1 185px;
  min-width: 150px;
  max-width: 185px;
  height: 85px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0px;
}

.input-group-item {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Container for the height/weight inputs */
.height-weight-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: flex-end;
}

/* Container for each input with its label */
.split-field {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.labels-container {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  position: relative;
}

.split-field-label {
  font-size: clamp(16px, 2rem + 2vw, 18px);
  font-weight: 400;
  color: var(--gray-900);
}

.split-field-label:first-child {
  flex: 0 0 50%;
}

.split-field-label:last-child {
  position: absolute;
  left: 50%;
  text-align: left;
}

.inputs-container {
  display: flex;
  height: 50px;
  border: 1px solid #e0e0e0;
  border-radius: 15px;
  overflow: hidden;
  background-color: white;
}

.split-input-group {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  height: 50px;
}

.split-input-group:first-child {
  border-right: 1px solid #e0e0e0;
}

.split-input {
  position: absolute;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0 12px;
  font-size: clamp(14px, 0.5rem + 0.5vw, 16px);
  z-index: 1;
  color: var(--gray-900);
}

.split-input:focus {
  outline: none;
}

.split-input:focus + .split-input-label {
  color: var(--gray-700);
}

.inputs-container:focus-within {
  border-color: var(--gray-700);
  transition: border-color 0.2s ease;
}

.split-input-label {
  position: absolute;
  right: 12px;
  color: var(--gray-900);
  font-size: clamp(14px, 0.5rem + 0.5vw, 16px);
  z-index: 0;
  background: none;
  padding: 0;
}

/* Make all input groups the same height */
.custom-input-group {
  height: 50px !important;
}

.custom-input {
  height: 50px !important;
  color: var(--gray-900);
}

/* Remove arrows from number inputs */
.split-input::-webkit-inner-spin-button,
.split-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.split-input {
  -moz-appearance: textfield;
  appearance: textfield;
}

.text-wrapper {
  flex: 0 0 auto;
  min-width: 30px;
  max-width: 30px;
  height: 50px;
  display: flex;
  align-items: flex-end;
  padding: 0;
  text-align: center;
  color: var(--gray-300);
  padding-bottom: 17px;
  margin: 0;
}

.mesure-height{
  border-radius: 0px;
}

.input-weight{
  border-radius: 0px;
}

@media (max-width: 768px) {
  .row.d-flex.justify-content-center {
    flex-direction: column; /* Размещаем блоки в колонку */
    gap: 20px; /* Добавляем отступ между блоками */
  }

  .col-md-4.card-custom {
    margin-top: 0; /* Убедитесь, что верхний отступ отсутствует */
    margin-bottom: 40px;
  }
}

.calc-container{
    max-width: 800px;
    gap: 40px;
    position: relative;
    margin: 0 auto;
    margin-bottom: 300px;
}

/* Mobile spacing between calculator sections */
@media (max-width: 768px) {
  .calc-container {
    gap: 20px;
  }
  
  .calc-container .row-custom:not(:last-child) {
    margin-bottom: 20px;
  }
} 

.btn-group {
  border: none;
  display: flex;
  width: 100%;
  height: 100%;
  margin: 0px;
  font-size: clamp(10px, 1rem + 1vw, 12px);
}

.custom-button {
  height: 100%;
  width: 100%;
  background: none;
  font-size: clamp(10px, 2rem + 2vw, 14px);
  border-radius: 15px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--pink-50); /* Цвет фона неактивной кнопки */
  color: var(--pink-500);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.btn-check:checked + .custom-button {
  background-color: var(--pink-500); /* Цвет фона активной кнопки */
  color: var(--pink-50); /* Цвет текста активной кнопки */
}

.btn-check:active + .custom-button {
  background-color: var(--pink-500); /* Цвет фона активной кнопки */
  color: var(--pink-50); /* Цвет текста активной кнопки */
}

.custom-button:hover {
  background-color: var(--pink-500); /* Цвет фона при наведении */
  color: var(--pink-50); /* Цвет текста при наведении */
}

.custom-button:active {
  background-color: var(--pink-500); /* Цвет фона при наведении */
  color: var(--pink-50); /* Цвет текста при наведении */
  border: none;
}

.btn-check:focus + .btn {
  outline: none;
  box-shadow: none;
}

.form-control:focus {
  outline: none; /* Убираем стандартное обрамление */
  box-shadow: none; /* Убираем синюю тень */
  border-color: var(--gray-700); /* Цветная граница при фокусе */
  transition: border-color 0.2s ease;
}

.form-check-input:focus {
  outline: none; /* Убираем стандартное обрамление */
  box-shadow: none; /* Убираем синюю тень */
  border-color: var(--gray-700);
}

.custom-input {
  height: 100%;
  background: none;
  font-size: clamp(14px, 0.5rem + 0.5vw, 16px);
  border-radius: 15px;
  border: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  border-right: none;
  padding: 0 10px;
  transition: border-color 0.2s ease;
}

.input-group-text {
  border-radius: 15px;
  border: 1px solid #e0e0e0;
  border-left: none;
  font-size: clamp(14px, 0.5rem + 0.5vw, 16px);
  padding: 0 10px;
  transition: border-color 0.2s ease;
}

/* Highlight full container on focus */
.custom-input-group:focus-within .custom-input,
.custom-input-group:focus-within .input-group-text {
  border-color: var(--gray-700);
}

.gender-col-custom {
  flex: 0 0 180px;
  max-width: 180px;
}

.fibrillation-custom {
  display: flex;
  padding: 0px;
  height: 85px;
  flex-direction: column;
  justify-content: center;
}

.form-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  height: 50px;
}

.form-check-input {
  margin: 0;
  transform: translateY(-1px);
  touch-action: manipulation;
  cursor: pointer;
}

.form-check-label {
  margin: 0;
  font-size: clamp(16px, 2rem + 2vw, 18px);
  font-weight: 400;
  color: var(--gray-900);
  line-height: 1.2;
}

.form-check-input:checked {
  background-color: var(--pink-500); /* Цвет фона активной кнопки */
  color: var(--pink-50);
  border: #999999;
}

.custom-mesure {
  background: none;
  border-left: none;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Убираем стрелочки в Firefox */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.result-mesure {
  font-size: clamp(14px, 0.5rem + 0.5vw, 16px);
  color: var(--pink-400);
}

.result-text-big {
  font-size: clamp(18px, 1rem + 1vw, 20px);
  font-weight: 500;
  white-space: normal;
  overflow: visible;
  line-height: 1.2;
}

.result-text-small {
  font-size: clamp(14px, 1rem + 1vw, 16px);
  font-weight: 400;
  white-space: normal;
  overflow: visible;
  line-height: 1.2;
  margin-top: 4px;
}

.icon-custom {
  margin-right: 10px;
}

.first-row-custom{
    margin-bottom: 5;
}

.custom-input.inactive, .split-input.inactive {
  background-color: var(--gray-50);
  color: var(--gray-400);
  pointer-events: none;
}

.inputs-container.inactive {
  background-color: var(--gray-50);
}

.inputs-container.inactive .split-input,
.inputs-container.inactive .split-input-label {
  color: var(--gray-400);
  pointer-events: none;
}

.input-group-text.inactive {
  background-color: var(--gray-50);
  color: var(--gray-400);
}

.result-row .col:last-child {
  flex: 1;
  padding-right: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ============================================
   MOBILE RESPONSIVE STYLES - BEST PRACTICES
   ============================================ */

/* Tablet and smaller devices */
@media (max-width: 991px) {
  .row-custom {
    padding: 20px 60px;
  }
}

/* Mobile devices - Primary breakpoint */
@media (max-width: 768px) {
  /* Header adjustments */
  header .py-3 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }
  
  .logo {
    height: 40px !important;
  }
  
  .header-text {
    font-size: 14px;
  }
  
  /* Title adjustments */
  .custom-title {
    text-align: left !important;
    padding: 0 20px;
    margin-bottom: 30px;
  }
  
  .custom-title h1 {
    font-size: clamp(20px, 5vw, 28px);
  }
  
  .custom-title .subtitle {
    font-size: clamp(16px, 4vw, 20px);
    margin-top: 10px;
  }
  
  /* Calculator container */
  .calc-container {
    padding: 0 20px;
    margin-bottom: 220px; /* Space for fixed result bar */
  }
  
  /* Row layout - stack fields vertically */
  .row-custom {
    padding: 30px 20px;
    flex-direction: column;
    gap: 25px;
  }
  
  /* Field wrappers - full width on mobile */
  .field-wrapper-btn, 
  .field-wrapper-inpt, 
  .field-wrapper-dbl-inpt,
  .fibrillation-custom {
    max-width: 100%;
    flex: 1 1 100%;
    min-width: 100%;
    height: auto;
    min-height: 85px;
  }
  
  /* Text wrapper ("или") - adjust for stacked layout */
  .text-wrapper {
    width: 100%;
    max-width: 100%;
    height: auto;
    padding: 8px 0;
    justify-content: center;
    align-items: center;
    text-align: center;
  }
  
  /* Gender buttons - ensure touch-friendly size */
  .custom-button {
    min-height: 48px;
    font-size: 16px;
  }
  
  /* Input fields - ensure touch-friendly */
  .custom-input-group {
    height: 48px !important;
  }
  
  .custom-input {
    height: 48px !important;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .input-group-text {
    font-size: 14px;
    padding: 0 12px;
  }
  
  /* Split inputs (height/weight) */
  .split-input-group {
    height: 48px;
  }
  
  .split-input {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 0 12px;
  }
  
  .split-input-label {
    font-size: 14px;
  }
  
  /* Field labels */
  .field-label {
    font-size: 16px;
    margin-bottom: 12px !important;
  }
  
  .split-field-label {
    font-size: 16px;
  }
  
  .labels-container {
    margin-bottom: 12px;
  }
  
  /* Checkbox - ensure touch-friendly */
  .form-check-input {
    width: 20px;
    height: 20px;
    cursor: pointer;
  }
  
  .form-check-label {
    font-size: 16px;
    cursor: pointer;
  }
  
  .form-check {
    gap: 12px;
    height: auto;
    min-height: 48px;
  }
  
  .fibrillation-custom {
    height: auto;
    min-height: 48px;
  }
  
  /* Result bar - mobile optimization */
  .result-row {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 180px;
    padding: 20px 25px !important;
    padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    margin: 0;
    border-radius: 20px 20px 0 0 !important;
    gap: 20px;
    flex-direction: column;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  }
  
  .result-block {
    flex: 0 0 auto;
    min-width: auto;
    width: 100%;
    justify-content: center;
    gap: 12px;
  }
  
  .result-block .result-number {
    font-size: clamp(40px, 10vw, 56px);
  }
  
  .result-block .unit {
    font-size: 16px;
  }
  
  .icon-custom {
    margin-right: 8px;
  }
  
  .icon-custom img {
    height: 40px !important;
  }
  
  .result-row .col:last-child {
    text-align: center;
    padding: 0;
  }
  
  .result-text-big {
    font-size: clamp(16px, 4vw, 18px);
  }
  
  .result-text-small {
    font-size: clamp(13px, 3.5vw, 14px);
    margin-top: 4px;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .header-text {
    font-size: 12px;
  }
  
  .logo {
    height: 35px !important;
  }
  
  .custom-title {
    padding: 0 16px;
    margin-bottom: 25px;
  }
  
  .calc-container {
    padding: 0 16px;
  }
  
  .row-custom {
    padding: 25px 16px;
    gap: 20px;
  }
  
  .result-row {
    padding: 18px 20px !important;
    padding-bottom: calc(18px + env(safe-area-inset-bottom)) !important;
    min-height: 160px;
    gap: 18px;
  }
  
  .result-block {
    gap: 10px;
  }
  
  .result-block .result-number {
    font-size: clamp(36px, 10vw, 48px);
  }
  
  .result-text-big {
    font-size: 15px;
  }
  
  .result-text-small {
    font-size: 12px;
  }
}

/* Landscape orientation optimization for mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .calc-container {
    margin-bottom: 180px;
  }
  
  .result-row {
    min-height: 120px;
    flex-direction: row;
    gap: 20px;
  }
  
  .result-block {
    width: auto;
  }
  
  .result-row .col:last-child {
    text-align: left;
  }
}

/* Accessibility improvements for touch */
@media (hover: none) and (pointer: coarse) {
  /* Touch device specific styles */
  .custom-button,
  .form-check-input,
  .form-check-label,
  input[type="number"] {
    cursor: pointer;
  }
  
  /* Increase tap target size */
  .custom-button {
    min-height: 48px;
  }
  
  /* Better feedback on touch */
  .custom-button:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
}

/* Prevent horizontal scroll */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }
  
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  /* Ensure all elements stay within viewport */
  * {
    max-width: 100%;
  }
}