:root {
  --primary-gradient: var(--accent);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(255, 255, 255, 0.2);
  --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 20px 40px rgba(0, 0, 0, 0.15);
  --border-radius: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Page Container */
.calculator-page {
  background: var(--bg);
  padding-top: 4rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100%;
  padding-left: 2rem;
  padding-right: 2rem;
}

/* Override для app layout — убираем padding с .app-main */
.app-page .app-main {
  padding-left: 0 !important;
  padding-right: 0 !important;
  max-width: 100% !important;
}


/* Main Container */
.container {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  padding: 30px;
  box-shadow: var(--shadow-medium);
  width: 100%;
  max-width: 500px;
  border: 1px solid var(--glass-border);
  margin: 2rem auto;
  opacity: 0;
  transform: translateY(30px) scale(0.98);
  animation: containerSlideUp 0.6s ease-out 0.4s forwards;
}

@keyframes containerSlideUp {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Header */
h2 {
  text-align: center;
  color: #333;
  margin-bottom: 30px;
  font-size: 28px;
  font-weight: 600;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
  opacity: 0;
  transform: translateY(20px);
  animation: titleFade 0.5s ease-out 0.6s forwards;
}

@keyframes titleFade {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
  opacity: 0;
  transform: translateX(-20px);
  animation: formGroupSlide 0.4s ease-out forwards;
}

.form-group:nth-child(2) {
  animation-delay: 0.8s;
}
.form-group:nth-child(3) {
  animation-delay: 0.9s;
}
.form-group:nth-child(4) {
  animation-delay: 1s;
}
.form-group:nth-child(5) {
  animation-delay: 1.1s;
}
.form-group:nth-child(6) {
  animation-delay: 1.2s;
}
.form-group:nth-child(7) {
  animation-delay: 1.3s;
}
.form-group:nth-child(8) {
  animation-delay: 1.4s;
}

@keyframes formGroupSlide {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

label {
  display: block;
  margin-bottom: 8px;
  color: #555;
  font-weight: 500;
  font-size: 14px;
}

label span {
  font-size: 0.9em;
  color: #777;
}

input[type="number"],
select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e1e5e9;
  border-radius: 12px;
  font-size: 16px;
  transition: var(--transition);
  background: #fff;
  color: #333;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8861a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

input[type="number"]:hover,
select:hover {
  border-color: var(--accent);
}

input::placeholder {
  color: #aaa;
  font-style: italic;
}

/* Slider Components */
input[type="range"] {
  width: 100%;
  height: 8px;
  background: linear-gradient(135deg, #e1e5e9 0%, #f0f4f8 100%);
  border-radius: 10px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  margin: 10px 0;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary-gradient);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
  transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary-gradient);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
  transition: var(--transition);
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

input[type="range"]::-moz-range-track {
  height: 8px;
  background: linear-gradient(135deg, #e1e5e9 0%, #f0f4f8 100%);
  border-radius: 10px;
  border: none;
}

output {
  font-weight: bold;
  color: var(--accent);
  font-size: 16px;
  margin-left: 10px;
}

.slider-group {
  background: rgba(102, 126, 234, 0.05);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid rgba(102, 126, 234, 0.1);
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
  color: var(--accent);
  font-weight: bold;
  margin-left: 5px;
  z-index: 999999;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 320px;
  background-color: #f9f9f9;
  color: #333;
  text-align: left;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid #ddd;
  position: absolute;
  z-index: 999999;
  bottom: 125%;
  left: 0;
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: var(--shadow-medium);
  font-size: 13px;
  line-height: 1.4;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* Button */
.calculate-btn {
  width: 100%;
  padding: 15px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  transform: translateY(20px);
  animation: buttonSlide 0.5s ease-out 1.6s forwards;
}

@keyframes buttonSlide {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.calculate-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.calculate-btn:active {
  transform: translateY(-1px);
}

/* Results */
.result {
  margin-top: 25px;
  padding: 20px;
  background: var(--secondary-gradient);
  color: white;
  border-radius: 15px;
  font-size: 16px;
  line-height: 1.6;
  box-shadow: 0 10px 20px rgba(240, 147, 251, 0.3);
  animation: resultSlideIn 0.6s ease-out;
}

.result strong {
  font-weight: 600;
}

@keyframes resultSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Mobile Adaptations */
@media (max-width: 768px) {
  .calculator-page {
    padding: 1rem;
    padding-top: 5rem;
  }

  .container {
    padding: 25px 20px;
    border-radius: 15px;
    max-width: 100%;
    margin: 0;
  }

  h2 {
    font-size: 24px;
    margin-bottom: 25px;
  }

  input[type="number"],
  select {
    padding: 14px 16px;
    font-size: 16px;
  }

  .calculate-btn {
    padding: 16px;
    font-size: 16px;
  }

  .tooltip .tooltiptext {
    width: 280px;
    font-size: 12px;
  }

  .slider-group {
    padding: 12px;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }

  input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 480px) {
  .calculator-page {
    padding: 0.5rem;
    padding-top: 4.5rem;
  }

  .container {
    padding: 20px 15px;
  }

  h2 {
    font-size: 20px;
  }

  .tooltip .tooltiptext {
    width: 250px;
  }

  output {
    font-size: 14px;
  }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .calculator-page {
    padding-top: 1rem;
  }

  .container {
    padding: 15px;
    margin: 0.5rem auto;
  }

  .form-group {
    margin-bottom: 12px;
  }

  .slider-group {
    padding: 8px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .container,
  h2,
  .form-group,
  .calculate-btn {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
/* Override: app layout — stretch calculator full width & height */
.app-page .app-main {
  padding: 0 !important;
  max-width: 100% !important;
  min-height: 0 !important;
}
.app-page .calculator-page {
  min-height: calc(100vh - 58px);
  padding-top: 3rem;
  padding-bottom: 4rem;
}
/* Subtitle description block */
.subtitle {
  text-align: center;
  font-size: 14px;
  color: #f0f0f0;
  font-weight: 400;
  margin-bottom: 24px;
  line-height: 1.6;
  padding: 14px 20px;
  background: var(--accent-light, rgba(232,134,26,.08));
  border: 1px solid rgba(232,134,26,.2);
  border-radius: 12px;
}