/* --------- БАЗА --------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui,
    -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #020617;
  color: #0f172a;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* безопасные отступы под вырезы iPhone */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* --------- SPLASH --------- */

#splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: radial-gradient(circle at 0 0, #00a0e3 0, #005b88 45%, #020617 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.splash__logo {
  width: 120px;
  height: 120px;
  border-radius: 32px;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  animation: splash-pop 0.6s ease-out;
}

.splash__logo img {
  max-width: 80%;
  max-height: 80%;
}

.splash__title {
  margin-top: 20px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.splash__subtitle {
  margin-top: 8px;
  font-size: 14px;
  opacity: 0.9;
}

/* линия загрузки */
.splash__loader {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.splash__loader-bar {
  width: 160px;
  height: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
  overflow: hidden;
}

.splash__loader-bar span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: #ffffff;
  animation: splash-loading 1.1s ease-in-out infinite;
}

.splash__loader-text {
  font-size: 13px;
  opacity: 0.9;
}

.splash--hide {
  opacity: 0;
  transition: opacity 0.4s ease;
}

@keyframes splash-pop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes splash-loading {
  0% {
    transform: translateX(-60%);
  }
  50% {
    transform: translateX(40%);
  }
  100% {
    transform: translateX(120%);
  }
}

/* --------- АВТОРИЗАЦИЯ --------- */

#auth-screen {
  min-height: 100vh;
  padding: calc(16px + var(--safe-top)) 16px 32px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: radial-gradient(circle at 0 0, #0b1f33 0, #020617 55%, #000000 100%);
  color: #e5e7eb;
}

.auth-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-hero__logo {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7);
}

.auth-hero__logo img {
  max-width: 80%;
  max-height: 80%;
}

.auth-hero__title {
  font-size: 24px;
  font-weight: 700;
}

.auth-hero__subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: #9ca3af;
}

.auth-tabs {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  padding: 4px;
  margin-bottom: 16px;
}

.auth-tabs__btn {
  border: none;
  background: transparent;
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 13px;
  color: #9ca3af;
  cursor: pointer;
}

.auth-tabs__btn--active {
  background: #00a0e3;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(0, 160, 227, 0.6);
}

.auth-card {
  background: rgba(15, 23, 42, 0.92);
  border-radius: 24px;
  padding: 18px 16px 16px;
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(22px);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form__group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.label {
  font-size: 12px;
  color: #cbd5e1;
}

.input,
.select {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #1f2937;
  padding: 0 12px;
  font-size: 14px;
  color: #e5e7eb;
  background: rgba(15, 23, 42, 0.9);
  outline: none;
}

.input::placeholder {
  color: #6b7280;
}

.select {
  padding-right: 28px;
}

.input:focus,
.select:focus {
  border-color: #00a0e3;
  box-shadow: 0 0 0 1px rgba(0, 160, 227, 0.55);
}

.btn {
  border-radius: 999px;
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #00a0e3;
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(0, 160, 227, 0.7);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 8px 18px rgba(0, 160, 227, 0.6);
}

.btn--outline {
  background: transparent;
  border: 1px solid rgba(15, 23, 42, 0.8);
  color: #111827;
  box-shadow: none;
}

.btn--small {
  padding: 8px 14px;
  font-size: 13px;
}

.auth-form__submit {
  margin-top: 4px;
  width: 100%;
}

.auth-form__hint {
  margin-top: 4px;
  font-size: 11px;
  color: #9ca3af;
}

.auth-error {
  margin-top: 12px;
  font-size: 12px;
  color: #fecaca;
}

/* --------- APP SHELL --------- */

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #f4f6fb;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: calc(64px + var(--safe-bottom));
}

.app-header {
  padding: calc(8px + var(--safe-top)) 16px 8px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
  z-index: 20;
}

.app-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header__title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.app-header__subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: #6b7280;
}

.search {
  margin-top: 8px;
}

.search__field {
  position: relative;
}

.search__input {
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  padding: 0 38px 0 34px;
  font-size: 14px;
  background: #f9fafb;
  outline: none;
}

.search__input::placeholder {
  color: #9ca3af;
}

.search__icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.6;
}

/* основной контент */

.app-main {
  flex: 1 1 auto;
  padding: 10px 16px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* каждая страница отдельно */
.page {
  display: none;
}

.page--active {
  display: block;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #111827;
}

/* --------- HOME --------- */

.last-workout {
  border-radius: 18px;
  padding: 14px 14px 12px;
  background: linear-gradient(135deg, #00a0e3, #005b88);
  color: #ffffff;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.last-workout::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.22);
  right: -40px;
  bottom: -70px;
}

.last-workout__title {
  font-size: 14px;
  font-weight: 600;
}

.last-workout__date {
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.9;
}

.last-workout__status {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(15, 23, 42, 0.35);
}

.last-workout__status--in-progress {
  background: rgba(250, 176, 5, 0.9);
}

.last-workout__status--completed {
  background: rgba(34, 197, 94, 0.9);
}

.plans-section {
  margin-top: 6px;
}

.plans-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.plans-carousel::-webkit-scrollbar {
  height: 4px;
}

.plans-carousel::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.7);
  border-radius: 999px;
}

.plan-card {
  min-width: 210px;
  flex-shrink: 0;
  background: #ffffff;
  border-radius: 18px;
  padding: 12px 12px 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-card__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.plan-card__name {
  font-size: 14px;
  font-weight: 600;
}

.plan-card__price {
  font-size: 18px;
  font-weight: 700;
  color: #00a0e3;
}

.plan-card__period {
  font-size: 11px;
  color: #6b7280;
}

.plan-card__features {
  list-style: none;
  padding: 0;
  margin: 2px 0 4px;
  font-size: 11px;
  color: #4b5563;
}

.plan-card__features li {
  margin-bottom: 3px;
}

.plan-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.plan-card__badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(0, 160, 227, 0.1);
  color: #00a0e3;
}

/* --------- ТРЕНИРОВКИ --------- */

.training-banner {
  border-radius: 18px;
  background: linear-gradient(135deg, #022c43, #00a0e3);
  color: #ffffff;
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.training-banner__text {
  font-size: 13px;
  max-width: 72%;
}

.training-banner__label {
  font-size: 11px;
  opacity: 0.85;
}

.training-banner__cta {
  margin-top: 4px;
  font-size: 12px;
}

.training-banner__stub {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.training-banner__stub img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.training-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.training-card {
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  cursor: pointer;
}

.training-card__banner {
  height: 54px;
  background: radial-gradient(circle at 0 0, #00a0e3 0, #022c43 65%);
  display: flex;
  align-items: flex-start;
  padding: 8px 10px;
}

.training-card__banner-label {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.training-card__body {
  padding: 10px 12px 10px;
}

.training-card__title {
  font-size: 13px;
  font-weight: 600;
}

.training-card__desc {
  margin-top: 4px;
  font-size: 11px;
  color: #6b7280;
}

.training-card__footer {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.training-card__progress {
  font-size: 11px;
  color: #9ca3af;
}

/* --------- МОДАЛКА ТРЕНИРОВКИ --------- */

.training-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.training-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.training-overlay__content {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  padding: 8px 16px 18px;
  box-shadow: 0 -20px 40px rgba(15, 23, 42, 0.6);
  animation: overlay-up 0.25s ease-out;
}

@keyframes overlay-up {
  from {
    transform: translateY(18px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.training-overlay__header {
  display: flex;
  justify-content: flex-end;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.training-step__title {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 600;
}

.training-step__subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: #6b7280;
}

.training-step__btn {
  margin-top: 16px;
  width: 100%;
}

.training-step__nav {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.mood-stars {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.mood-stars__item {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #cbd5e1;
  cursor: pointer;
}

.mood-stars__item--active {
  border-color: #00a0e3;
  background: rgba(0, 160, 227, 0.06);
  color: #00a0e3;
}

/* список упражнений */

.exercise-list {
  margin-top: 14px;
  list-style: none;
  padding: 0;
}

.exercise-list__item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}

.exercise-list__icon {
  width: 20px;
  display: flex;
  justify-content: center;
  color: #00a0e3;
}

.exercise-list__name {
  font-size: 13px;
  font-weight: 500;
}

.exercise-list__desc {
  font-size: 11px;
  color: #6b7280;
}

/* упражнение */

.exercise-visual {
  margin-top: 14px;
}

.exercise-visual__box {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: radial-gradient(circle at 0 0, #00a0e3 0, #022c43 65%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.exercise-visual__icon {
  font-size: 42px;
  color: #ffffff;
}

.timer {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.timer__btn {
  width: 48px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  font-size: 16px;
  cursor: pointer;
}

.timer__value {
  min-width: 80px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
}

/* --------- ПРОГРЕСС --------- */

.progress-summary {
  border-radius: 18px;
  background: #ffffff;
  padding: 12px 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.progress-summary__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.progress-summary__percent {
  font-size: 24px;
  font-weight: 700;
  color: #00a0e3;
}

.progress-summary__label {
  font-size: 11px;
  color: #6b7280;
}

.progress-summary__stats {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #4b5563;
}

.progress-bar {
  margin-top: 10px;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #00a0e3, #38bdf8);
  transition: width 0.3s ease;
}

.progress-weeks {
  margin-top: 12px;
  display: flex;
  gap: 2px;
}

.week-bar {
  flex: 1;
  height: 18px;
  border-radius: 999px;
  background: #e5e7eb;
}

.week-bar--done {
  background: rgba(0, 160, 227, 0.85);
}

/* --------- ПРОФИЛЬ --------- */

.profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 20px;
  background: #e0f2fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0284c7;
  background-size: cover;
  background-position: center;
}

.profile-name {
  font-size: 16px;
  font-weight: 600;
}

.profile-role {
  font-size: 12px;
  color: #6b7280;
}

.profile-form {
  background: #ffffff;
  border-radius: 18px;
  padding: 14px 14px 16px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  margin-bottom: 12px;
}

.profile-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-form__row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-form__row--full {
  margin-top: 10px;
}

.profile-textarea {
  width: 100%;
  min-height: 70px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  font-size: 13px;
  background: #f9fafb;
  resize: vertical;
  outline: none;
}

.profile-textarea:focus {
  border-color: #00a0e3;
  box-shadow: 0 0 0 1px rgba(0, 160, 227, 0.5);
  background: #ffffff;
}

.profile-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.profile-message {
  margin-top: 8px;
  font-size: 12px;
  color: #16a34a;
}

.password-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 12px 14px 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.password-card__title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.profile-logout {
  margin-top: 12px;
}

.profile-logout__btn {
  width: 100%;
}

/* --------- TAB BAR (нижнее меню) --------- */

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  box-shadow: 0 -1px 0 rgba(148, 163, 184, 0.35);
  padding-bottom: var(--safe-bottom);
  display: flex;              /* ВАЖНО: делаем flex-контейнер */
}

.tabbar__item {
  flex: 1 1 0;                /* Каждой кнопке ровно четверть ширины */
  border: none;
  background: transparent;
  padding: 6px 0 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #9ca3af;
  font-size: 10px;
  cursor: pointer;
}

.tabbar__icon {
  font-size: 18px;
}

.tabbar__item--active {
  color: #00a0e3;
}


/* --------- МЕДИА --------- */

@media (min-width: 768px) {
  #auth-screen,
  .app-shell {
    margin: 0 auto;
    max-width: 480px;
  }
}
