/* Apple Style Light - Liquid Glass Design System */

/* Системные переменные */
:root {
  /* Цветовая палитра Apple Light */
  --system-blue: #0051D5;
  --system-green: #2A9D4F;
  --system-indigo: #4A4AC4;
  --system-orange: #E57A00;
  --system-pink: #D92B4C;
  --system-purple: #9642C0;
  --system-red: #D93026;
  --system-teal: #4BA8D8;
  --system-yellow: #E5B800;
  --system-gray: #8E8E93;
  --system-gray2: #AEAEB2;
  --system-gray3: #C7C7CC;
  --system-gray4: #D1D1D6;
  --system-gray5: #E5E5EA;
  --system-gray6: #F2F2F7;

  /* Фоновые цвета */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F2F2F7;
  --bg-tertiary: #FFFFFF;
  --bg-elevated: rgba(255, 255, 255, 0.95);

  /* Текст */
  --text-primary: #000000;
  --text-secondary: #3C3C43;
  --text-tertiary: #3C3C4399;
  --text-quaternary: #3C3C4360;

  /* Glass эффект для светлой темы */
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(60, 60, 67, 0.12);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);

  /* Анимации */
  --transition-default: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-spring: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Сброс и базовые стили */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
  background: linear-gradient(180deg, #F2F2F7 0%, #FFFFFF 50%, #F2F2F7 100%);
  color: var(--text-primary);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
}

/* Мягкий градиентный фон */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  right: -50%;
  bottom: -50%;
  background:
    radial-gradient(circle at 30% 20%, rgba(0, 122, 255, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(52, 199, 89, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 10% 60%, rgba(255, 149, 0, 0.06) 0%, transparent 50%);
  animation: gentleShift 30s ease infinite;
  z-index: -1;
}

@keyframes gentleShift {
  0%, 100% { transform: rotate(0deg) scale(1.5); }
  50% { transform: rotate(180deg) scale(1.5); }
}

/* Контейнер */
.container {
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
}

/* Glass Card - основной компонент */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 20px;
  transition: var(--transition-default);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.8),
    transparent
  );
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

/* Hero Card */
.hero-card {
  padding: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 248, 248, 0.9) 100%);
}

.hero-content {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--system-gray5);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.user-info {
  flex: 1;
}

.name {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.role {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.sync-button {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--system-gray6);
  border: 1px solid var(--glass-border);
  color: var(--system-blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-default);
}

.sync-button:hover {
  background: var(--system-gray5);
  transform: rotate(180deg);
}

/* Metrics Grid */
.metrics-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.metric-card {
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-spring);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 250, 250, 0.95) 100%);
}

.metric-card:hover {
  transform: scale(1.05) translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

.metric-card:active {
  transform: scale(0.98);
}

.metric-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--system-gray6);
  padding: 8px;
}

.metric-value {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
  line-height: 1.2;
}

.metric-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Две колонки */
.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Плитки метрик */
.metric-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--system-gray6);
  border-radius: 12px;
  text-align: center;
}

.tile-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.coin-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.coin {
  width: 24px;
  height: 24px;
  animation: spinCoin 3s linear infinite;
}

@keyframes spinCoin {
  from {
    transform: rotateY(0deg);
  }
  to {
    transform: rotateY(360deg);
  }
}

.coin-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Кнопка магазина */
.btn-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: linear-gradient(135deg, var(--system-green), #228B3F);
  color: white;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(42, 157, 79, 0.25);
}


.btn-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(52, 199, 89, 0.4);
}

/* Подписка */
.sub-card {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.08), rgba(48, 209, 88, 0.08));
  border: 1px solid rgba(52, 199, 89, 0.15);
}

.sub-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px;
}

.sub-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.1), rgba(48, 209, 88, 0.1));
  border: 1px solid rgba(52, 199, 89, 0.2);
  border-radius: 12px;
}

.sub-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sub-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

.sub-days {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.sub-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--system-yellow), var(--system-orange));
  color: white;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(255, 149, 0, 0.3);
}

.sub-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 149, 0, 0.4);
}

/* Новые стили для кнопок подписки */
.sub-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sync-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--system-gray6);
  border: 1px solid var(--system-gray4);
  color: var(--system-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  flex-shrink: 0;
}

.sync-btn:hover {
  background: white;
  border-color: var(--system-green);
  color: var(--system-green);
  transform: rotate(180deg);
}

.sync-btn svg {
  width: 18px;
  height: 18px;
}

/* Статистика */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 8px;
}

.stat-box {
  text-align: center;
  padding: 12px;
  background: var(--system-gray6);
  border-radius: 12px;
}

.stat-box .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-box .stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Workout Button - главная кнопка */
.workout-button {
  width: 100%;
  padding: 20px;
  border-radius: 20px;
  border: none;
  background: linear-gradient(135deg, var(--system-orange), #FF6B00);
  color: white;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-spring);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(255, 149, 0, 0.3);
}

.workout-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.5s;
}

.workout-button:hover::before {
  left: 100%;
}

.workout-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(255, 149, 0, 0.4);
}

.workout-button:active {
  transform: translateY(0);
}

.workout-button:disabled {
  background: linear-gradient(135deg, var(--system-green), #30D158);
  opacity: 1;
  cursor: not-allowed;
  box-shadow: 0 10px 30px rgba(52, 199, 89, 0.3);
}

.workout-button:disabled .button-text::after {
  content: " ✓";
  color: white;
  font-weight: 700;
}

.workout-button:disabled:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(52, 199, 89, 0.4);
}

.button-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.button-icon {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Review Button */
.review-button {
  display: block;
  width: 100%;
  padding: 16px 20px;
  margin-top: 12px;
  border-radius: 20px;
  background: var(--bg-elevated);
  border: 2px solid var(--system-green);
  color: var(--system-green);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.review-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  background: linear-gradient(135deg, var(--system-green), #228B3F);
  color: white;
  border-color: transparent;
}

.review-button:active {
  transform: scale(0.98);
}

.review-button .button-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-button .button-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.review-button .button-text {
  flex-grow: 1;
  text-align: left;
  margin-left: -4px;
  color: inherit;
}

.review-button .button-reward {
  background: linear-gradient(135deg, #FFB800, #E5A000);
  color: white;
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(229, 160, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Progress Card */
.progress-card {
  padding: 0;
  overflow: hidden;
  background: var(--bg-elevated);
  position: relative;
}

.tab-header {
  display: flex;
  padding: 8px;
  gap: 8px;
  background: var(--system-gray6);
}

.tab-button {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 12px;
  transition: var(--transition-default);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-button.active {
  background: white;
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-button svg {
  transition: all 0.3s ease;
  width: 20px;
  height: 20px;
}

.tab-button:hover svg {
  transform: scale(1.15);
}

#prevBtn svg {
  stroke: var(--system-orange);
  color: var(--system-orange);
}

#nextBtn svg {
  stroke: var(--system-green);
  color: var(--system-green);
}

.tab-button.active svg {
  filter: brightness(0.9);
}

.tab-button:hover:not(.active) {
  background: rgba(255, 255, 255, 0.5);
}

.carousel-track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.carousel-slide {
  min-width: 100%;
  padding: 20px;
  min-height: 280px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* Calendar */
.calendar-container {
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.month-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--system-gray6);
  color: var(--system-blue);
  cursor: pointer;
  transition: var(--transition-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.month-btn:hover {
  background: var(--system-gray5);
  transform: scale(1.1);
}

.calendar-grid, .grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.weekday {
  font-size: 10px;
  text-align: center;
  color: var(--text-quaternary);
  font-weight: 600;
  padding: 8px 0;
  text-transform: uppercase;
}

.day {
  aspect-ratio: 1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  background: var(--system-gray6);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-default);
  position: relative;
}

.day:hover {
  background: var(--system-gray5);
  transform: scale(1.1);
}

.day.today {
  background: linear-gradient(135deg, var(--system-blue), var(--system-indigo));
  color: white;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.day.done {
  background: linear-gradient(135deg, var(--system-green), #228B3F);
  color: white;
  box-shadow: 0 4px 12px rgba(42, 157, 79, 0.25);
}

.day.missed {
  background: rgba(217, 48, 38, 0.1);
  color: var(--system-red);
  border: 1px solid rgba(217, 48, 38, 0.15);
  font-weight: 500;
}

.day.future {
  opacity: 0.4;
  cursor: not-allowed;
}

.day.streak::after {
  content: '🔥';
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 16px;
  animation: flameBurn 1s infinite;
}

@keyframes flameBurn {
  0%, 100% { transform: scale(1) rotate(-5deg); }
  50% { transform: scale(1.1) rotate(5deg); }
}

.calendar-stats {
  display: flex;
  justify-content: space-around;
  padding: 12px;
  background: var(--system-gray6);
  border-radius: 12px;
  margin-top: 12px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Statistics */
.stats-container {
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  height: 100%;
  justify-content: center;
}

.progress-ring, .ring {
  width: 200px;
  height: 200px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
  margin: -10px auto 0;
}

.stats-details {
  display: flex;
  gap: 28px;
  justify-content: center;
  margin-top: 10px;
  width: 100%;
  align-items: center;
}

.kpi-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.kpi-number {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.5px;
}

.kpi-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  opacity: 0.8;
  text-transform: lowercase;
  margin-top: -2px;
}

.kpi.orange .kpi-number { color: var(--system-orange); }
.kpi.green .kpi-number { color: var(--system-green); }
.kpi.blue .kpi-number { color: var(--system-blue); }

.kpi-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 600;
  margin-top: 2px;
}

/* Links Grid */
.links-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.links-grid-two {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 20px;
  margin-bottom: 12px;
}

.glass-link {
  padding: 16px 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: var(--transition-default);
}

.glass-link:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.glass-link svg {
  opacity: 0.6;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  max-width: 400px;
  width: 90%;
  padding: 32px;
  animation: slideUp 0.3s;
  background: white !important;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.modal-text {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 14px;
}

.modal-input {
  width: 100%;
  padding: 16px;
  background: var(--system-gray6);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 16px;
  margin-bottom: 24px;
  transition: var(--transition-default);
}

.modal-input:focus {
  outline: none;
  border-color: var(--system-blue);
  background: white;
}

.modal-input::placeholder {
  color: var(--text-quaternary);
}

.modal-buttons {
  display: flex;
  gap: 12px;
}

.modal-button {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-default);
}

.modal-button.cancel {
  background: var(--system-gray6);
  color: var(--text-primary);
}

.modal-button.cancel:hover {
  background: var(--system-gray5);
}

.modal-button.confirm {
  background: linear-gradient(135deg, var(--system-blue), var(--system-indigo));
  color: white;
}

.modal-button.confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.3);
}

/* Animations */
.glass-card {
  animation: slideIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Media Queries */
@media (max-width: 480px) {
  .container {
    padding: 10px;
  }

  .metrics-grid {
    gap: 12px;
  }

  .metric-value {
    font-size: 28px;
  }

  .links-grid {
    gap: 8px;
  }

  .glass-link {
    padding: 12px 8px;
    font-size: 11px;
  }
}