body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* iOS safe area - allow natural scrolling */
  overflow-x: hidden;
  overflow-y: auto;
  /* Dynamic viewport height for better iOS compatibility */
  min-height: 100dvh;
  min-height: 100vh; /* Fallback for older browsers */
  min-height: -webkit-fill-available; /* iOS Safari fallback */
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
    monospace;
}

* {
  box-sizing: border-box;
}

/* CSS Custom Properties for viewport height fallbacks */
:root {
  /* Define viewport height variables for better iOS compatibility */
  --vh-full: 100vh;
  --vh-dynamic: 100dvh;
  --vh-webkit: -webkit-fill-available;
}

/* Support for older browsers that don't support dvh */
@supports not (height: 100dvh) {
  :root {
    --vh-dynamic: var(--vh-webkit, var(--vh-full));
  }
}

#root {
  /* Dynamic viewport height for better iOS compatibility */
  min-height: 100dvh;
  min-height: 100vh; /* Fallback for older browsers */
  min-height: -webkit-fill-available; /* iOS Safari fallback */
  /* iOS safe area support - only add side padding */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  /* No top/bottom padding to avoid giant indents */
}

.follow-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  font-family: inherit;
  text-decoration: none;
  outline: none;
}

.follow-button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* Размеры кнопок */
.follow-button--small {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 28px;
}

.follow-button--medium {
  padding: 8px 16px;
  font-size: 14px;
  min-height: 36px;
}

.follow-button--large {
  padding: 12px 20px;
  font-size: 16px;
  min-height: 44px;
}

/* Стили для кнопки подписки */
.follow-button--primary {
  background: linear-gradient(45deg, #405DE6, #5851DB, #833AB4, #C13584, #E1306C, #FD1D1D, #F56040, #F77737, #FCAF45, #FFDC80);
  color: white;
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

.follow-button--primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

/* Стили для кнопки отписки */
.follow-button--following {
  background: #fff;
  color: #262626;
  border: 1px solid #dbdbdb;
}

.follow-button--following:hover:not(:disabled) {
  background: #f9f9f9;
  color: #ed4956;
  border-color: #ed4956;
}

.follow-button--following:hover:not(:disabled) span {
  color: #ed4956;
}

/* Альтернативный стиль - outline */
.follow-button--outline {
  background: transparent;
  color: #405DE6;
  border: 2px solid #405DE6;
}

.follow-button--outline:hover:not(:disabled) {
  background: #405DE6;
  color: white;
}

/* Анимация градиента */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Анимация загрузки */
.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Эффект ripple для кнопки */
.follow-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
  transform: scale(0);
  transition: transform 0.3s ease;
  pointer-events: none;
}

.follow-button:active::before {
  transform: scale(1);
}

/* Адаптивность */
@media (max-width: 480px) {
  .follow-button--large {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 40px;
  }
  
  .follow-button--medium {
    padding: 6px 12px;
    font-size: 13px;
    min-height: 32px;
  }
}

.follow-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.follow-stats--small {
  gap: 8px;
  padding: 4px 0;
}

.follow-stats--large {
  gap: 16px;
  padding: 12px 0;
}

.follow-stat {
  flex: 1 1;
  min-width: 0;
}

.follow-stat--clickable {
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 8px;
  transition: all 0.2s ease;
}

.follow-stat--clickable:hover {
  background: rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.follow-stat--clickable:active {
  transform: translateY(0);
  background: rgba(0, 0, 0, 0.1);
}

.follow-stat__content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.follow-stats--small .follow-stat__content {
  gap: 6px;
}

.follow-stats--large .follow-stat__content {
  gap: 10px;
}

.follow-stat__icon {
  color: #8e8e8e;
  flex-shrink: 0;
}

.follow-stat--clickable:hover .follow-stat__icon {
  color: #262626;
}

.follow-stat__numbers {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.follow-stat__count {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  color: #262626;
  white-space: nowrap;
}

.follow-stats--small .follow-stat__count {
  font-size: 14px;
}

.follow-stats--large .follow-stat__count {
  font-size: 18px;
}

.follow-stat__label {
  font-size: 12px;
  color: #8e8e8e;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.follow-stats--small .follow-stat__label {
  font-size: 11px;
}

.follow-stats--large .follow-stat__label {
  font-size: 13px;
}

.follow-stats__divider {
  width: 1px;
  height: 24px;
  background: #dbdbdb;
  flex-shrink: 0;
}

.follow-stats--small .follow-stats__divider {
  height: 20px;
}

.follow-stats--large .follow-stats__divider {
  height: 28px;
}

/* Компактный режим без меток */
.follow-stats:not(.follow-stats--show-labels) .follow-stat__content {
  flex-direction: row;
  gap: 6px;
}

.follow-stats:not(.follow-stats--show-labels) .follow-stat__numbers {
  flex-direction: row;
  align-items: center;
}

.follow-stats:not(.follow-stats--show-labels) .follow-stat__count {
  margin-right: 4px;
}

/* Анимации */
.follow-stat__count {
  transition: all 0.2s ease;
}

.follow-stat--clickable:hover .follow-stat__count {
  color: #000;
}

/* Адаптивность */
@media (max-width: 480px) {
  .follow-stats {
    gap: 8px;
  }
  
  .follow-stat__count {
    font-size: 14px;
  }
  
  .follow-stat__label {
    font-size: 11px;
  }
  
  .follow-stats__divider {
    height: 20px;
  }
}

/* Dark mode tweaks for better contrast */
@media (prefers-color-scheme: dark) {
  .follow-stat--clickable:hover {
    background: rgba(255, 255, 255, 0.06);
  }

  .follow-stat--clickable:active {
    background: rgba(255, 255, 255, 0.12);
  }

  .follow-stat__icon {
    color: #cbd5e1;
  }

  .follow-stat--clickable:hover .follow-stat__icon {
    color: #e5e7eb;
  }

  .follow-stat__count {
    color: #e5e7eb;
  }

  .follow-stat__label {
    color: #94a3b8;
  }

  .follow-stats__divider {
    background: #334155;
  }
}

.users-list {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.users-list-header {
  text-align: center;
  margin-bottom: 32px;
}

.users-list-header h2 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 600;
  color: #1f2937;
}

.users-list-header p {
  margin: 0;
  color: #6b7280;
  font-size: 16px;
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  grid-gap: 20px;
  gap: 20px;
  margin-bottom: 40px;
}

.user-card-mini {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.user-card-mini:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.user-card-mini-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.user-avatar-mini {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar-mini .avatar-image-mini {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.user-info {
  flex: 1 1;
  min-width: 0;
}

.user-info h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-profession {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-bio {
  margin: 12px 0;
  font-size: 14px;
  color: #4b5563;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.user-skills-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
  align-items: center;
}

.skill-tag-mini {
  background: #e0e7ff;
  color: #3730a3;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.skills-more {
  background: #f3f4f6;
  color: #6b7280;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.user-card-mini-footer {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f3f4f6;
}

.view-profile-btn {
  flex: 1 1;
  padding: 8px 12px;
  background: transparent;
  color: #6b7280;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-profile-btn:hover {
  background: #f9fafb;
  color: #374151;
  border-color: #9ca3af;
}

.users-list-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #6b7280;
}

.users-list-loading p {
  margin-top: 16px;
  font-size: 16px;
}

.users-list-error {
  text-align: center;
  padding: 60px 20px;
  color: #dc2626;
}

.no-users {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #9ca3af;
}

.no-users p {
  margin-top: 16px;
  font-size: 16px;
}

.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Адаптивность */
@media (max-width: 768px) {
  .users-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .users-list {
    padding: 16px;
  }
  
  .users-list-header h2 {
    font-size: 24px;
  }
  
  .user-card-mini {
    padding: 16px;
  }
  
  .user-card-mini-footer {
    flex-direction: column;
  }
  
  .view-profile-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .users-list-header {
    margin-bottom: 24px;
  }
  
  .users-list-header h2 {
    font-size: 20px;
  }
  
  .users-list-header p {
    font-size: 14px;
  }
  
  .user-card-mini-header {
    gap: 10px;
  }
  
  .user-avatar-mini {
    width: 40px;
    height: 40px;
  }
  
  .user-info h3 {
    font-size: 15px;
  }
  
  .user-profession {
    font-size: 13px;
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .users-list-header h2 {
    color: #e5e7eb;
  }
  
  .users-list-header p {
    color: #9ca3af;
  }
  
  .user-card-mini {
    background: #1f2937;
    border-color: #374151;
  }
  
  .user-info h3 {
    color: #e5e7eb;
  }
  
  .user-profession {
    color: #9ca3af;
  }
  
  .user-bio {
    color: #d1d5db;
  }
  
  .skill-tag-mini {
    background: #1e40af;
    color: #ddd6fe;
  }
  
  .skills-more {
    background: #374151;
    color: #9ca3af;
  }
  
  .user-card-mini-footer {
    border-top-color: #374151;
  }
  
  .view-profile-btn {
    background: transparent;
    color: #9ca3af;
    border-color: #4b5563;
  }
  
  .view-profile-btn:hover {
    background: #374151;
    color: #e5e7eb;
    border-color: #6b7280;
  }
  
  .users-list-loading {
    color: #9ca3af;
  }
  
  .users-list-error {
    color: #f87171;
  }
  
  .no-users {
    color: #6b7280;
  }
}

.page-header {
  margin-bottom: 32px;
}
.page-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.page-title {
  display: flex;
  align-items: center;
  gap: 16px;
}
.page-title svg {
  color: #667eea;
  flex-shrink: 0;
}
.page-title h1 {
  margin: 0 0 4px 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}
.page-title p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 16px;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hide-on-mobile {
}

@media (max-width: 768px) {
  .page-header {
    display: none; /* Hide on mobile - use MobileHeader instead */
  }
}

@media (max-width: 480px) {
  .page-header {
    margin-bottom: 12px;
  }
  .page-header-content {
    margin-bottom: 12px;
  }
  .page-title h1 {
    font-size: 18px;
  }
}

/* Mobile Menu Toggle Button - Now handled by MobileHeader */
.mobile-menu-toggle {
  display: none;
}

/* Desktop Sidebar */
.sidebar.desktop {
  position: fixed;
  left: 0;
  top: 0;
  width: 280px;
  height: 100vh;
  height: -webkit-fill-available;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow-y: auto;
  transition: width 0.3s ease, transform 0.3s ease;
  /* Ensure sidebar content is fully visible */
  padding-bottom: env(safe-area-inset-bottom);
}

/* Mobile Sidebar */
.mobile-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

.mobile-sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sidebar.mobile {
  position: fixed;
  left: 0;
  top: 0;
  width: 280px;
  height: 100vh;
  height: -webkit-fill-available;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* Ensure sidebar content is fully visible */
  padding-bottom: env(safe-area-inset-bottom);
}

.sidebar.mobile.open {
  transform: translateX(0);
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

/* Sidebar Content */
.sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px 0;
  /* Ensure content doesn't get cut off */
}

/* Убираем отступы в свернутом состоянии */
.sidebar.desktop.collapsed .sidebar-content {
  padding: 0;
  margin: 0;
  height: 100vh;
  width: 100%;
  min-height: 100vh;
}

/* Убираем отступ сверху в развернутом состоянии */
.sidebar.desktop:not(.collapsed) .sidebar-content {
  padding: 0 0 24px 0;
}

/* Старые правила удалены - используем .sidebar.desktop.collapsed */

.sidebar.desktop.collapsed .sidebar-nav-item span {
  display: none;
}

.sidebar.desktop.collapsed .sidebar-nav-item:hover {
  background: var(--bg-hover);
  transform: scale(1.05);
}

.sidebar.desktop.collapsed .sidebar-nav-item.active {
  background: var(--bg-accent);
  color: white;
  transform: scale(1.05);
}

.sidebar.desktop.collapsed .sidebar-actions {
  padding: 8px 4px 8px;
  gap: 4px;
  margin-top: auto;
}

.sidebar.desktop.collapsed .sidebar-action-btn {
  padding: 12px;
  justify-content: center;
  border-radius: 8px;
  min-height: 44px;
}

.sidebar.desktop.collapsed .sidebar-action-btn span {
  display: none;
}

/* Специальные стили для кнопок в свернутом состоянии */
.sidebar.desktop.collapsed .sidebar-action-btn.login {
  background: var(--bg-accent);
  color: white;
  border: none;
}

.sidebar.desktop.collapsed .sidebar-action-btn.login:hover {
  background: #5a67d8;
  background: var(--bg-accent-dark, #5a67d8);
  transform: scale(1.05);
}

.sidebar.desktop.collapsed .sidebar-action-btn.register {
  background: var(--gradient-primary);
  color: white;
  border: none;
}

.sidebar.desktop.collapsed .sidebar-action-btn.register:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.sidebar.desktop.collapsed .sidebar-action-btn.logout {
  background: #dc2626;
  color: white;
  border: none;
}

.sidebar.desktop.collapsed .sidebar-action-btn.logout:hover {
  background: #b91c1c;
  transform: scale(1.05);
}

.sidebar.desktop.collapsed .sidebar-action-btn.profile {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.sidebar.desktop.collapsed .sidebar-action-btn.profile:hover {
  background: var(--bg-accent);
  color: white;
  border-color: var(--bg-accent);
  transform: scale(1.05);
}

.sidebar-content.mobile {
  padding-top: 16px; /* Reduced space since header is hidden */
}

/* Collapse Button */
.sidebar-collapse-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s ease;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

/* Полоска сворачивания в развернутом состоянии */
.sidebar-collapse-strip {
  padding: 12px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease;
  width: 100%;
}

.sidebar-collapse-strip:hover {
  background: var(--bg-accent);
}

.sidebar-collapse-strip:active {
  background: var(--bg-accent);
}

/* Иконка сворачивания */
.collapse-icon {
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.sidebar-collapse-strip:hover .collapse-icon {
  color: white;
}

/* Sidebar Header */
.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.sidebar-logo {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
}

/* User Profile Section */
.sidebar-profile {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: var(--bg-tertiary);
}

.sidebar-user-avatar {
  width: 60px;
  height: 60px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  overflow: hidden;
}

.sidebar-user-avatar .avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.sidebar-user-info {
  text-align: center;
}

.sidebar-user-info h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.sidebar-user-info p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Navigation */
.sidebar-nav {
  flex: 1 1;
  padding: 8px 0;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li {
  margin: 0;
}

.sidebar-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: none;
  border: none;
  text-align: left;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-nav-item.active {
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.15) 0%,
    rgba(118, 75, 162, 0.15) 100%
  );
  color: var(--bg-accent);
  font-weight: 600;
}

.sidebar-nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gradient-primary);
  border-radius: 0 2px 2px 0;
}

.sidebar-nav-item svg {
  flex-shrink: 0;
}

/* Actions Section */
.sidebar-actions {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.sidebar-action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.sidebar-action-btn.logout {
  color: #dc2626;
  border-color: #fecaca;
}

.sidebar-action-btn.logout:hover {
  background: #fef2f2;
  border-color: #f87171;
}

.sidebar-action-btn.login {
  color: #667eea;
  border-color: #c7d2fe;
}

.sidebar-action-btn.login:hover {
  background: #eef2ff;
  border-color: #a5b4fc;
}

.sidebar-action-btn.register {
  background: var(--gradient-primary);
  color: var(--text-inverse);
  border: none;
}

.sidebar-action-btn.register:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.sidebar-action-btn.settings {
  color: var(--text-secondary);
}

.sidebar-action-btn.settings:hover {
  color: var(--text-primary);
}

.sidebar-action-btn.profile {
  color: var(--bg-accent);
  border-color: rgba(102, 126, 234, 0.3);
}

.sidebar-action-btn.profile:hover {
  background: rgba(102, 126, 234, 0.1);
  border-color: var(--bg-accent);
}

.sidebar-action-btn.telegram-auth {
  background: linear-gradient(135deg, #0088cc, #229ed9);
  color: white;
  border: none;
  font-weight: 600;
}

.sidebar-action-btn.telegram-auth:hover {
  background: linear-gradient(135deg, #006ba6, #1e8bc3);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

/* Tablet and Mobile Responsive */
@media (max-width: 767px) {
  .sidebar.desktop {
    transform: translateX(-100%);
  }
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: block;
  }

  .sidebar.mobile {
    width: 260px;
  }

  /* Скрываем заголовок на мобильных устройствах */
  .sidebar.mobile .sidebar-header {
    display: none;
  }

  /* Убираем отступ сверху для мобильного контента */
  .sidebar-content.mobile {
    padding-top: 16px;
  }

  .sidebar-profile {
    padding: 12px 16px;
    gap: 8px;
  }

  .sidebar-user-avatar {
    width: 40px;
    height: 40px;
  }

  .sidebar-user-info h3 {
    font-size: 14px;
    margin: 0 0 2px 0;
  }

  .sidebar-user-info p {
    font-size: 12px;
  }

  .sidebar-nav-item {
    padding: 10px 20px;
    font-size: 15px;
  }

  .sidebar-actions {
    padding: 12px 20px 20px;
  }
}

@media (max-width: 480px) {
  .sidebar.mobile {
    width: 240px;
  }

  /* Заголовок уже скрыт в предыдущем медиа-запросе */
  .sidebar.mobile .sidebar-header {
    display: none;
  }

  /* Еще более компактная информация о пользователе */
  .sidebar-profile {
    padding: 8px 12px;
    gap: 6px;
  }

  .sidebar-user-avatar {
    width: 32px;
    height: 32px;
  }

  .sidebar-user-avatar .avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
  }

  .sidebar-user-info h3 {
    font-size: 13px;
    margin: 0 0 1px 0;
  }

  .sidebar-user-info p {
    font-size: 11px;
  }

  .sidebar-nav-item {
    padding: 8px 16px;
    font-size: 14px;
  }

  .sidebar-action-btn {
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* Collapsed sidebar styles for all desktop sizes */
.sidebar.desktop.collapsed {
  width: 60px;
  border-right: 1px solid var(--border-color);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0); /* Убираем тень в свернутом состоянии */
  padding: 0; /* Убираем все отступы */
  height: 100vh;
  overflow: hidden;
}

/* Скрываем только логотип в свернутом состоянии */
.sidebar.desktop.collapsed .sidebar-logo {
  display: none;
}

/* Компактный заголовок в свернутом состоянии */
.sidebar.desktop.collapsed .sidebar-header {
  padding: 12px;
  min-height: 44px;
  justify-content: center;
  border-bottom: none;
  cursor: pointer;
  border-radius: 0;
  margin: 0;
  background: var(--bg-secondary);
  border: none;
  box-shadow: none;
  transition: background-color 0.2s ease;
  width: 100%;
}

.sidebar.desktop.collapsed .sidebar-header:hover {
  background: var(--bg-accent);
}

.sidebar.desktop.collapsed .sidebar-header:active {
  background: var(--bg-accent);
}

/* Иконка разворачивания */
.expand-icon {
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.sidebar.desktop.collapsed .sidebar-header:hover .expand-icon {
  color: white;
}

.sidebar.desktop.collapsed .sidebar-profile {
  display: none;
}

/* Оставляем навигационное меню, но скрываем только текст */
.sidebar.desktop.collapsed .sidebar-nav {
  padding-top: 8px; /* Минимальный отступ сверху */
  border-top: 1px solid var(--border-color);
  margin-top: 0;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.sidebar.desktop.collapsed .sidebar-nav-item {
  padding: 12px;
  justify-content: center;
  border-radius: 8px;
  margin: 2px 4px 2px 0;
  min-height: 44px;
}

.sidebar.desktop.collapsed .sidebar-nav-item span {
  display: none;
}

/* Smooth scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* Challenge Card - Mobile First with CSS Variables */

.challenge-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px;
  margin: 16px 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  color: #1f2937;
  /* CSS переменные для динамического окрашивания */
  --challenge-color: #6b7280;
  --challenge-gradient: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  --challenge-light-bg: rgba(107, 114, 128, 0.1);
  --challenge-border-color: #6b7280;
  --status-color: #10b981;
  --status-light-bg: rgba(16, 185, 129, 0.1);
}

.challenge-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: var(--challenge-border-color);
}

/* Цветовая полоска по типу челленджа */
.challenge-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: var(--challenge-gradient);
  opacity: 0.9;
}

/* Дополнительный акцент по статусу */
.challenge-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 3px;
  height: 100%;
  background: var(--status-color);
  opacity: 0.7;
}

/* Фоновые градиенты по статусу */
.challenge-card.active {
  background: linear-gradient(135deg, var(--challenge-light-bg) 0%, white 100%);
}

.challenge-card.completed {
  background: linear-gradient(135deg, var(--status-light-bg) 0%, white 100%);
}

.challenge-card.paused {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, white 100%);
}

.challenge-card.failed {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, white 100%);
}

/* Заголовок */
.challenge-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.challenge-title-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1;
  min-height: 32px; /* Соответствует высоте иконки */
}

.challenge-title-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1;
}

.challenge-type-label {
  font-size: 12px;
  color: var(--challenge-color);
  font-weight: 600;
  background: var(--challenge-light-bg);
  padding: 2px 8px;
  border-radius: 6px;
  align-self: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}

.challenge-type-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--challenge-light-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.challenge-type-icon-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--challenge-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.challenge-type-icon {
  color: var(--challenge-color);
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.challenge-card:hover .challenge-type-icon-wrapper {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 25px var(--challenge-light-bg);
  border-color: var(--challenge-border-color);
}

.challenge-card:hover .challenge-type-icon-wrapper::before {
  opacity: 0.1;
}

.challenge-card:hover .challenge-type-icon {
  color: white;
  transform: scale(1.1);
}

.challenge-title {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
  line-height: 1.3;
  display: flex;
  align-items: center;
  min-height: 32px; /* Соответствует высоте иконки */
}

.challenge-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.challenge-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-icon, .visibility-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  transition: all 0.3s ease;
  cursor: pointer;
  opacity: 0.7;
}

.mode-icon:hover, .visibility-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}

.mode-icon.personal {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.mode-icon.group {
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
}

.visibility-icon.public {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.visibility-icon.private {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.challenge-status {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 12px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
}

/* Статусные стили */
.challenge-status.active {
  background: var(--status-light-bg);
  color: var(--status-color);
}

.challenge-status.completed {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.challenge-status.paused {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.challenge-status.failed {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Описание */
.challenge-description {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 16px 0;
  padding: 12px;
  background: var(--challenge-light-bg);
  border-radius: 8px;
  border-left: 3px solid var(--challenge-color);
}

/* Даты */
.challenge-dates {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.date-item {
  flex: 1 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.date-label {
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.date-value {
  font-size: 13px;
  color: #1f2937;
  font-weight: 600;
}

/* Статистики */
.challenge-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.stat-item {
  background: #f9fafb;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1;
  min-width: 0;
}

.stat-item:hover {
  background: var(--challenge-light-bg);
  border-color: var(--challenge-border-color);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--challenge-color);
  opacity: 0.8;
}

.stat-content {
  flex: 1 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-challenge-card .stat-label {
  font-size: 10px;
  color: #6b7280;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.chat-challenge-card .stat-value {
  font-size: 14px;
  color: #1f2937;
  font-weight: 700;
}

/* Прогресс бар */
.progress-section {
  margin-bottom: 16px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  background: var(--challenge-gradient);
  border-radius: 4px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
  border-radius: 4px;
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Последнее обновление */
.last-update {
  background: var(--challenge-light-bg);
  border: 1px solid var(--challenge-border-color);
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.update-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--challenge-color);
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.8;
}

.update-content {
  flex: 1 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.update-label {
  font-size: 10px;
  color: #6b7280;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.update-date {
  font-size: 11px;
  color: var(--challenge-color);
  font-weight: 600;
}

.update-text {
  color: #1f2937;
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
}

/* Public badge */
.public-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
}

/* Mobile optimizations */
@media (max-width: 480px) {
  .challenge-card {
    padding: 16px;
    margin: 12px 0;
  }
  
  .challenge-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .challenge-title-section {
    width: 100%;
  }
  
  .challenge-title {
    font-size: 16px;
  }
  
  .challenge-dates {
    flex-direction: column;
    gap: 12px;
  }
  
  .challenge-stats {
    gap: 6px;
  }
  
  .stat-item {
    padding: 8px;
  }
  
  .chat-challenge-card .stat-value {
    font-size: 16px;
  }
}

/* Tablet styles */
@media (min-width: 768px) {
  .challenge-card {
    padding: 24px;
  }
  
  .challenge-title {
    font-size: 20px;
  }
  
  .challenge-stats {
    gap: 12px;
  }
  
  .stat-item {
    padding: 16px;
  }
}

/* Desktop hover effects */
@media (min-width: 1024px) {
  .stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}
.challenge-list {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

.challenge-list-header {
  text-align: center;
  margin-bottom: 32px;
  padding: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  color: white;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

.challenge-list-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.challenge-section {
  margin-bottom: 40px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 20px 0;
  padding: 12px 0;
  border-bottom: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 8px;
}

.challenge-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 600px;
  margin: 0 auto;
}

/* Пустое состояние */
.challenge-list-empty {
  text-align: center;
  padding: 60px 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  border-radius: 20px;
  border: 2px dashed #d1d5db;
  margin: 20px 0;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.7;
}

.challenge-list-empty h3 {
  font-size: 24px;
  color: #374151;
  margin: 0 0 16px 0;
  font-weight: 600;
}

.challenge-list-empty p {
  color: #6b7280;
  font-size: 16px;
  margin: 0 0 20px 0;
  line-height: 1.6;
}

.example-commands {
  text-align: left;
  display: inline-block;
  background: #f9fafb;
  padding: 20px 24px;
  border-radius: 12px;
  border-left: 4px solid #3b82f6;
  margin: 0;
}

.example-commands li {
  color: #374151;
  font-size: 15px;
  margin: 8px 0;
  font-weight: 500;
  list-style: none;
  position: relative;
  padding-left: 20px;
}

.example-commands li::before {
  content: "💡";
  position: absolute;
  left: 0;
  top: 0;
}

/* Секция помощи */
.challenge-help-section {
  margin-top: 40px;
  padding: 24px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 16px;
  border: 1px solid #bae6fd;
}

.help-content h4 {
  font-size: 18px;
  color: #0c4a6e;
  margin: 0 0 16px 0;
  font-weight: 700;
}

.help-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-list li {
  color: #075985;
  font-size: 15px;
  margin: 8px 0;
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 1px solid rgba(186, 230, 253, 0.5);
}

.help-list li:last-child {
  border-bottom: none;
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
  .section-title {
    color: #f9fafb;
    border-bottom-color: #374151;
  }

  .challenge-list-empty {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-color: #4b5563;
    color: #f9fafb;
  }

  .challenge-list-empty h3 {
    color: #f9fafb;
  }

  .challenge-list-empty p {
    color: #d1d5db;
  }

  .example-commands {
    background: #374151;
    border-left-color: #60a5fa;
  }

  .example-commands li {
    color: #e5e7eb;
  }

  .challenge-help-section {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-color: #3730a3;
  }

  .help-content h4 {
    color: #dbeafe;
  }

  .help-list li {
    color: #bfdbfe;
    border-bottom-color: rgba(147, 197, 253, 0.2);
  }
}

/* Мобильная адаптация */
@media (max-width: 768px) {
  .challenge-list {
    padding: 0 12px;
  }
  
  .challenge-list-header {
    padding: 20px 16px;
    margin-bottom: 24px;
  }
  
  .challenge-list-title {
    font-size: 22px;
  }
  
  .challenge-grid {
    gap: 16px;
  }
  
  .section-title {
    font-size: 18px;
    margin-bottom: 16px;
  }
  
  .challenge-section {
    margin-bottom: 32px;
  }
  
  .challenge-list-empty {
    padding: 40px 16px;
  }
  
  .empty-icon {
    font-size: 48px;
  }
  
  .challenge-list-empty h3 {
    font-size: 20px;
  }
  
  .example-commands {
    padding: 16px 20px;
  }
  
  .challenge-help-section {
    padding: 20px 16px;
  }
}

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

.challenge-section {
  animation: fadeInUp 0.5s ease-out;
}

.challenge-section:nth-child(2) {
  animation-delay: 0.1s;
}

.challenge-section:nth-child(3) {
  animation-delay: 0.2s;
}

.challenge-help-section {
  animation: fadeInUp 0.5s ease-out 0.3s both;
}

.checkin-list {
  max-width: 600px;
  margin: 16px 0;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.checkin-list-empty {
  text-align: center;
  padding: 32px 20px;
  color: #6b7280;
}

.checkin-list-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.checkin-list-empty h3 {
  color: #374151;
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
}

.checkin-list-empty p {
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.checkin-list-empty .help-hint {
  background: #f3f4f6;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 16px;
}

.checkin-list-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
}

.checkin-list-title {
  margin: 0 0 12px 0;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkin-summary {
  display: flex;
  gap: 16px;
  font-size: 14px;
  opacity: 0.9;
}

.summary-completed, .summary-pending {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 16px;
  font-weight: 500;
}

.checkin-section {
  padding: 20px;
  border-bottom: 1px solid #f3f4f6;
}

.checkin-section:last-child {
  border-bottom: none;
}

.section-title {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkin-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkin-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
}

.checkin-card.pending {
  border-left: 4px solid #f59e0b;
}

.checkin-card.completed {
  border-left: 4px solid #22c55e;
  background: #f0f9f0;
}

.checkin-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.checkin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.challenge-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1 1;
}

.challenge-icon {
  font-size: 24px;
  margin-top: 2px;
}

.challenge-details {
  flex: 1 1;
}

.challenge-title {
  margin: 0 0 6px 0;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
}

.challenge-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #6b7280;
}

.stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.checkin-button {
  background: #10b981 !important;
  color: white !important;
  border: none !important;
  padding: 10px 20px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s ease;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  min-width: 100px !important;
  justify-content: center !important;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3) !important;
}

.checkin-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.checkin-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.checkin-button.loading {
  background: #9ca3af;
}

.loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.completed-badge {
  background: #dcfce7;
  color: #166534;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #bbf7d0;
}

.challenge-description {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 12px;
  font-style: italic;
}

.challenge-progress {
  margin-top: 8px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  transition: width 0.3s ease;
  background: #22c55e;
  border-radius: 3px;
}

.progress-text {
  font-size: 12px;
  color: #6b7280;
  text-align: right;
}

.checkin-help-section {
  background: #f8fafc;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
}

.help-content h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-commands {
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-commands li {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 4px;
  padding-left: 16px;
  position: relative;
}

.help-commands li:before {
  content: "•";
  color: #9ca3af;
  position: absolute;
  left: 0;
}

/* Стили для интеграции с CheckinStatus */
.chat-checkin-item {
  margin-bottom: 12px;
}

.chat-checkin-item .checkin-status {
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.summary-note {
  color: #6b7280;
  font-size: 14px;
  font-style: italic;
}

/* Responsive design */
@media (max-width: 640px) {
  .checkin-list {
    margin: 12px 0;
    border-radius: 8px;
  }
  
  .checkin-list-header {
    padding: 16px;
  }
  
  .checkin-list-title {
    font-size: 18px;
  }
  
  .checkin-section {
    padding: 16px;
  }
  
  .checkin-card {
    padding: 12px;
  }
  
  .checkin-card-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  
  .challenge-info {
    margin-bottom: 0;
  }
  
  .checkin-button {
    align-self: flex-start;
    min-width: 100px;
  }
  
  .challenge-stats {
    flex-direction: column;
    gap: 8px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .checkin-list {
    background: #1f2937;
    border-color: #374151;
  }
  
  .checkin-card {
    background: #111827;
    border-color: #374151;
  }
  
  .checkin-card.completed {
    background: #0f2a0f;
  }
  
  .challenge-title {
    color: #f9fafb;
  }
  
  .section-title {
    color: #f3f4f6;
  }
  
  .checkin-help-section {
    background: #111827;
    border-color: #374151;
  }
  
  .help-content h4 {
    color: #f3f4f6;
  }
}

.checkin-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
  transition: all 0.3s ease;
}

.checkin-timer.urgent {
  background: linear-gradient(135deg, #ff9500 0%, #ff6b35 100%);
  box-shadow: 0 2px 8px rgba(255, 149, 0, 0.3);
  animation: pulse-urgent 2s ease-in-out infinite;
}

.checkin-timer.critical {
  background: linear-gradient(135deg, #ff4757 0%, #c44569 100%);
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
  animation: pulse-critical 1s ease-in-out infinite;
}

.timer-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.timer-content {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}

.timer-value {
  min-width: 20px;
  text-align: center;
}

.timer-separator {
  opacity: 0.8;
  animation: blink 2s ease-in-out infinite;
}

.timer-label {
  font-size: 11px;
  opacity: 0.9;
  font-weight: 500;
  line-height: 1;
}

/* Анимации */
@keyframes pulse-urgent {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.3);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.4);
  }
}

@keyframes pulse-critical {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 71, 87, 0.6);
  }
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0.3;
  }
}

/* Responsive */
@media (max-width: 480px) {
  .checkin-timer {
    padding: 6px 10px;
    gap: 6px;
  }
  
  .timer-display {
    font-size: 12px;
  }
  
  .timer-label {
    font-size: 10px;
  }
  
  .timer-icon {
    display: none;
  }
}

/* Checkin Modal - Mobile First Design */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}

.checkin-modal {
  background: var(--bg-primary);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 24px 0 24px;
  margin-bottom: 20px;
}

.modal-title {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1 1;
}

.title-icon {
  width: 48px;
  height: 48px;
  background: var(--gradient-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  flex-shrink: 0;
}

.title-content h2 {
  margin: 0 0 4px 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.title-content p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.close-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: scale(1.05);
}

.challenge-info {
  padding: 0 24px;
  margin-bottom: 24px;
}

.challenge-info h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.challenge-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 12px;
  gap: 12px;
  padding: 20px;
  background: var(--gradient-primary);
  border-radius: 16px;
  color: var(--text-inverse);
}

.stat {
  text-align: center;
}

.checkin-modal .stat-value {
  display: block;
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
  line-height: 1;
}

.checkin-modal .stat-label {
  font-size: 11px;
  opacity: 0.9;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.checkin-form {
  padding: 0 24px 24px 24px;
}

.form-section {
  margin-bottom: 24px;
}

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

.form-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.form-group textarea {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  min-height: 100px;
  transition: all 0.2s ease;
  font-family: inherit;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.form-group textarea:focus {
  outline: none;
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea::placeholder {
  color: var(--text-secondary);
}

/* Image Upload Styles */
.image-upload {
  margin-bottom: 16px;
}

.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 16px;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.upload-area:hover {
  border-color: var(--border-accent);
  background: var(--bg-hover);
}

.upload-area svg {
  color: var(--bg-accent);
}

.upload-area span {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.upload-area small {
  color: var(--text-secondary);
  font-size: 12px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-gap: 12px;
  gap: 12px;
}

.image-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-tertiary);
}

.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.remove-image {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}

.remove-image:hover {
  background: rgba(239, 68, 68, 0.9);
  transform: scale(1.1);
}

.modal-actions {
  display: flex;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.cancel-btn {
  flex: 1 1;
  padding: 14px 20px;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.cancel-btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
  color: var(--text-primary);
}

.checkin-btn {
  flex: 2 1;
  padding: 14px 20px;
  background: var(--gradient-primary);
  color: var(--text-inverse);
  border: none;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.checkin-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.checkin-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Mobile optimizations */
@media (max-width: 480px) {
  .modal-overlay {
    padding: 12px;
  }
  
  .checkin-modal {
    border-radius: 16px;
    max-height: 95vh;
  }
  
  .modal-header {
    padding: 20px 20px 0 20px;
    margin-bottom: 16px;
  }
  
  .title-icon {
    width: 40px;
    height: 40px;
  }
  
  .title-content h2 {
    font-size: 18px;
  }
  
  .challenge-info {
    padding: 0 20px;
    margin-bottom: 20px;
  }
  
  .challenge-stats {
    padding: 16px;
    gap: 8px;
  }
  
  .checkin-modal .stat-value {
    font-size: 20px;
  }
  
  .checkin-modal .stat-label {
    font-size: 10px;
  }
  
  .checkin-form {
    padding: 0 20px 20px 20px;
  }
  
  .form-group {
    margin-bottom: 20px;
  }
  
  .form-group textarea {
    padding: 12px;
    min-height: 80px;
  }
  
  .upload-area {
    padding: 24px 12px;
  }
  
  .image-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .modal-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .cancel-btn,
  .checkin-btn {
    flex: none;
    padding: 12px 16px;
  }
}

/* Tablet styles */
@media (min-width: 768px) {
  .modal-overlay {
    padding: 24px;
  }
  
  .checkin-modal {
    max-width: 600px;
  }
  
  .modal-header {
    padding: 32px 32px 0 32px;
  }
  
  .challenge-info {
    padding: 0 32px;
  }
  
  .checkin-form {
    padding: 0 32px 32px 32px;
  }
  
  .image-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .upload-area {
    padding: 40px 24px;
  }
}

.checkin-status {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.checkin-status::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.checkin-status.pending::before {
  background: linear-gradient(90deg, #ff9500 0%, #ff6b35 100%);
}

.checkin-status.completed::before {
  background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
}

.checkin-status:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.checkin-status .status-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.status-icon.pending {
  background: linear-gradient(135deg, #ff9500 0%, #ff6b35 100%);
  animation: pulse-status 2s ease-in-out infinite;
}

.status-icon.completed {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.status-content {
  padding-right: 0;
}

.status-header {
  margin-bottom: 12px;
}

.status-header h3 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.challenge-type {
  display: inline-block;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-message {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-message .check-icon {
  font-size: 16px;
}

.status-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.checkin-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.checkin-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.checkin-btn:active {
  transform: translateY(0);
}

.status-timer {
  flex-shrink: 0;
}

.challenge-stats {
  display: flex !important;
  gap: 16px !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 8px 0 !important;
  flex-wrap: nowrap !important;
  overflow: hidden !important;
}

.challenge-stats .stat {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  flex-wrap: nowrap !important;
  padding: 2px 4px !important;
  opacity: 0.9 !important;
}

.challenge-stats .stat svg {
  color: #ffffff !important;
  opacity: 0.9 !important;
  flex-shrink: 0 !important;
}

.challenge-stats .stat span {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* УЛЬТРА АГРЕССИВНАЯ защита от переносов */
.checkin-status .challenge-stats,
.checkin-status .challenge-stats *,
.checkin-status .challenge-stats .stat,
.checkin-status .challenge-stats .stat *,
.checkin-status .challenge-stats .stat span {
  white-space: nowrap !important;
  flex-wrap: nowrap !important;
  word-wrap: normal !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
}

.checkin-status .challenge-stats {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
  overflow: hidden !important;
}

.checkin-status .challenge-stats .stat {
  min-width: auto !important;
  max-width: none !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
}

/* ФОРСИРОВАННАЯ защита текста */
.checkin-status .challenge-stats .stat span,
.checkin-status .challenge-stats .stat {
  font-size: 12px !important;
  line-height: 1 !important;
  letter-spacing: normal !important;
}

/* Анимации */
@keyframes pulse-status {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.2);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.4);
  }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .checkin-status {
    padding: 16px;
  }
  
  .status-content {
    padding-right: 0;
  }
  
  .checkin-status .status-icon {
    width: 32px;
    height: 32px;
    top: 14px;
    right: 14px;
  }
  
  .status-header h3 {
    font-size: 16px;
  }
  
  .status-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .status-timer {
    align-self: center;
  }
  
  .checkin-status .challenge-stats {
    justify-content: center !important;
    gap: 12px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    padding: 6px 0 !important;
    margin: 8px 0 0 0 !important;
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
  }
  
  .checkin-status .challenge-stats .stat {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    flex: 0 0 auto !important;
  }
}

@media (max-width: 480px) {
  .checkin-status {
    padding: 14px;
  }
  
  .status-header h3 {
    font-size: 15px;
  }
  
  .challenge-type {
    font-size: 11px;
    padding: 3px 6px;
  }
  
  .status-message {
    font-size: 13px;
  }
  
  .checkin-btn {
    padding: 8px 14px;
    font-size: 13px;
    justify-content: center;
  }
  
  .checkin-status .challenge-stats {
    gap: 8px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    padding: 4px 0 !important;
    margin: 6px 0 0 0 !important;
    justify-content: center !important;
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
  }
  
  .checkin-status .challenge-stats .stat {
    font-size: 12px !important;
    min-width: -webkit-fit-content !important;
    min-width: fit-content !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    flex: 0 0 auto !important;
  }
  
  .checkin-status .challenge-stats .stat span {
    white-space: nowrap !important;
    display: inline !important;
  }
}

.chat-container {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  height: 600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Full height mode for desktop chat tab */
.chat-container.full-height {
  height: 100%;
  min-height: calc(100vh - 200px);
  border-radius: 0;
  box-shadow: none;
  border: none;
}

.chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 16px 16px 0 0;
  min-height: 60px;
  box-sizing: border-box;
}

.chat-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1;
}

.chat-header-actions,
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  flex: 1 1;
}

.status-indicator {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  border-radius: 12px;
}

/* Removed - now defined in Messages Container section */

.message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.message.user .message-avatar {
  background: #3b82f6;
  color: white;
}

.message.assistant .message-avatar {
  background: #10b981;
  color: white;
}

/* Avatar styles */
.avatar-image {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3b82f6;
  color: white;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.message-content {
  max-width: 70%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message.user .message-content {
  align-items: flex-end;
}

.message-text {
  background: #f3f4f6;
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.5;
  color: #1f2937;
}

.message.user .message-text {
  background: #3b82f6;
  color: white;
  border-radius: 16px 16px 4px 16px;
}

.message.assistant .message-text {
  border-radius: 16px 16px 16px 4px;
}

.tool-calls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-call {
  background: #f0f9ff;
  border: 1px solid #0ea5e9;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
}

.tool-name {
  font-weight: 600;
  color: #0369a1;
  display: block;
  margin-bottom: 4px;
}

.tool-result {
  color: #374151;
  font-size: 13px;
}

.profile-preview {
  margin-top: 8px;
  padding: 8px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 6px;
  border-left: 3px solid #3b82f6;
}

.profile-data {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-data span {
  font-size: 12px;
  color: #374151;
  font-weight: 500;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  font-style: italic;
}

.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.error-message {
  background: #fee2e2;
  border: 1px solid #f87171;
  color: #dc2626;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
}

.chat-input-form {
  border-top: 1px solid #e5e7eb;
  padding: 16px;
}

.active-ai-mode-indicator {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 0.875rem;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mode-info {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mode-info strong {
  font-weight: 600;
  color: #1f2937;
}

.exit-mode-btn {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.exit-mode-btn:hover {
  background: #dc2626;
}

.input-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex: 1 1;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  outline: none;
  font-size: 16px;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: #3b82f6;
}

.chat-input:disabled {
  background: #f9fafb;
  color: #6b7280;
}

.send-button {
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.send-button:hover:not(:disabled) {
  background: #2563eb;
}

.send-button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.setup-button {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.setup-button:hover {
  background: #2563eb;
}

.setup-note {
  font-size: 14px;
  color: #6b7280;
  line-height: 1.5;
}

.setup-note a {
  color: #3b82f6;
  text-decoration: none;
}

.setup-note a:hover {
  text-decoration: underline;
}

/* Modal Mode Styles */
.chat-container.modal-mode {
  height: 70vh;
  max-height: 600px;
  min-height: 400px;
}

/* Mobile modal mode - full screen */
.chat-container.modal-mode.mobile {
  /* Use dynamic viewport height that works correctly with iOS keyboard */
  height: 100dvh;
  height: 100vh; /* Fallback for older browsers */
  height: -webkit-fill-available; /* iOS Safari fallback */
  max-height: 100dvh;
  max-height: 100vh; /* Fallback for older browsers */
  max-height: -webkit-fill-available; /* iOS Safari fallback */
  min-height: 100dvh;
  min-height: 100vh; /* Fallback for older browsers */
  min-height: -webkit-fill-available; /* iOS Safari fallback */
  border-radius: 0;
  box-shadow: none;
  border: none;
  /* Account for safe areas */
  box-sizing: border-box;
}

/* Header buttons unified styles */
.chat-close-button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
  flex-shrink: 0;
}

.chat-close-button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.chat-close-button:active {
  transform: scale(0.95);
}

/* Welcome Message Styles */
.welcome-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px;
  color: #6b7280;
  border: 2px dashed #e5e7eb;
  border-radius: 12px;
  margin: auto;
  background: #f8fafc;
  max-width: 500px;
  flex: 1 1;
  justify-content: center;
}

.welcome-message h3 {
  margin: 16px 0 8px 0;
  color: #1f2937;
  font-size: 20px;
  font-weight: 600;
}

.welcome-message p {
  margin: 0 0 16px 0;
  color: #4b5563;
  line-height: 1.5;
}

.welcome-message ul {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
  text-align: left;
}

.welcome-message li {
  padding: 6px 0;
  color: #374151;
  font-weight: 500;
}

.welcome-message .Bot {
  color: #3b82f6;
  margin-bottom: 8px;
}

.welcome-hint {
  font-size: 0.9em;
  color: #6b7280 !important;
  font-style: italic;
  margin-top: 8px !important;
}

/* Loading Animation */
.loading-animation {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  font-style: italic;
  padding: 12px 16px;
}

.loading-animation span {
  color: #6b7280;
}

/* Messages Container */
.messages-container {
  flex: 1 1;
  overflow-y: auto;
  position: relative;
}

.chat-messages {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
}

.chat-messages:empty {
  justify-content: center;
  align-items: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .chat-container {
    border-radius: 0;
    /* Use dynamic viewport height for iOS compatibility */
    height: 100dvh;
    height: 100vh; /* Fallback for older browsers */
    height: -webkit-fill-available; /* iOS Safari fallback */
  }

  .chat-container.modal-mode {
    /* Use dynamic viewport height for iOS compatibility */
    height: 100dvh;
    height: 100vh; /* Fallback for older browsers */
    height: -webkit-fill-available; /* iOS Safari fallback */
    border-radius: 12px 12px 0 0;
  }

  .chat-header {
    border-radius: 12px 12px 0 0;
    padding: 12px 16px;
  }

  .message-content {
    max-width: 85%;
  }

  .chat-input {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

@media (max-width: 480px) {
  .chat-messages {
    padding: 12px;
    gap: 12px;
  }

  .chat-input-form {
    padding: 12px;
  }

  .message-text {
    padding: 10px 14px;
    font-size: 14px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .chat-container {
    background: #1a202c;
    border-color: #2d3748;
    color: #f7fafc;
  }

  .chat-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  }

  .chat-messages {
    background: #1a202c;
  }

  .message-text {
    background: #2d3748;
    color: #f7fafc;
    border: 1px solid #4a5568;
  }

  .message.assistant .message-text {
    background: #2d3748;
    color: #f7fafc;
  }

  .message.user .message-text {
    background: #3b82f6;
    color: white;
  }

  .chat-input {
    background: #2d3748;
    border-color: #4a5568;
    color: #f7fafc;
  }

  .chat-input::placeholder {
    color: #9ca3af;
  }

  .chat-input:focus {
    border-color: #6366f1;
    background: #2d3748;
  }

  .chat-input:disabled {
    background: #1a202c;
    color: #718096;
  }

  .chat-input-form {
    border-top-color: #2d3748;
    background: #1a202c;
  }

  .active-ai-mode-indicator {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    border-color: #6b7280;
    color: #e5e7eb;
  }

  .mode-info strong {
    color: #f9fafb;
  }

  .error-message {
    background: #451a1a;
    border-color: #dc2626;
    color: #fca5a5;
  }

  .tool-call {
    background: #1e3a8a;
    border-color: #3b82f6;
    color: #e0e7ff;
  }

  .tool-name {
    color: #93c5fd;
  }

  .tool-result {
    color: #d1d5db;
  }

  .profile-preview {
    background: rgba(59, 130, 246, 0.15);
    border-left-color: #60a5fa;
  }

  .profile-data span {
    color: #e5e7eb;
  }

  .typing-indicator {
    color: #9ca3af;
  }

  .setup-note {
    color: #d1d5db;
  }

  /* Welcome Message Dark Mode */
  .welcome-message {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .welcome-message h3 {
    color: #f9fafb;
  }

  .welcome-message p {
    color: #d1d5db;
  }

  .welcome-message li {
    color: #e5e7eb;
  }

  .welcome-message .Bot {
    color: #60a5fa;
  }

  .welcome-hint {
    color: #9ca3af !important;
  }

  /* Loading Animation Dark Mode */
  .loading-animation {
    color: #d1d5db;
  }

  .loading-animation span {
    color: #9ca3af;
  }

  /* Avatar styles dark mode */
  .avatar-placeholder {
    background: #60a5fa;
    width: 32px;
    height: 32px;
  }
}

/* Анимация спиннера */
.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Markdown стили для красивого отображения ответов ИИ */
.message.assistant .message-text h1,
.message.assistant .message-text h2,
.message.assistant .message-text h3,
.message.assistant .message-text h4 {
  color: #2563eb !important;
  margin: 0.8em 0 0.5em 0 !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
}

.message.assistant .message-text h1 {
  font-size: 1.6em !important;
}
.message.assistant .message-text h2 {
  font-size: 1.4em !important;
}
.message.assistant .message-text h3 {
  font-size: 1.2em !important;
}
.message.assistant .message-text h4 {
  font-size: 1.1em !important;
}

.message.assistant .message-text strong {
  font-weight: 700 !important;
  color: #1f2937 !important;
  background: rgba(59, 130, 246, 0.1) !important;
  padding: 0.1em 0.3em !important;
  border-radius: 4px !important;
  text-shadow: none !important;
}

.message.assistant .message-text em {
  font-style: italic !important;
  color: #9ca3af !important;
}

.message.assistant .message-text p {
  margin: 0.6em 0 !important;
  line-height: 1.6 !important;
}

.message.assistant .message-text ul,
.message.assistant .message-text ol {
  margin: 0.8em 0 !important;
  padding-left: 1.5em !important;
}

.message.assistant .message-text li {
  margin: 0.3em 0 !important;
  line-height: 1.5 !important;
}

.message.assistant .message-text ul li {
  list-style-type: disc !important;
}

.message.assistant .message-text ol li {
  list-style-type: decimal !important;
}

.message.assistant .message-text ul li::marker {
  color: #3b82f6 !important;
}

.message.assistant .message-text ol li::marker {
  color: #3b82f6 !important;
  font-weight: 600 !important;
}

.message-text blockquote {
  border-left: 4px solid #3b82f6;
  margin: 1em 0;
  padding: 0.5em 0 0.5em 1em;
  background: rgba(59, 130, 246, 0.05);
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

.message-text code {
  background: rgba(59, 130, 246, 0.1);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: "Menlo", "Monaco", "Courier New", monospace;
  font-size: 0.9em;
  color: #1f2937;
}

.message-text pre {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1em;
  margin: 1em 0;
  overflow-x: auto;
}

.message-text pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: #334155;
}

/* Стили для эмодзи в ответах */
.message-text p:has(span[role="img"]),
.message-text li:has(span[role="img"]) {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
}

/* Улучшенные отступы для списков с эмодзи */
.message-text ul li:first-child {
  margin-top: 0;
}

.message-text ul li:last-child {
  margin-bottom: 0;
}

/* Стили для особых секций */
.message-text p:contains("**Готов помочь с:**"),
.message-text p:contains("**Что дальше?**"),
.message-text p:contains("**Статистика:**") {
  margin-top: 1.2em;
  font-weight: 600;
  color: #1f2937;
}

/* Темная тема */
.dark .message-text h1,
.dark .message-text h2,
.dark .message-text h3,
.dark .message-text h4 {
  color: #60a5fa;
}

.dark .message-text strong {
  color: #f9fafb;
  background: rgba(96, 165, 250, 0.15) !important;
}

.dark .message-text blockquote {
  background: rgba(96, 165, 250, 0.1);
  border-left-color: #60a5fa;
}

.dark .message-text code {
  background: rgba(96, 165, 250, 0.15);
  color: #f9fafb;
}

.dark .message-text pre {
  background: #1f2937;
  border-color: #374151;
}

.dark .message-text pre code {
  color: #e5e7eb;
}

/* Специальный дисплей компонентов */
.special-display {
  margin: 16px 0 !important;
  padding: 16px !important;
  border-radius: 12px !important;
  overflow: visible !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  -webkit-backdrop-filter: blur(10px) !important;
          backdrop-filter: blur(10px) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
}

.special-display .challenge-list {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
}

/* Улучшенные стили для карточек челленджей в чате */
.special-display .challenge-card {
  margin: 12px 0 !important;
  background: rgba(255, 255, 255, 0.95) !important;
  -webkit-backdrop-filter: blur(8px) !important;
          backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
}

.special-display .challenge-list-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  text-align: center !important;
  padding: 20px !important;
  border-radius: 12px !important;
  margin-bottom: 24px !important;
}

/* Mobile Header - Fixed at top */
.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  /* No safe area padding - header should be right under Dynamic Island */
}

.mobile-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  min-height: 56px;
  gap: 12px;
}

.mobile-menu-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.mobile-menu-button:hover {
  background: var(--bg-hover);
}

.mobile-menu-button:active {
  transform: scale(0.95);
}

.mobile-header-title {
  flex: 1 1;
  text-align: center;
  padding: 0 8px;
}

.mobile-header-title h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .mobile-header {
    background: var(--bg-primary);
    border-bottom-color: var(--border-color);
  }
}

/* Only show on mobile */
@media (min-width: 769px) {
  .mobile-header {
    display: none;
  }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 1200px) {
  .mobile-header-content {
    padding: 16px 24px;
    min-height: 64px;
  }

  .mobile-header-title h1 {
    font-size: 20px;
  }

  .mobile-menu-button {
    padding: 10px;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .mobile-header-content {
    padding: 10px 12px;
    min-height: 48px;
  }

  .mobile-header-title h1 {
    font-size: 16px;
  }

  .mobile-menu-button {
    padding: 6px;
  }
}

/* Поиск пользователей */
.search-input-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.search-input-container input {
  width: 100%;
  padding: 12px 40px 12px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.search-input-container input:focus {
  outline: none;
  border-color: #667eea;
}

.search-input-container input:disabled {
  background-color: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
}

.search-input-container svg {
  position: absolute;
  right: 12px;
  color: #9ca3af;
  pointer-events: none;
}

.search-results {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 12px;
  z-index: 10;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f3f4f6;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover:not(.already-invited) {
  background-color: #f9fafb;
}

.search-result-item.already-invited {
  background-color: #f3f4f6;
  cursor: not-allowed;
  opacity: 0.7;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.user-info {
  flex: 1 1;
  min-width: 0;
}

.user-name {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #1f2937;
  margin-bottom: 2px;
}

.user-profession {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.invited-badge {
  display: inline-block;
  background: #10b981;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
}

.no-results {
  padding: 16px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 12px;
}

.invited-users {
  margin-top: 16px;
}

.invited-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #374151;
  margin-bottom: 8px;
}

.invited-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.invited-user {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f3f4f6;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 13px;
}

.invited-user .user-avatar {
  width: 24px;
  height: 24px;
}

.invited-user .user-avatar .avatar-placeholder {
  font-size: 10px;
}

.invited-user .user-name {
  font-size: 13px;
  margin: 0;
}

.remove-user {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.remove-user:hover {
  background: #e5e7eb;
  color: #374151;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
  /* iOS specific fixes */
  transform: translateZ(0);
  will-change: transform;
}

.create-challenge-modal {
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease;
  /* iOS specific fixes */
  transform: translateZ(0);
  position: relative;
  z-index: 10000;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
  margin-bottom: 24px;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-title svg {
  color: #667eea;
}

.modal-title h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
}

.close-btn {
  background: none;
  border: none;
  padding: 8px;
  border-radius: 8px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.challenge-form {
  padding: 0 24px 24px;
}

.form-section {
  margin-bottom: 32px;
}

.form-section h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.challenge-types {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  grid-gap: 12px;
  gap: 12px;
}

.challenge-type-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.challenge-type-btn:hover {
  border-color: #667eea;
  border-color: var(--accent-color, #667eea);
  background: rgba(102, 126, 234, 0.05);
}

.challenge-type-btn.active {
  border-color: #667eea;
  border-color: var(--accent-color, #667eea);
  background: rgba(102, 126, 234, 0.1);
}

.challenge-type-btn svg {
  color: #667eea;
  color: var(--accent-color, #667eea);
  flex-shrink: 0;
}

.type-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1;
  min-width: 0;
}

.type-label {
  font-weight: 600;
  color: #1f2937;
  font-size: 14px;
}

.type-description {
  font-size: 12px;
  color: #6b7280;
}

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #374151;
  font-size: 14px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  transition: all 0.2s ease;
  font-family: inherit;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 16px;
  gap: 16px;
}

.privacy-toggle {
  margin-top: 8px;
}

.toggle-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 12px;
  gap: 12px;
}

.toggle-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font-weight: 500;
  color: #6b7280;
}

.toggle-option:hover {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.05);
}

.toggle-option.active {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
}

.toggle-option svg {
  color: inherit;
}

.toggle-description {
  font-size: 12px;
  color: #9ca3af;
}

.toggle-option.active .toggle-description {
  color: #8b8cf5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #f3f4f6;
}

.cancel-btn,
.create-btn {
  flex: 1 1;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 14px;
}

.cancel-btn {
  background: #f3f4f6;
  color: #6b7280;
}

.cancel-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.create-btn {
  background: #667eea;
  background: var(--accent-color, #667eea);
  color: white;
}

.create-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.create-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.create-btn.optimistic {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  position: relative;
  overflow: hidden;
}

.create-btn.optimistic::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  .modal-overlay {
    z-index: 99999 !important;
    transform: translate3d(0, 0, 0);
  }

  .create-challenge-modal {
    z-index: 100000 !important;
    transform: translate3d(0, 0, 0);
  }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 10px;
    align-items: flex-start;
    overflow-y: auto;
  }

  .create-challenge-modal {
    border-radius: 16px;
    margin: 20px 0;
  }

  .modal-header {
    padding: 20px 20px 0;
  }

  .modal-title h2 {
    font-size: 20px;
  }

  .challenge-form {
    padding: 0 20px 20px;
  }

  .challenge-types {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .challenge-type-btn {
    padding: 14px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .toggle-options {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .modal-overlay {
    padding: 0;
  }

  .create-challenge-modal {
    border-radius: 0;
    height: 100vh;
    max-height: none;
    margin: 0;
  }

  .modal-header {
    padding: 16px 16px 0;
  }

  .challenge-form {
    padding: 0 16px 16px;
  }

  .challenge-type-btn {
    padding: 12px;
  }

  .type-label {
    font-size: 13px;
  }

  .type-description {
    font-size: 11px;
  }

  .form-group input,
  .form-group textarea {
    padding: 10px 12px;
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .create-challenge-modal {
    background: #1f2937;
    border: 1px solid #374151;
  }

  .modal-title h2 {
    color: #e5e7eb;
  }

  .close-btn {
    color: #9ca3af;
  }

  .close-btn:hover {
    background: #374151;
    color: #e5e7eb;
  }

  .form-section h3 {
    color: #e5e7eb;
  }

  .challenge-type-btn {
    background: #374151;
    border-color: #4b5563;
  }

  .challenge-type-btn:hover,
  .challenge-type-btn.active {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    border-color: var(--accent-color, #667eea);
  }

  .type-label {
    color: #e5e7eb;
  }

  .type-description {
    color: #9ca3af;
  }

  .form-group label {
    color: #d1d5db;
  }

  .form-group input,
  .form-group textarea {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
  }

  .form-group input:focus,
  .form-group textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
  }

  .toggle-option {
    background: #374151;
    border-color: #4b5563;
    color: #9ca3af;
  }

  .toggle-option:hover,
  .toggle-option.active {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
  }

  .toggle-option.active {
    color: #a5b4fc;
  }

  .toggle-description {
    color: #6b7280;
  }

  .toggle-option.active .toggle-description {
    color: #8b8cf5;
  }

  .modal-actions {
    border-top-color: #374151;
  }

  .cancel-btn {
    background: #374151;
    color: #9ca3af;
  }

  .cancel-btn:hover {
    background: #4b5563;
    color: #e5e7eb;
  }
}

/* Стили для календаря */
.date-picker-section {
  margin-bottom: 24px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.date-display {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.selected-dates {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.date-box {
  flex: 1 1;
  text-align: center;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.date-box.start-date {
  border-color: var(--primary-color);
  background: var(--primary-color-light);
}

.date-box.end-date {
  border-color: var(--accent-color);
  background: var(--accent-color-light);
}

.date-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.date-value {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.date-separator {
  margin: 0 12px;
  font-size: 18px;
  color: var(--text-secondary);
}

.calendar-toggle-btn {
  width: 100%;
  padding: 8px 16px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calendar-toggle-btn:hover {
  background: var(--primary-color-dark);
  transform: translateY(-1px);
}

.calendar-popup {
  margin-top: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.calendar-widget {
  padding: 16px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.month-year {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

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

.weekday {
  padding: 8px 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-secondary);
}

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

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.calendar-day:hover:not(.past):not(:disabled) {
  background: var(--primary-color-light);
  border-color: var(--primary-color);
  transform: scale(1.05);
}

.calendar-day.empty {
  cursor: default;
  pointer-events: none;
}

.calendar-day.past {
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  cursor: not-allowed;
}

.calendar-day.today {
  background: var(--primary-color);
  color: white;
  font-weight: 600;
}

.calendar-day.in-range {
  background: var(--primary-color-light);
  color: var(--primary-color-dark);
}

.calendar-day.range-start,
.calendar-day.range-end {
  background: var(--primary-color);
  color: white;
  font-weight: 600;
}

.calendar-day.range-start::before {
  content: "START";
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 600;
  color: var(--primary-color);
  background: white;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid var(--primary-color);
}

.calendar-day.range-end::before {
  content: "END";
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 600;
  color: var(--accent-color);
  background: white;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid var(--accent-color);
}

.calendar-hint {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
  padding: 8px;
  background: var(--bg-secondary);
  border-radius: 6px;
}

/* Мобильная адаптация календаря */
@media (max-width: 767px) {
  .selected-dates {
    flex-direction: column;
    gap: 12px;
  }

  .date-separator {
    transform: rotate(90deg);
    margin: 8px 0;
  }

  .calendar-grid {
    gap: 2px;
  }

  .calendar-day {
    border-radius: 4px;
    font-size: 12px;
  }

  .weekday {
    font-size: 11px;
    padding: 6px 2px;
  }

  .calendar-widget {
    padding: 12px;
  }
}

/* Стили для информационного сообщения анонимных пользователей */
.anonymous-info {
  margin-top: 16px;
}

.info-message {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #0ea5e9;
  border-radius: 12px;
  color: #0c4a6e;
}

.info-message svg {
  color: #0ea5e9;
  flex-shrink: 0;
}

.info-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-title {
  font-weight: 600;
  font-size: 14px;
  color: #0c4a6e;
}

.info-description {
  font-size: 13px;
  color: #0369a1;
  line-height: 1.4;
}

/* Темная тема для информационного сообщения */
@media (prefers-color-scheme: dark) {
  .info-message {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-color: #3b82f6;
    color: #dbeafe;
  }

  .info-message svg {
    color: #3b82f6;
  }

  .info-title {
    color: #dbeafe;
  }

  .info-description {
    color: #93c5fd;
  }
}

.feed-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-tertiary);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.feed-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1 1;
  justify-content: center;
}

.feed-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.feed-tab.active {
  background: var(--bg-primary);
  color: var(--bg-accent);
  box-shadow: var(--shadow-md);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .feed-tabs {
    margin: 0 -8px 16px -8px;
  }
}

@media (max-width: 480px) {
  .feed-tabs {
    margin: 0 -8px 12px -8px;
  }
  
  .feed-tab span {
    display: none;
  }
}

/* Индикатор состояния кеша */
.cache-status {
  margin-bottom: 16px;
  padding: 8px 16px;
  background: rgba(103, 126, 234, 0.1);
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.cache-indicator {
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cache-indicator.refreshing {
  color: #2563eb;
  animation: pulse 1.5s ease-in-out infinite;
}

.cache-indicator.stale {
  color: #f59e0b;
}

.cache-indicator.fresh {
  color: #059669;
}

.cache-indicator.offline {
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.comment-section {
  border-top: 1px solid var(--border-color);
  padding: 20px;
  margin-top: 16px;
  background: var(--bg-secondary);
  border-radius: 0 0 12px 12px;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.comment-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.comment-section-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-section-header h3::before {
  content: "💬";
  font-size: 16px;
}

.comment-close-btn {
  background: var(--bg-tertiary);
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comment-close-btn:hover {
  background: var(--bg-danger-light);
  color: var(--text-danger);
  transform: scale(1.1);
}

.comments-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.comments-loading,
.comments-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px;
  font-size: 14px;
}

.comment-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--bg-primary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  position: relative;
}

.comment-item:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

/* Стили для ответов на комментарии */
.comment-reply {
  margin-left: 32px;
  border-left: 3px solid var(--primary-color);
  background: linear-gradient(to right, var(--primary-color-light), var(--bg-primary));
  position: relative;
}

.comment-reply::before {
  content: '';
  position: absolute;
  left: -3px;
  top: -12px;
  width: 20px;
  height: 20px;
  border-left: 3px solid var(--primary-color);
  border-bottom: 3px solid var(--primary-color);
  border-bottom-left-radius: 8px;
}

.comment-reply .comment-avatar {
  width: 32px;
  height: 32px;
  border: 2px solid var(--primary-color);
}

.comment-item:last-child {
  margin-bottom: 0;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--bg-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.comment-user-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comment-content {
  flex: 1 1;
  min-width: 0;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-author {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.comment-time {
  color: var(--text-secondary);
  font-size: 12px;
  margin-left: 8px;
}

.comment-reply-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.comment-reply-btn:hover {
  background: var(--primary-color-light);
  color: var(--primary-color);
}

.comment-delete-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  margin-left: auto;
}

.comment-delete-btn:hover {
  background: var(--bg-danger-light);
  color: var(--text-danger);
}

.comment-text {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.comment-mention {
  color: var(--primary-color);
  font-weight: 600;
  background: var(--primary-color-light);
  padding: 2px 4px;
  border-radius: 4px;
}

/* Индикатор ответа в комментарии */
.reply-indicator-small {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--primary-color);
  font-weight: 500;
  opacity: 0.8;
}

.reply-indicator-small svg {
  opacity: 0.7;
}

.comment-form {
  border-top: 1px solid var(--border-color-light);
  padding-top: 16px;
}

.comment-input-wrapper {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.comment-input {
  flex: 1 1;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.4;
  resize: vertical;
  min-height: 60px;
  transition: border-color 0.2s ease;
}

.comment-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.comment-input::placeholder {
  color: var(--text-secondary);
}

.comment-submit-btn {
  background: var(--primary-color);
  color: var(--text-inverse);
  border: none;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: -webkit-fit-content;
  height: fit-content;
}

.comment-submit-btn:hover:not(:disabled) {
  background: var(--primary-color-dark);
  transform: translateY(-1px);
}

.comment-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.comment-form-footer {
  display: flex;
  justify-content: flex-end;
}

.comment-counter {
  font-size: 12px;
  color: var(--text-secondary);
}

.comment-auth-required {
  text-align: center;
  color: var(--text-secondary);
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 14px;
}

.reply-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--primary-color-light);
  border-radius: 8px;
  margin-bottom: 12px;
  border-left: 3px solid var(--primary-color);
}

.reply-indicator span {
  color: var(--primary-color);
  font-size: 13px;
  font-weight: 500;
}

.reply-cancel-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reply-cancel-btn:hover {
  background: var(--primary-color);
  color: white;
}

/* Мобильная адаптация */
@media (max-width: 767px) {
  .comment-section {
    padding: 12px 0;
  }

  .comment-section-header h3 {
    font-size: 14px;
  }

  .comment-item {
    gap: 8px;
    padding: 8px 0;
  }

  .comment-avatar {
    width: 28px;
    height: 28px;
  }

  .comment-author {
    font-size: 13px;
  }

  .comment-text {
    font-size: 13px;
  }

  .comment-input {
    padding: 10px;
    /* Prevent iOS Safari zoom on focus by ensuring font-size >= 16px */
    font-size: 16px;
    min-height: 50px;
  }

  .comment-submit-btn {
    padding: 10px;
    min-width: 40px;
  }

  .comments-list {
    max-height: 250px;
  }

  /* Адаптация ответов для мобильных */
  .comment-reply {
    margin-left: 16px; /* Уменьшаем отступ на мобильных */
  }

  .comment-reply::before {
    width: 12px;
    height: 12px;
  }

  .reply-indicator-small {
    font-size: 10px;
  }

  .comment-reply .comment-avatar {
    width: 24px;
    height: 24px;
  }
}

.feed-item {
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.feed-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.feed-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: #d1d5db;
}

.feed-item.success::before {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
}

.feed-item.failure::before {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
}

.feed-item.milestone::before {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
}

.feed-item.motivation::before {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
}

.feed-item.struggle::before {
  background: linear-gradient(180deg, #8b5cf6 0%, #7c3aed 100%);
}

.feed-item.checkin::before {
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

.feed-item.start::before {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
}

.feed-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1;
  min-width: 0;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

/* Image inside avatar should fully cover the circle */
.user-avatar .avatar-image-small {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.user-details {
  flex: 1 1;
  min-width: 0;
}

.user-details h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.update-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #6b7280;
}

.update-icon {
  flex-shrink: 0;
}

.update-icon.success {
  color: #10b981;
}

.update-icon.failure {
  color: #ef4444;
}

.update-icon.milestone {
  color: #f59e0b;
}

.update-icon.motivation {
  color: #3b82f6;
}

.update-icon.struggle {
  color: #8b5cf6;
}

.update-icon.checkin {
  color: #667eea;
}

.update-icon.start {
  color: #10b981;
}

.update-icon.default {
  color: #6b7280;
}

.update-type {
  font-weight: 500;
  color: inherit;
}

.separator {
  color: #d1d5db;
}

.challenge-title {
  font-weight: 500;
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.update-time {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #9ca3af;
  flex-shrink: 0;
}

.feed-item-content {
  margin-bottom: 16px;
}

.feed-item-content p {
  margin: 0;
  color: #374151;
  line-height: 1.6;
  font-size: 15px;
}

.day-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 12px;
}

.challenge-stats {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr !important;
  grid-gap: 6px !important;
  gap: 6px !important;
  width: 100% !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  border-radius: 8px !important;
  padding: 8px !important;
  margin-bottom: 8px !important;
  overflow: hidden !important;
}

.challenge-stats .stat {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  gap: 1px !important;
  padding: 6px 4px !important;
  background: rgba(255, 255, 255, 0.25) !important;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  min-height: 45px !important;
  justify-content: center !important;
  -webkit-backdrop-filter: blur(10px) !important;
          backdrop-filter: blur(10px) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  word-break: keep-all !important;
}

.challenge-stats .stat-value {
  font-size: 18px !important;
  font-weight: 900 !important;
  color: #ffffff !important;
  line-height: 1.1 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.challenge-stats .stat-label {
  font-size: 11px !important;
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.8px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.feed-item-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.action-btn.like.liked {
  color: #ef4444;
}

.action-btn.like.liked:hover {
  background: #fef2f2;
}

.action-btn.like.optimistic {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

.action-btn.like.optimistic::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.update-image {
  margin: 12px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  max-width: 100%;
}

.update-image img {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: cover;
  display: block;
}

/* Стили для массива изображений */
.update-images {
  margin: 12px 0;
  display: grid;
  grid-gap: 8px;
  gap: 8px;
  grid-template-columns: 1fr 1fr; /* По умолчанию 2 колонки */
}

/* Если только одно изображение */
.update-images:only-child,
.update-images .update-image:only-child {
  grid-column: span 2; /* Занимает обе колонки */
}

/* Для массива изображений уменьшаем отступы у каждого изображения */
.update-images .update-image {
  margin: 0;
}

/* Ограничиваем высоту для изображений в сетке */
.update-images .update-image img {
  max-height: 200px;
}

.start-announcement,
.checkin-report,
.status-change,
.completion-celebration {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.start-announcement {
  background: #f0f9ff;
  color: #0c4a6e;
  border: 1px solid #0284c7;
}

.checkin-report {
  background: #f0fdf4;
  color: #14532d;
  border: 1px solid #16a34a;
}

.status-change {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #64748b;
}

/* Специфичные стили для разных типов изменения статуса */
.status-change.paused {
  background: #fef3c7;
  color: #78350f;
  border: 1px solid #d97706;
}

.status-change.resumed {
  background: #f0fdf4;
  color: #14532d;
  border: 1px solid #16a34a;
}

.status-change.activated {
  background: #f0f9ff;
  color: #0c4a6e;
  border: 1px solid #0284c7;
}

.completion-celebration {
  background: #f0fdf4;
  color: #14532d;
  border: 1px solid #16a34a;
}

.start-icon,
.checkin-icon,
.status-icon,
.completion-icon {
  font-size: 14px;
}

.update-text {
  margin: 0;
  line-height: 1.5;
  color: #374151;
}

.day-badge.start {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.day-badge.checkin {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .feed-item {
    padding: 12px;
    margin-bottom: 8px;
  }
  
  .feed-item-header {
    margin-bottom: 8px;
    gap: 8px;
  }
  
  .user-avatar {
    width: 36px;
    height: 36px;
  }
  
  .user-info {
    gap: 8px;
  }
  
  .user-details h3 {
    font-size: 14px;
    margin-bottom: 2px;
  }
  
  .update-meta {
    font-size: 12px;
  }
  
  .update-time {
    font-size: 11px;
  }
  
  .feed-item-content {
    margin-bottom: 8px;
  }
  
  .challenge-stats {
    padding: 8px !important;
    margin-bottom: 6px !important;
    gap: 5px !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  
  .challenge-stats .stat {
    padding: 5px 3px !important;
    min-height: 38px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
  }
  
  .challenge-stats .stat-value {
    font-size: 13px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  
  .challenge-stats .stat-label {
    font-size: 9px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }
  
  .feed-item-actions {
    padding-top: 8px;
    gap: 12px;
  }
  
  .action-btn {
    padding: 6px 8px;
    font-size: 13px;
  }
  
  /* Мобильные стили для блоков событий */
  .start-announcement,
  .checkin-report,
  .status-change,
  .completion-celebration {
    padding: 4px 8px;
    margin-bottom: 4px;
    font-size: 11px;
    gap: 4px;
  }
}

/* Desktop optimizations */
@media (min-width: 1024px) {
  .challenge-stats {
    padding: 6px;
    border-radius: 6px;
    gap: 4px;
  }
  
  .challenge-stats .stat {
    padding: 4px 3px !important;
    min-height: 35px !important;
    border-radius: 4px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
  }
  
  .challenge-stats .stat-value {
    font-size: 13px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  
  .challenge-stats .stat-label {
    font-size: 9px !important;
    letter-spacing: 0.2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

@media (max-width: 480px) {
  .feed-item {
    padding: 10px;
    margin-bottom: 6px;
  }
  
  .feed-item-header {
    margin-bottom: 6px;
    gap: 6px;
  }
  
  .user-avatar {
    width: 32px;
    height: 32px;
  }
  
  .user-info {
    gap: 8px;
  }
  
  .user-details h3 {
    font-size: 13px;
    margin-bottom: 1px;
  }
  
  .update-meta {
    flex-wrap: wrap;
    gap: 3px;
    font-size: 11px;
  }
  
  .challenge-title {
    flex-basis: 100%;
    margin-top: 1px;
    font-size: 11px;
  }
  
  .separator {
    display: none;
  }
  
  .update-time {
    font-size: 10px;
  }
  
  .feed-item-content {
    margin-bottom: 6px;
  }
  
  .challenge-stats {
    padding: 6px !important;
    margin-bottom: 4px !important;
    gap: 3px !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  
  .challenge-stats .stat {
    padding: 4px 2px !important;
    min-height: 35px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
  }
  
  .challenge-stats .stat-value {
    font-size: 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  
  .challenge-stats .stat-label {
    font-size: 8px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }
  
  .feed-item-actions {
    padding-top: 6px;
    gap: 10px;
  }
  
  .action-btn {
    padding: 4px 6px;
    font-size: 12px;
  }
  
  /* Очень мобильные стили для блоков событий */
  .start-announcement,
  .checkin-report,
  .status-change,
  .completion-celebration {
    padding: 3px 6px;
    margin-bottom: 3px;
    font-size: 10px;
    gap: 3px;
    border-radius: 4px;
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .feed-item {
    background: #1f2937;
    border-color: #374151;
  }
  
  .user-details h3 {
    color: #e5e7eb;
  }
  
  .update-meta {
    color: #9ca3af;
  }
  
  .challenge-title {
    color: #d1d5db;
  }
  
  .update-time {
    color: #6b7280;
  }
  
  .feed-item-content p {
    color: #d1d5db;
  }
  
  .challenge-stats {
    background: linear-gradient(135deg, #525cc7 0%, #5b5ab0 100%);
  }
  
  .stat {
    background: rgba(255, 255, 255, 0.15);
  }
  
  .feed-item-actions {
    border-top-color: #374151;
  }
  
  .action-btn {
    color: #9ca3af;
  }
  
  .action-btn:hover {
    background: #374151;
    color: #e5e7eb;
  }
  
  .action-btn.like.liked:hover {
    background: #7f1d1d;
  }
  
  /* Темная тема для событий - высокий контраст */
  .start-announcement {
    background: #0c4a6e;
    color: #bae6fd;
    border-color: #0284c7;
  }
  
  .checkin-report {
    background: #14532d;
    color: #bbf7d0;
    border-color: #16a34a;
  }
  
  .status-change {
    background: #334155;
    color: #cbd5e1;
    border-color: #64748b;
  }
  
  .status-change.paused {
    background: #78350f;
    color: #fed7aa;
    border-color: #d97706;
  }
  
  .status-change.resumed {
    background: #14532d;
    color: #bbf7d0;
    border-color: #16a34a;
  }
  
  .status-change.activated {
    background: #0c4a6e;
    color: #bae6fd;
    border-color: #0284c7;
  }
  
  .completion-celebration {
    background: #14532d;
    color: #bbf7d0;
    border-color: #16a34a;
  }
}

.invitation-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  color: white;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
}

.invitation-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
}

.invitation-card.expired {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  opacity: 0.7;
}

.invitation-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.invitation-icon {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.invitation-info {
  flex: 1 1;
}

.invitation-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: white;
}

.invitation-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  opacity: 0.9;
}

.inviter {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inviter-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.inviter-avatar.placeholder {
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.time-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.challenge-preview {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.challenge-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: white;
}

.challenge-type {
  font-size: 14px;
  margin: 0 0 8px 0;
  opacity: 0.8;
  font-weight: 500;
}

.challenge-description {
  font-size: 14px;
  margin: 0 0 12px 0;
  opacity: 0.9;
  line-height: 1.4;
}

.challenge-stats {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  opacity: 0.8;
}

.invitation-message {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  border-left: 3px solid rgba(255, 255, 255, 0.3);
}

.invitation-message p {
  margin: 0;
  font-style: italic;
  font-size: 14px;
  opacity: 0.9;
}

.invitation-actions {
  display: flex;
  gap: 12px;
}

.action-btn {
  flex: 1 1;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.action-btn.accept {
  background: rgba(34, 197, 94, 0.9);
  color: white;
}

.action-btn.accept:hover:not(:disabled) {
  background: rgba(34, 197, 94, 1);
  transform: translateY(-1px);
}

.action-btn.decline {
  background: rgba(239, 68, 68, 0.9);
  color: white;
}

.action-btn.decline:hover:not(:disabled) {
  background: rgba(239, 68, 68, 1);
  transform: translateY(-1px);
}

.expired-notice {
  text-align: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-weight: 500;
  opacity: 0.8;
}

/* Адаптивность */
@media (max-width: 768px) {
  .invitation-card {
    padding: 16px;
    margin-bottom: 16px;
  }
  
  .invitation-actions {
    flex-direction: column;
  }
  
  .action-btn {
    padding: 14px 16px;
  }
  
  .invitation-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Секция приглашений */
.invitations-section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 0 4px;
}

.section-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  flex: 1 1;
}

.invitations-count {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.invitations-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.community-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  grid-gap: 12px;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-primary);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.stat-card svg {
  color: var(--bg-accent);
  background: rgba(102, 126, 234, 0.1);
  padding: 8px;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.stat-card h3 {
  margin: 0 0 2px 0;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card p {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .community-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
  }
  
  .stat-card {
    padding: 12px;
    flex-direction: column;
    text-align: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
  }
  
  .stat-card svg {
    width: 32px;
    height: 32px;
    padding: 6px;
  }
}

@media (max-width: 480px) {
  .community-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 16px;
  }
  
  .stat-card {
    padding: 10px 6px;
    flex-direction: column;
    text-align: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
  }
  
  .stat-card svg {
    width: 28px;
    height: 28px;
    padding: 4px;
  }
  
  .stat-card h3 {
    font-size: 10px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    word-break: keep-all;
  }
  
  .stat-card p {
    font-size: 18px;
    line-height: 1;
  }
}

.checkin-section {
  margin-bottom: 32px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-title svg {
  color: var(--bg-accent);
}

.checkin-challenges {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .checkin-section {
    margin-bottom: 20px;
  }
  
  .section-title {
    font-size: 16px;
    margin-bottom: 12px;
  }
}

@media (max-width: 480px) {
  .checkin-section {
    margin-bottom: 16px;
  }
  
  .section-title {
    font-size: 15px;
    margin-bottom: 10px;
  }
}

.feed-main {
  /* Основной контейнер для ленты */
}

.feed-updates {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.empty-feed {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-primary);
  border-radius: 16px;
  border: 1px solid var(--border-color);
}

.empty-feed svg {
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.empty-feed h3 {
  margin: 0 0 8px 0;
  font-size: 20px;
  color: var(--text-primary);
}

.empty-feed p {
  margin: 0 0 24px 0;
  color: var(--text-secondary);
}

.create-first-challenge {
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.create-first-challenge:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.feed-stats {
  background: var(--bg-primary);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  padding: 32px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-gap: 32px;
  gap: 32px;
}

.stats-section h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  color: var(--text-primary);
}

.popular-challenges,
.weekly-leaders {
  color: var(--text-secondary);
  font-style: italic;
}

.feed {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.feed-header {
  margin-bottom: 32px;
}

.feed-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 20px;
}

.feed-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.feed-title svg {
  color: #667eea;
  flex-shrink: 0;
}

.feed-title h1 {
  margin: 0 0 4px 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.feed-title p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 16px;
}

.create-challenge-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.create-challenge-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.feed-content {
  /* Контейнер для содержимого ленты */
}

.feed-loading,
.feed-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loading-spinner svg {
  color: #667eea;
}

.loading-spinner p {
  color: var(--text-secondary);
  font-size: 16px;
}

.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.retry-btn {
  margin-top: 16px;
  padding: 10px 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.retry-btn:hover {
  background: #5a67d8;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .feed {
    padding: 0 16px;
  }

  .feed-header {
    margin-bottom: 16px;
  }

  .feed-header-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
  }

  .feed-title {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    text-align: left;
  }

  .feed-title h1 {
    font-size: 20px;
    margin: 0;
  }

  .feed-title p {
    display: none;
  }
}

@media (max-width: 480px) {
  .feed-header {
    margin-bottom: 12px;
  }

  .feed-header-content {
    margin-bottom: 12px;
  }

  .feed-title svg {
    display: none;
  }

  .feed-title h1 {
    font-size: 18px;
  }

  .create-challenge-btn span {
    display: none;
  }

  .create-challenge-btn {
    padding: 10px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    justify-content: center;
  }
}

.challenge-card-compact {
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 16px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  /* CSS переменные для динамического окрашивания */
  --challenge-color: #6b7280;
  --challenge-gradient: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  --challenge-light-bg: rgba(107, 114, 128, 0.1);
  --challenge-border-color: #6b7280;
}

.challenge-card-compact:hover {
  transform: translateY(-2px) scale(1.005);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: var(--challenge-border-color);
}

/* Цветные полоски для типов челленджей */
.challenge-card-compact::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--challenge-gradient);
  opacity: 0.8;
  transition: all 0.3s ease;
}

.challenge-card-compact:hover::before {
  width: 6px;
  opacity: 1;
}

/* Дополнительная подсветка для активных челленджей */
.challenge-card-compact.active::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 2px;
  height: 100%;
  background: #10b981;
  opacity: 0.6;
}

.challenge-card-compact.completed::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 2px;
  height: 100%;
  background: #22c55e;
  opacity: 0.6;
}

.challenge-card-compact.paused::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 2px;
  height: 100%;
  background: #f59e0b;
  opacity: 0.6;
}

.challenge-card-compact.failed::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 2px;
  height: 100%;
  background: #ef4444;
  opacity: 0.6;
}

/* Заголовок */
.challenge-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 8px;
}

.challenge-info {
  flex: 1 1;
  min-width: 0;
}

.challenge-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  min-height: 32px; /* Соответствует высоте иконки */
}

.challenge-type-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--challenge-light-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.challenge-type-icon-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--challenge-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.challenge-type-icon {
  color: var(--challenge-color);
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.challenge-card-compact:hover .challenge-type-icon-wrapper {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 25px var(--challenge-light-bg);
  border-color: var(--challenge-border-color);
}

.challenge-card-compact:hover .challenge-type-icon-wrapper::before {
  opacity: 0.1;
}

.challenge-card-compact:hover .challenge-type-icon {
  color: white;
  transform: scale(1.1);
}

.challenge-title-compact {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1;
  display: flex;
  align-items: center;
  min-height: 32px; /* Соответствует высоте иконки */
}

.challenge-type-compact {
  font-size: 12px;
  color: var(--challenge-color);
  font-weight: 600;
  background: var(--challenge-light-bg);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  text-transform: capitalize;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.challenge-type-compact::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s ease;
}

.challenge-card-compact:hover .challenge-type-compact {
  background: var(--challenge-color);
  color: white;
  border-color: var(--challenge-border-color);
  transform: translateY(-1px);
}

.challenge-card-compact:hover .challenge-type-compact::before {
  left: 100%;
}

.challenge-status-compact {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-text {
  display: none; /* Скрываем текст на мобиле, оставляем только иконку */
}

.status-icon.active {
  color: #10b981;
}

.status-icon.paused {
  color: #f59e0b;
}

.status-icon.completed {
  color: #3b82f6;
}

.status-icon.failed {
  color: #ef4444;
}

/* Новые простые иконки без обводок */
.challenge-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.mode-icon, .visibility-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  transition: all 0.3s ease;
  cursor: pointer;
  opacity: 0.7;
}

.mode-icon:hover, .visibility-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}

.mode-icon.personal {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.mode-icon.group {
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
}

.visibility-icon.public {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.visibility-icon.private {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.icon-with-crown {
  position: relative;
  display: flex;
  align-items: center;
}

.creator-crown {
  position: absolute;
  top: -6px;
  right: -6px;
  color: #fbbf24;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
  animation: crown-pulse 2s ease-in-out infinite;
}

@keyframes crown-pulse {
  0%, 100% { 
    transform: scale(1);
    opacity: 0.8;
  }
  50% { 
    transform: scale(1.15);
    opacity: 1;
  }
}

/* Статистика - горизонтальная компактная */
.challenge-stats-compact {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 8px;
}

.stat-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1;
  text-align: center;
  transition: all 0.3s ease;
  border-radius: 8px;
  padding: 4px;
  position: relative;
  overflow: hidden;
}

.stat-compact:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}

.stat-compact::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--challenge-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.stat-compact:hover::before {
  opacity: 0.1;
}

.stat-compact.primary .stat-value {
  color: #10b981;
  font-weight: 700;
}

.stat-compact .stat-value {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1;
  margin-bottom: 1px;
}

.stat-compact .stat-label {
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}

/* Прогресс-бар */
.progress-section-compact {
  margin-bottom: 12px;
}

.progress-bar-compact {
  width: 100%;
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill-compact {
  height: 100%;
  background: var(--challenge-gradient);
  border-radius: 2px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-fill-compact::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
  border-radius: 2px;
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Описание - сворачиваемое */
.challenge-description-compact {
  margin-bottom: 12px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Даты */
.challenge-dates-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 11px;
  color: #6b7280;
}

.date-compact {
  display: flex;
  align-items: center;
  gap: 4px;
}

.date-compact svg {
  flex-shrink: 0;
}

/* Действия - компактные */
.challenge-actions-compact {
  display: flex;
  gap: 6px;
  border-top: 1px solid #f3f4f6;
  padding-top: 12px;
}

.action-btn-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1 1;
  min-height: 32px;
}

.action-btn-compact.checkin {
  background: var(--challenge-gradient);
  color: white;
  font-weight: 600;
  flex: 2 1; /* Больше места для главной кнопки */
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.action-btn-compact.checkin::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--challenge-color) 0%, var(--challenge-border-color) 100%);
  transition: left 0.3s ease;
  z-index: -1;
}

.action-btn-compact.checkin:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px var(--challenge-light-bg);
}

.action-btn-compact.checkin:hover:not(:disabled)::before {
  left: 0;
}

.action-btn-compact.checkin.checked-in {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #10b981;
  cursor: default;
  position: relative;
}

.action-btn-compact.checkin.checked-in::after {
  content: '✓';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: bold;
  opacity: 0.8;
}

.action-btn-compact.checkin.checked-in:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.action-btn-compact.checkin:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.action-btn-compact.secondary {
  background: #f3f4f6;
  color: #6b7280;
  flex: 0 0 32px; /* Фиксированная ширина для вторичных кнопок */
  padding: 6px;
}

.action-btn-compact.secondary:hover {
  background: #e5e7eb;
  color: #374151;
}

.action-btn-compact.resume {
  background: #d1fae5;
  color: #065f46;
  flex: 2 1;
}

.action-btn-compact.resume:hover {
  background: #a7f3d0;
}

.action-btn-compact.delete {
  background: #fee2e2;
  color: #991b1b;
  flex: 0 0 32px;
  padding: 6px;
}

.action-btn-compact.delete:hover {
  background: #fecaca;
}

.action-btn-compact.leave-group {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.action-btn-compact.leave-group:hover {
  background: rgba(245, 158, 11, 0.2);
  transform: translateY(-1px);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 480px) {
  .challenge-card-compact {
    padding: 14px;
  }
  
  .challenge-type-icon-wrapper {
    width: 28px;
    height: 28px;
  }
  
  .challenge-type-compact {
    display: none; /* Скрываем лейбл типа на мобильных */
  }
  
  .mode-icon, .visibility-icon {
    width: 20px;
    height: 20px;
  }
}

/* Адаптивность для планшетов */
@media (min-width: 481px) and (max-width: 768px) {
  .challenge-status-compact {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .status-text {
    display: inline; /* Показываем текст статуса на планшетах */
  }
  
  .mode-icon, .visibility-icon {
    width: 26px;
    height: 26px;
  }
  
  .challenge-stats-compact {
    gap: 16px;
  }
  
  .action-btn-compact {
    font-size: 13px;
    padding: 8px 10px;
  }
}

/* Адаптивность для десктопа */
@media (min-width: 769px) {
  .challenge-card-compact {
    padding: 20px;
  }
  
  .challenge-type-icon-wrapper {
    width: 36px;
    height: 36px;
  }
  
  .challenge-status-compact {
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }
  
  .status-text {
    display: inline;
  }
  
  .mode-icon, .visibility-icon {
    width: 28px;
    height: 28px;
  }
  
  .challenge-title-compact {
    font-size: 18px;
  }
  
  .challenge-type-compact {
    font-size: 13px;
  }
  
  .challenge-stats-compact {
    gap: 20px;
    padding: 12px 16px;
  }
  
  .stat-compact .stat-value {
    font-size: 18px;
  }
  
  .stat-compact .stat-label {
    font-size: 12px;
  }
  
  .challenge-description-compact {
    font-size: 14px;
  }
  
  .challenge-dates-compact {
    font-size: 12px;
  }
  
  .action-btn-compact {
    font-size: 13px;
    padding: 8px 12px;
    gap: 6px;
  }
  
  .action-btn-compact.secondary {
    flex: 0 0 40px;
    padding: 8px;
  }
  
  .action-btn-compact.delete {
    flex: 0 0 40px;
    padding: 8px;
  }
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
  .challenge-card-compact {
    background: #1f2937;
    border-color: #374151;
  }
  
  .challenge-title-compact {
    color: #e5e7eb;
  }
  
  .challenge-type-compact {
    color: #9ca3af;
  }
  
  .challenge-description-compact {
    color: #9ca3af;
  }
  
  .challenge-stats-compact {
    background: #374151;
  }
  
  .stat-compact .stat-value {
    color: #e5e7eb;
  }
  
  .stat-compact .stat-label {
    color: #9ca3af;
  }
  
  .progress-bar-compact {
    background: #4b5563;
  }
  
  .challenge-dates-compact {
    color: #9ca3af;
  }
  
  .challenge-actions-compact {
    border-top-color: #374151;
  }
  
  .action-btn-compact.checkin {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    border-color: transparent;
  }
  
  .action-btn-compact.checkin::before {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  }
  
  .action-btn-compact.checkin:hover:not(:disabled) {
    box-shadow: 0 4px 15px rgba(30, 64, 175, 0.4);
  }
  
  .action-btn-compact.checkin.checked-in {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    border-color: #047857;
  }
  
  .action-btn-compact.checkin.checked-in:hover {
    box-shadow: 0 2px 8px rgba(4, 120, 87, 0.3);
  }
  
  .action-btn-compact.secondary {
    background: #374151;
    color: #9ca3af;
  }
  
  .action-btn-compact.secondary:hover {
    background: #4b5563;
    color: #d1d5db;
  }
  
  .action-btn-compact.resume {
    background: #065f46;
    color: #d1fae5;
  }
  
  .action-btn-compact.resume:hover {
    background: #047857;
  }
  
  .action-btn-compact.delete {
    background: #7f1d1d;
    color: #fecaca;
  }
  
  .action-btn-compact.delete:hover {
    background: #991b1b;
  }
}

/* Стили для кнопки стейкинга */
.action-btn-compact.stake {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  flex: 0 0 32px;
  padding: 6px;
}

.action-btn-compact.stake:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Стили для застейканного состояния */
.action-btn-compact.stake.staked {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
}

.action-btn-compact.stake.staked:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

/* Стили для завершенного стейка */
.action-btn-compact.stake.completed {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: white;
}

.action-btn-compact.stake.completed:hover {
  background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

/* Анимация загрузки */
.action-btn-compact.stake .loading {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Стили для отображения суммы стейка */
.stat-compact.stake-amount {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
  border-radius: 6px;
  padding: 8px 6px;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}

.stat-compact.stake-amount .stat-value {
  color: white;
  font-weight: 600;
}

.stat-compact.stake-amount .stat-label {
  color: rgba(255, 255, 255, 0.9);
  font-size: 10px;
}

.stat-compact.participants {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  border-radius: 6px;
  padding: 8px 6px;
  box-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
}

.stat-compact.participants .stat-value {
  color: white;
  font-weight: 600;
}

.stat-compact.participants .stat-label {
  color: rgba(255, 255, 255, 0.9);
  font-size: 10px;
}

/* Стили для информации о завершенном стейке */
.date-compact.stake-info {
  color: #059669;
  font-weight: 500;
  font-size: 10px;
}

.date-compact.stake-info svg {
  color: #059669;
}

.challenge-staking-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
  overflow-y: auto;
}

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

.challenge-staking-content {
  background: var(--bg-primary);
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  animation: slideUp 0.3s ease-out;
}

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

.challenge-staking-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 20px;
  border-bottom: none;
  margin-bottom: 0;
}

.challenge-staking-header h3 {
  margin: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.close-button {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.challenge-info {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}

.challenge-card {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.challenge-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.challenge-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 16px;
}

.challenge-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  flex: 1 1;
}

.challenge-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.challenge-status.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.challenge-status.completed {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.challenge-timeline {
  display: flex;
  gap: 20px;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1;
}

.timeline-icon {
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.timeline-date {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.contract-info,
.existing-stake,
.stake-form,
.token-selection {
  padding: 20px 24px 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}

.contract-info:last-child,
.existing-stake:last-child,
.stake-form:last-child,
.token-selection:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.contract-info h4,
.existing-stake h4,
.stake-form h4,
.token-selection h4 {
  margin: 0 0 12px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}

.info-grid,
.stake-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 8px;
  gap: 8px;
}

.info-grid > div,
.stake-details > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.info-grid span:first-child,
.stake-details span:first-child {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 13px;
}

.info-grid span:last-child,
.stake-details span:last-child {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}

.status {
  padding: 4px 8px !important;
  border-radius: 4px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-transform: uppercase;
}

.status.active {
  background: #d4edda !important;
  color: #155724 !important;
}

.status.completed {
  background: #d1ecf1 !important;
  color: #0c5460 !important;
}

.stake-description {
  margin: 0 0 16px;
  padding: 16px;
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  overflow: hidden;
}

.stake-description::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
  background: var(--bg-primary);
  color: var(--text-primary);
}

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

.form-group input:disabled {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
}

.form-group small {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 12px;
}

.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 13px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.stake-button,
.emergency-withdraw-button {
  flex: 1 1;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
  position: relative;
  overflow: hidden;
}

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

.stake-button:hover::before,
.emergency-withdraw-button:hover::before {
  left: 100%;
}

.stake-button:hover,
.emergency-withdraw-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(102, 126, 234, 0.5);
  filter: brightness(1.1);
}

.stake-button:active,
.emergency-withdraw-button:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.stake-button:disabled,
.emergency-withdraw-button:disabled {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  color: var(--text-tertiary);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: none;
}

.emergency-withdraw-button {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  margin-top: 16px;
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

.emergency-withdraw-button:hover {
  box-shadow: 0 12px 35px rgba(239, 68, 68, 0.5);
}

.cancel-button {
  flex: 1 1;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

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

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

.cancel-button:hover {
  background: linear-gradient(135deg, var(--bg-hover) 0%, var(--bg-secondary) 100%);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.cancel-button:disabled {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  cursor: not-allowed;
  transform: none;
}



/* Мобильная адаптация */
@media (max-width: 768px) {
  .challenge-staking-modal {
    padding: 8px;
  }

  .challenge-staking-content {
    max-height: 95vh;
    max-width: 95vw;
    border-radius: 12px;
  }

  .challenge-staking-header {
    padding: 20px 20px 16px;
    margin-bottom: 0;
  }

  .challenge-staking-header h3 {
    font-size: 18px;
  }

  .contract-info,
  .existing-stake,
  .stake-form,
  .token-selection {
    padding: 16px 20px 20px;
    margin-bottom: 0;
  }

  .challenge-info {
    padding: 0 20px 20px;
    margin-bottom: 0;
  }

  .challenge-card {
    padding: 16px;
  }

  .challenge-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
  }

  .challenge-title {
    font-size: 16px;
  }

  .challenge-timeline {
    flex-direction: column;
    gap: 12px;
  }

  .timeline-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .timeline-date {
    font-size: 13px;
  }

  .info-grid,
  .stake-details {
    grid-template-columns: 1fr;
  }

  .challenge-details {
    flex-direction: column;
    gap: 8px;
  }

  .form-actions {
    flex-direction: column;
  }

  .stake-button,
  .cancel-button,
  .emergency-withdraw-button {
    flex: none;
  }

  .token-option {
    padding: 10px;
  }

  .token-symbol {
    font-size: 13px;
  }

  .token-name {
    font-size: 11px;
  }

  .token-balance {
    font-size: 13px;
  }

  .max-button {
    padding: 3px 6px;
    font-size: 11px;
    right: 6px;
  }

  .amount-input-container input {
    padding-right: 50px;
  }
}

/* Анимации */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.challenge-staking-content {
  animation: fadeIn 0.2s ease-out;
}

/* Скроллбар */
.challenge-staking-content::-webkit-scrollbar {
  width: 6px;
}

.challenge-staking-content::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 3px;
}

.challenge-staking-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.challenge-staking-content::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* Стили для выбора токенов */
.token-selection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.refresh-tokens-button {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}

.refresh-tokens-button:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: rotate(180deg);
}

.refresh-tokens-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.loading-tokens {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.token-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.token-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

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

.token-option:hover::before {
  left: 100%;
}

.token-option:hover {
  background: linear-gradient(135deg, var(--bg-hover) 0%, var(--bg-secondary) 100%);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.token-option.selected {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.token-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.token-symbol {
  font-weight: 700;
  font-size: 16px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}

.token-option.selected .token-symbol {
  background: linear-gradient(135deg, white 0%, rgba(255, 255, 255, 0.8) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.token-name {
  font-size: 12px;
  opacity: 0.7;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.token-balance {
  font-weight: 700;
  font-size: 15px;
  text-align: right;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.token-option.selected .token-balance {
  background: linear-gradient(135deg, white 0%, rgba(255, 255, 255, 0.9) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.no-tokens {
  text-align: center;
  padding: 20px;
}

.no-tokens p {
  margin: 0 0 8px;
  color: var(--text-primary);
  font-size: 14px;
}

.no-tokens small {
  color: var(--text-secondary);
  font-size: 12px;
}

/* Стили для поля ввода суммы с кнопкой MAX */
.amount-input-container {
  position: relative;
  display: flex;
}

.amount-input-container input {
  flex: 1 1;
  padding-right: 70px; /* Место для кнопки MAX */
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 16px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border: 2px solid var(--border-color);
  transition: all 0.3s ease;
}

.amount-input-container input:focus {
  border-color: #667eea;
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
  background: var(--bg-primary);
}

.max-button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.max-button:hover {
  transform: translateY(-50%) translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  filter: brightness(1.1);
}

.max-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: translateY(-50%);
  box-shadow: none;
}

/* Поддержка темной темы через класс */
.dark .challenge-staking-modal,
[data-theme="dark"] .challenge-staking-modal {
  background: rgba(0, 0, 0, 0.8);
}

.dark .challenge-staking-content,
[data-theme="dark"] .challenge-staking-content {
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --bg-tertiary: #374151;
  --bg-hover: #4b5563;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-tertiary: #9ca3af;
  --text-inverse: #111827;
  --border-color: #374151;
  --border-hover: #4b5563;
  --border-accent: #667eea;
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

.my-challenges {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Индикатор состояния кеша */
.my-challenges .cache-status {
  margin-bottom: 24px;
  padding: 8px 16px;
  background: rgba(103, 126, 234, 0.1);
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.my-challenges .cache-indicator {
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.my-challenges .cache-indicator.refreshing {
  color: #2563eb;
  animation: pulse 1.5s ease-in-out infinite;
}

.my-challenges .cache-indicator.stale {
  color: #f59e0b;
}

.my-challenges .cache-indicator.fresh {
  color: #059669;
}

.my-challenges .cache-indicator.offline {
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
}

.my-challenges-header {
  margin-bottom: 32px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title svg {
  color: #667eea;
  flex-shrink: 0;
}

.header-title h1 {
  margin: 0 0 4px 0;
  font-size: 28px;
  font-weight: 700;
  color: #1f2937;
}

.header-title p {
  margin: 0;
  color: #6b7280;
  font-size: 16px;
}

.create-challenge-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.create-challenge-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.challenges-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
}

.empty-challenges {
  text-align: center;
  padding: 80px 20px;
  background: white;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
}

.empty-challenges svg {
  color: #d1d5db;
  margin-bottom: 16px;
}

.empty-challenges h3 {
  margin: 0 0 8px 0;
  font-size: 24px;
  color: #1f2937;
}

.empty-challenges p {
  margin: 0 0 24px 0;
  color: #6b7280;
  font-size: 16px;
}

.create-first-challenge {
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.create-first-challenge:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* Старые стили карточек удалены - теперь используется ChallengeCard.css */

.my-challenges-loading,
.my-challenges-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}

.my-challenges-loading svg {
  color: #667eea;
  margin-bottom: 16px;
}

.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.retry-btn {
  margin-top: 16px;
  padding: 10px 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.retry-btn:hover {
  background: #5a67d8;
}

/* Mobile responsive - улучшенная версия для компактных карточек */
@media (max-width: 768px) {
  .my-challenges {
    padding: 0 12px;
  }
  
  .header-content {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  
  .header-title {
    text-align: center;
    gap: 8px;
  }
  
  .header-title h1 {
    font-size: 24px;
  }
  
  .header-title p {
    font-size: 14px;
  }
  
  .challenges-grid {
    gap: 12px;
  }
  
  .create-challenge-btn {
    align-self: center;
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .my-challenges {
    padding: 0 8px;
  }
  
  .header-title svg {
    display: none;
  }
  
  .create-challenge-btn span {
    display: none;
  }
  
  .create-challenge-btn {
    padding: 12px;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    justify-content: center;
    align-self: flex-end;
  }
  
  .challenges-grid {
    gap: 8px;
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .header-title h1 {
    color: #e5e7eb;
  }
  
  .header-title p {
    color: #9ca3af;
  }
  
  .empty-challenges {
    background: #1f2937;
    border-color: #374151;
  }
  
  .empty-challenges h3 {
    color: #e5e7eb;
  }
  
  .empty-challenges p {
    color: #9ca3af;
  }
  
  /* Темные стили для карточек теперь в ChallengeCard.css */
}

/* Profile Page - Mobile First Design */

/* Mobile-first base styles */
.profile-page {
  padding: 12px;
  max-width: 1200px;
  margin: 0 auto;
  color: var(--text-primary);
  min-height: 100vh;
}

.profile-header {
  text-align: center;
  margin-bottom: 20px;
  padding: 0 8px;
}

.profile-header h2 {
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-weight: 700;
}

.profile-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
  line-height: 1.4;
}

.profile-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-primary);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

/* Navigation - Mobile optimized tabs */
.profile-nav {
  background: var(--bg-secondary);
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-bottom: 1px solid var(--border-color);
}

.profile-nav-item {
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  position: relative;
  border-radius: 0;
}

.profile-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.profile-nav-item.active {
  background: var(--bg-primary);
  color: var(--bg-accent);
  position: relative;
}

.profile-nav-item.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 3px 3px 0 0;
}

/* Content */
.profile-content {
  padding: 16px 12px;
  background: var(--bg-primary);
  min-height: 400px;
}

.profile-section h3 {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 16px;
  font-weight: 600;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .profile-nav {
    grid-template-columns: repeat(5, 1fr);
    font-size: 10px;
  }

  .profile-nav-item {
    padding: 12px 4px;
    gap: 4px;
  }
}

/* Stats Overview */
.stats-overview {
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-gap: 12px;
  gap: 12px;
}

.profile-page .stat-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
}

.stat-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(102, 126, 234, 0.12);
  color: #7c89ff;
}

.profile-page .stat-title {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.2;
  margin-bottom: 6px;
}

.profile-page .stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-icon {
  color: var(--bg-accent);
  flex-shrink: 0;
}

.stat-info h4 {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-weight: 600;
}

.stat-info p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
}

/* Quick Actions */
.quick-actions {
  margin-bottom: 20px;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-gap: 12px;
  gap: 12px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
  font-weight: 600;
  min-height: 52px;
  box-shadow: var(--shadow-sm);
}

.action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Avatar Section */
.avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 20px 16px;
  background: var(--bg-secondary);
  border-radius: 10px;
  border: 2px dashed var(--border-color);
}

.avatar-container {
  position: relative;
}

.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-primary);
}

.avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  border: 4px solid var(--bg-primary);
}

.avatar-upload-btn {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 32px;
  height: 32px;
  background: var(--bg-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 3px solid var(--bg-primary);
}

.avatar-upload-btn:hover {
  background: var(--border-accent);
  transform: scale(1.1);
}

.avatar-info p {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-weight: 500;
}

.avatar-info span {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Form Elements */
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  grid-gap: 16px;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea {
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.2s ease;
  background: var(--bg-secondary);
  color: var(--text-primary);
  min-height: 48px;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-secondary);
}

.form-group textarea {
  resize: vertical;
  font-family: inherit;
  min-height: 100px;
}

/* Password Input */
.password-input {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.password-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Buttons */
.save-btn,
.enable-2fa-btn,
.verify-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  background: var(--gradient-primary);
  color: var(--text-inverse);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  align-self: stretch;
  min-height: 48px;
  width: 100%;
}

.save-btn:hover,
.enable-2fa-btn:hover,
.verify-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.disable-2fa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: var(--text-inverse);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
  width: 100%;
}

.disable-2fa-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.cancel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
  width: 100%;
}

.cancel-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* Security Blocks */
.security-block {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.security-block h3 {
  margin-top: 0;
  margin-bottom: 16px;
}

/* 2FA Section */
.twofa-setup,
.twofa-enabled {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.twofa-info {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: rgba(102, 126, 234, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 12px;
}

.info-icon {
  color: var(--bg-accent);
  flex-shrink: 0;
}

.info-text h4 {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-weight: 600;
}

.info-text p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.qr-setup {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.qr-container {
  text-align: center;
  padding: 24px;
  background: var(--bg-primary);
  border-radius: 12px;
  border: 2px dashed var(--border-color);
}

.qr-placeholder {
  width: 180px;
  height: 180px;
  margin: 0 auto 16px;
  border-radius: 8px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.qr-code {
  width: 180px;
  height: 180px;
  margin: 0 auto 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.qr-container p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.verification-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 300px;
}

.verification-form input {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 4px;
  padding: 16px;
  min-height: 56px;
}

.verification-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.enabled-status {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 12px;
}

.status-icon {
  color: #22c55e;
  flex-shrink: 0;
}

.status-text h4 {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-weight: 600;
}

.status-text p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Tablet styles */
@media (min-width: 480px) {
  .profile-page {
    padding: 16px;
  }

  .profile-header h2 {
    font-size: 24px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
  }

  .action-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .avatar-section {
    flex-direction: row;
    text-align: left;
    gap: 16px;
    padding: 20px;
  }

  .form-row {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .save-btn,
  .enable-2fa-btn,
  .verify-btn,
  .disable-2fa-btn,
  .cancel-btn {
    align-self: flex-start;
    width: auto;
    min-width: 200px;
  }

  .verification-buttons {
    flex-direction: row;
    justify-content: flex-start;
  }

  .verification-buttons .verify-btn,
  .verification-buttons .cancel-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 120px;
  }
}

/* Desktop styles */
@media (min-width: 768px) {
  .profile-page {
    padding: 24px;
  }

  .profile-header {
    margin-bottom: 32px;
  }

  .profile-header h2 {
    font-size: 28px;
  }

  .profile-container {
    flex-direction: row;
    gap: 0;
  }

  .profile-nav {
    min-width: 240px;
    flex-direction: column;
    display: flex;
    padding: 24px 0;
    border-bottom: none;
    border-right: 1px solid var(--border-color);
    background: var(--bg-secondary);
  }

  .profile-nav-item {
    width: 100%;
    padding: 16px 24px;
    flex-direction: row;
    text-align: left;
    font-size: 16px;
    border-radius: 0;
  }

  .profile-nav-item.active::after {
    display: none;
  }

  .profile-nav-item.active::before {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--gradient-primary);
    border-radius: 2px 0 0 2px;
  }

  .profile-content {
    flex: 1 1;
    padding: 32px;
  }

  .profile-section h3 {
    font-size: 22px;
    margin-bottom: 24px;
  }

  .profile-form {
    gap: 24px;
  }

  .stats-overview {
    margin-bottom: 32px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
  }

  .profile-page .stat-card {
    padding: 20px;
  }

  .quick-actions {
    margin-bottom: 32px;
  }

  .action-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
  }

  .security-block {
    margin-bottom: 32px;
    padding: 24px;
  }
}

/* Mobile touch optimizations */
@media (max-width: 767px) {
  /* Remove hover effects on mobile */
  .profile-nav-item:hover,
  .action-btn:hover,
  .save-btn:hover,
  .enable-2fa-btn:hover,
  .verify-btn:hover,
  .disable-2fa-btn:hover,
  .cancel-btn:hover,
  .password-toggle:hover,
  .avatar-upload-btn:hover {
    transform: none;
    box-shadow: none;
  }

  /* Add active states for touch */
  .profile-nav-item:active,
  .action-btn:active,
  .save-btn:active,
  .enable-2fa-btn:active,
  .verify-btn:active,
  .disable-2fa-btn:active,
  .cancel-btn:active {
    transform: scale(0.98);
    opacity: 0.8;
  }

  /* Ensure proper scrolling on mobile */
  .profile-page {
    overflow-x: hidden;
  }

  /* Better touch targets */
  .password-toggle {
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
  }

  .avatar-upload-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

.user-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  max-width: 500px;
  margin: 0 auto;
}

.user-header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.user-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  width: 100%;
}

.user-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1;
}

.user-card .user-avatar {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: white;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.user-card .user-avatar-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.user-card .user-avatar:hover .avatar-overlay {
  display: flex;
}

.avatar-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.avatar-modal {
  background: #fff;
  background: var(--bg-primary, #fff);
  border-radius: 12px;
  padding: 16px;
  width: 90vw;
  max-width: 420px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.crop-area {
  position: relative;
  width: 100%;
  height: 300px;
  background: #111827;
  border-radius: 8px;
  overflow: hidden;
}

.avatar-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

.avatar-modal-actions .save-btn,
.avatar-modal-actions .cancel-btn {
  min-width: 120px;
}

.user-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #1f2937;
  flex: 1 1;
  text-align: left;
}

.header-edit {
  flex: 1 1;
}

.follow-stats-container {
  margin-bottom: 20px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.user-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.field-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.field-content svg {
  color: #6b7280;
  margin-top: 2px;
  flex-shrink: 0;
}

.field-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.field-value {
  flex: 1 1;
  color: #1f2937;
  font-size: 16px;
  line-height: 1.5;
}

.edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  padding: 4px;
  border-radius: 4px;
  opacity: 0.7;
  transition: all 0.2s;
}

.edit-btn:hover {
  opacity: 1;
  color: #3b82f6;
  background: #f3f4f6;
}

.edit-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.edit-input {
  padding: 8px 12px;
  border: 2px solid #3b82f6;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.edit-input:focus {
  border-color: #1d4ed8;
}

.textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.edit-buttons {
  display: flex;
  gap: 8px;
}

.save-btn, .cancel-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  transition: all 0.2s;
}

.save-btn {
  background: #10b981;
  color: white;
}

.save-btn:hover {
  background: #059669;
}

.cancel-btn {
  background: #6b7280;
  color: white;
}

.cancel-btn:hover {
  background: #4b5563;
}

.skills-section {
  margin-top: 8px;
}

.skills-section h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
}

.skills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.skill-tag {
  background: #e0e7ff;
  color: #3730a3;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.remove-skill {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b46c1;
  padding: 0;
  display: flex;
  align-items: center;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  justify-content: center;
}

.remove-skill:hover {
  background: rgba(107, 70, 193, 0.2);
}

.add-skill-input {
  padding: 6px 12px;
  border: 2px dashed #d1d5db;
  border-radius: 20px;
  outline: none;
  font-size: 14px;
  background: #f9fafb;
  transition: all 0.2s;
}

.add-skill-input:focus {
  border-color: #3b82f6;
  background: white;
}

.add-skill-input::placeholder {
  color: #9ca3af;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .user-card {
    padding: 20px;
    margin: 0;
    border-radius: 12px;
  }
  
  .user-card .user-avatar {
    width: 96px;
    height: 96px;
  }
  
  .user-header h1 {
    font-size: 20px;
  }
  
  .field-value {
    font-size: 14px;
  }
  
  .edit-input {
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .skills-container {
    gap: 6px;
  }
  
  .skill-tag {
    font-size: 13px;
    padding: 4px 10px;
  }
}

@media (max-width: 480px) {
  .user-card {
    padding: 16px;
  }
  
  .user-details {
    gap: 12px;
  }
  
  .field-content {
    gap: 8px;
  }
  
  .edit-buttons {
    flex-direction: column;
  }
  
  .save-btn, .cancel-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .user-card {
    background: #1f2937;
    border-color: #374151;
  }
  
  .user-header {
    border-bottom-color: #374151;
  }
  
  .user-header h1 {
    color: #e5e7eb;
  }
  
  .follow-stats-container {
    background: #374151;
    border-color: #4b5563;
  }
  
  .field-value {
    color: #e5e7eb;
  }
  
  .field-content svg {
    color: #9ca3af;
  }
  
  .edit-btn:hover {
    color: #60a5fa;
    background: #374151;
  }
  
  .edit-input {
    background: #374151;
    border-color: #60a5fa;
    color: #e5e7eb;
  }
  
  .edit-input:focus {
    border-color: #3b82f6;
  }
  
  .skill-tag {
    background: #1e40af;
    color: #ddd6fe;
  }
  
  .add-skill-input {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
  }
  
  .add-skill-input:focus {
    background: #374151;
    border-color: #60a5fa;
  }
  
  .add-skill-input::placeholder {
    color: #6b7280;
  }
  
  .skills-section h3 {
    color: #e5e7eb;
  }
}

/* Auth Prompt Styles */
.auth-prompt {
  padding: 24px 0;
}

.auth-prompt-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.auth-prompt-icon {
  color: #667eea;
  margin-bottom: 8px;
}

.auth-prompt-content h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
}

.auth-prompt-content p {
  margin: 0;
  color: #6b7280;
  line-height: 1.5;
  max-width: 280px;
}

.auth-prompt-buttons {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.auth-prompt-button {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.auth-prompt-button.login {
  background: #667eea;
  color: white;
}

.auth-prompt-button.login:hover {
  background: #5a67d8;
  transform: translateY(-1px);
}

.auth-prompt-button.register {
  background: #f8fafc;
  color: #667eea;
  border: 1px solid #e2e8f0;
}

.auth-prompt-button.register:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .auth-prompt-buttons {
    flex-direction: column;
    width: 100%;
  }
  
  .auth-prompt-button {
    width: 100%;
  }
}

/* Dark mode for auth prompt */
/* Загрузка и спиннер */
.user-card.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

.loading-content {
  text-align: center;
  color: var(--text-secondary);
}

.loading-content p {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.save-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@media (prefers-color-scheme: dark) {
  .auth-prompt-content h3 {
    color: #e5e7eb;
  }
  
  .auth-prompt-content p {
    color: #9ca3af;
  }
  
  .auth-prompt-button.register {
    background: #374151;
    color: #e5e7eb;
    border-color: #4b5563;
  }
  
  .auth-prompt-button.register:hover {
    background: #4b5563;
  }
}


.wallet-connect {
  background: var(--bg-primary);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.wallet-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  position: relative;
}

.wallet-icon {
  background: var(--gradient-primary);
  color: var(--text-inverse);
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wallet-title h3 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-indicator {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.mode-indicator.development {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.mode-indicator.production {
  background: rgba(72, 187, 120, 0.1);
  color: #48bb78;
  border: 1px solid rgba(72, 187, 120, 0.2);
}

.wallet-title p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.wallet-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 14px;
  margin-bottom: 16px;
}

.wallet-disconnected {
  text-align: center;
}

.wallet-benefits {
  margin-bottom: 20px;
}

.wallet-benefits ul {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
}

.wallet-benefits li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.wallet-benefits li::before {
  content: "✓";
  color: #10b981;
  font-weight: bold;
  flex-shrink: 0;
}

.connect-wallet-btn {
  width: 100%;
  padding: 12px 20px;
  background: var(--gradient-primary);
  color: var(--text-inverse);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.connect-wallet-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.connect-wallet-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.wallet-connected {
  /* Стили для подключенного состояния */
}

.wallet-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.status-icon.connected {
  color: #10b981;
}

.wallet-info {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.wallet-info > div {
  margin-bottom: 12px;
}

.wallet-info > div:last-child {
  margin-bottom: 0;
}

.wallet-info label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.wallet-info span {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.address-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.address {
  font-family: 'Monaco', 'Consolas', monospace;
  background: var(--bg-primary);
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-primary);
}

.address-actions {
  display: flex;
  gap: 4px;
}

.copy-btn,
.explorer-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copy-btn:hover,
.explorer-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.disconnect-wallet-btn {
  width: 100%;
  padding: 10px 20px;
  background: var(--bg-primary);
  color: #dc2626;
  border: 1px solid #dc2626;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.disconnect-wallet-btn:hover:not(:disabled) {
  background: #dc2626;
  color: white;
}

.disconnect-wallet-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Адаптивность */
@media (max-width: 768px) {
  .wallet-connect {
    padding: 16px;
  }
  
  .wallet-header {
    gap: 10px;
  }
  
  .wallet-icon {
    width: 40px;
    height: 40px;
  }
  
  .wallet-title h3 {
    font-size: 16px;
  }
  
  .address-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .address-actions {
    justify-content: center;
  }
}

/* Красивые стили для баланса */
.balance-display {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.balance-token {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.balance-amount {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
}

.balance-currency {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--accent-color);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* Специальные цвета для разных токенов */
.balance-token:nth-child(1) .balance-currency {
  background: #8b5cf6; /* Фиолетовый для MATIC */
}

.balance-token:nth-child(2) .balance-currency {
  background: #10b981; /* Зеленый для USDT */
}

.balance-token:nth-child(3) .balance-currency {
  background: #f59e0b; /* Оранжевый для других токенов */
}

/* Стили для переключения режимов кошелька */
.wallet-mode-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.wallet-mode-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: scale(1.05);
}

.wallet-mode-settings {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mode-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.mode-settings-header h4 {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary);
}

.current-mode {
  font-size: 12px;
  color: var(--text-secondary);
}

.mode-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 11px;
}

.mode-badge.development {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.mode-badge.production {
  background: rgba(72, 187, 120, 0.1);
  color: #48bb78;
  border: 1px solid rgba(72, 187, 120, 0.2);
}

.mode-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-option {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.mode-option:hover:not(.disabled) {
  border-color: var(--color-primary);
  background: var(--bg-tertiary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.mode-option.active {
  border-color: var(--color-primary);
  background: rgba(102, 126, 234, 0.05);
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.mode-option.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg-disabled);
}

.mode-option-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.mode-option-header span {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1 1;
}

.active-icon {
  color: var(--color-primary);
}

.mode-option-description {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-left: 26px;
}

.mode-error {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(245, 101, 101, 0.1);
  border: 1px solid rgba(245, 101, 101, 0.2);
  border-radius: 6px;
  font-size: 11px;
  color: #f56565;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.refresh-btn {
  background: #f56565;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 10px;
  transition: background 0.2s ease;
}

.refresh-btn:hover:not(:disabled) {
  background: #e53e3e;
}

.refresh-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hardhat-accounts-preview {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(72, 187, 120, 0.1);
  border: 1px solid rgba(72, 187, 120, 0.2);
  border-radius: 6px;
  font-size: 11px;
  color: #48bb78;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
  .wallet-mode-settings {
    padding: 12px;
  }
  
  .mode-settings-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .mode-option {
    padding: 12px;
  }
  
  .mode-option-description {
    margin-left: 0;
    margin-top: 6px;
  }
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
  .wallet-mode-btn {
    background: #2d3748;
    border-color: #4a5568;
    color: #a0aec0;
  }
  
  .wallet-mode-btn:hover {
    background: #4a5568;
    border-color: #667eea;
    color: #667eea;
  }
  
  .wallet-mode-settings {
    background: #2d3748;
    border-color: #4a5568;
  }
  
  .mode-option {
    background: #1a202c;
    border-color: #4a5568;
  }
  
  .mode-option:hover:not(.disabled) {
    background: #2d3748;
  }
  
  .mode-option.active {
    background: rgba(102, 126, 234, 0.1);
  }
  
  .mode-option.disabled {
    background: #2d3748;
    opacity: 0.5;
  }
}

/* ShippingAddressCard - унифицированные стили с ProfilePage */
.shipping-address-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
  max-width: 500px;
}

.shipping-address-card .user-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.shipping-address-card .user-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.shipping-address-card .user-field:last-child {
  border-bottom: none;
}

.shipping-address-card .field-content {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.shipping-address-card .field-content svg {
  color: var(--text-secondary);
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.shipping-address-card .field-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.shipping-address-card .field-value {
  flex: 1 1;
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
  word-break: break-word;
}

.shipping-address-card .field-value.placeholder {
  color: var(--text-secondary);
  font-style: italic;
  font-weight: 400;
}

.shipping-address-card .edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 4px;
  opacity: 0.7;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.shipping-address-card .edit-btn:hover {
  opacity: 1;
  color: var(--bg-accent);
  background: var(--bg-hover);
}

.shipping-address-card .edit-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.shipping-address-card .edit-input {
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  transition: all 0.2s ease;
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
}

.shipping-address-card .edit-input:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.shipping-address-card .edit-input::placeholder {
  color: var(--text-secondary);
}

.shipping-address-card .edit-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.shipping-address-card .save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background: var(--gradient-primary);
  color: var(--text-inverse);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 44px;
  min-height: 44px;
  font-weight: 600;
}

.shipping-address-card .save-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.shipping-address-card .save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.shipping-address-card .cancel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 44px;
  min-height: 44px;
  font-weight: 600;
}

.shipping-address-card .cancel-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.shipping-address-card .spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Мобильная адаптация - в соответствии с ProfilePage */
@media (max-width: 767px) {
  .shipping-address-card {
    padding: 16px;
    margin: 0 auto;
    border-radius: 12px;
  }
  
  .shipping-address-card .user-field {
    gap: 8px;
    min-height: 44px;
    padding: 8px 0;
  }
  
  .shipping-address-card .field-content {
    gap: 8px;
  }
  
  .shipping-address-card .field-display {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-height: auto;
  }
  
  .shipping-address-card .edit-btn {
    align-self: flex-start;
    min-width: 44px;
    min-height: 44px;
  }
  
  .shipping-address-card .edit-input {
    font-size: 16px;
    min-height: 44px;
  }
  
  .shipping-address-card .save-btn,
  .shipping-address-card .cancel-btn {
    min-width: 44px;
    min-height: 44px;
    font-size: 14px;
  }
  
  /* Удаляем hover эффекты на мобильных */
  .shipping-address-card .edit-btn:hover,
  .shipping-address-card .save-btn:hover,
  .shipping-address-card .cancel-btn:hover {
    transform: none;
    box-shadow: none;
    background: none;
    opacity: 0.7;
    color: var(--text-secondary);
  }
  
  /* Добавляем active состояния для touch */
  .shipping-address-card .edit-btn:active,
  .shipping-address-card .save-btn:active,
  .shipping-address-card .cancel-btn:active {
    transform: scale(0.98);
    opacity: 0.8;
  }
}

/* Планшетная адаптация */
@media (min-width: 768px) {
  .shipping-address-card {
    padding: 24px;
  }
  
  .shipping-address-card .user-field {
    min-height: 52px;
    padding: 12px 0;
  }
  
  .shipping-address-card .field-display {
    min-height: 44px;
  }
  
  .shipping-address-card .edit-buttons {
    gap: 12px;
  }
}

.language-selector {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  position: relative;
}

.language-selector-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  color: #333;
}

.language-selector-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.language-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.language-current:hover {
  background: #e9ecef;
  border-color: #6c757d;
}

.language-dropdown-arrow {
  transition: transform 0.2s ease;
  font-size: 12px;
  color: #6c757d;
}

.language-dropdown-arrow.open {
  transform: rotate(180deg);
}

.language-dropdown {
  position: absolute;
  top: 100%;
  left: 20px;
  right: 20px;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  overflow: hidden;
  margin-top: 4px;
}

.language-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 14px;
  color: #333;
}

.language-option:hover {
  background: #f8f9fa;
}

.language-option.active {
  background: #e3f2fd;
  color: #1976d2;
}

.language-option.active:hover {
  background: #bbdefb;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .language-selector {
    background: #2a2a2a;
    color: #fff;
  }
  
  .language-selector-header {
    color: #fff;
  }
  
  .language-current {
    background: #3a3a3a;
    border-color: #4a4a4a;
    color: #fff;
  }
  
  .language-current:hover {
    background: #4a4a4a;
    border-color: #5a5a5a;
  }
  
  .language-dropdown {
    background: #2a2a2a;
    border-color: #4a4a4a;
  }
  
  .language-option {
    color: #fff;
  }
  
  .language-option:hover {
    background: #3a3a3a;
  }
  
  .language-option.active {
    background: #1a3a5c;
    color: #90caf9;
  }
  
  .language-option.active:hover {
    background: #2a4a6c;
  }
}

/* Mobile First - базовые стили для мобильных устройств */
.challenge-page {
  width: 100%;
  background: #f9fafb;
  overflow-y: auto;
  padding: 0;
  margin: 0;
}

.challenge-page.loading,
.challenge-page.error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.loading-spinner {
  text-align: center;
  color: #6b7280;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error-content {
  text-align: center;
  padding: 24px;
}

.error-content h2 {
  color: #ef4444;
  margin-bottom: 12px;
}

.error-content p {
  color: #6b7280;
  margin-bottom: 24px;
}

/* Mobile First - Header */
.challenge-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 10;
}

.back-button,
.settings-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.back-button:hover,
.settings-button:hover {
  background: #e5e7eb;
  color: #374151;
}

.challenge-title-section {
  flex: 1 1;
  min-width: 0;
}

.challenge-main-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px 0;
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.2;
}

.challenge-emoji {
  font-size: 24px;
  flex-shrink: 0;
}

.challenge-streak-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.day-counter {
  font-size: 14px;
  font-weight: 600;
  color: #3b82f6;
}

.streak-indicator {
  font-size: 13px;
  color: #f59e0b;
  font-weight: 500;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.active {
  background: #ecfdf5;
  color: #065f46;
}

.status-badge.paused {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.completed {
  background: #dbeafe;
  color: #1e40af;
}

/* Mobile First - Content */
.challenge-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 20px;
}

/* Блоки */
/* Mobile First - Блоки */
.ai-suggestion-block,
.today-progress-block,
.history-charts-block,
.quick-actions-block,
.challenge-settings-block,
.ai-insights-block {
  background: white;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-suggestion-block h3,
.today-progress-block h3,
.history-charts-block h3,
.quick-actions-block h3,
.challenge-settings-block h3,
.ai-insights-block h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

/* AI Suggestion Block */
.ai-suggestion-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.ai-suggestion-header svg {
  color: #3b82f6;
}

.ai-suggestion-content {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.ai-suggestion-content p {
  margin: 0 0 12px 0;
  color: #1e40af;
  font-size: 14px;
  line-height: 1.4;
}

.ai-actions {
  display: flex;
  gap: 8px;
}

.btn-ai-action {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  background: white;
  color: #1e40af;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ai-action:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.ai-chat-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-chat-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Today Progress Block */
.circular-progress {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  position: relative;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-background {
  fill: transparent;
  stroke: #e5e7eb;
  stroke-width: 8;
}

.progress-ring-progress {
  fill: transparent;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.progress-percent {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
}

.progress-label {
  display: block;
  font-size: 12px;
  color: #6b7280;
}

.daily-tasks h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.task-item.completed {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.task-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}

.task-item.completed .task-checkbox {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

.task-item span {
  flex: 1 1;
  font-size: 14px;
  color: #374151;
}

.task-action-btn {
  padding: 4px 8px;
  border: 1px solid #3b82f6;
  border-radius: 4px;
  background: white;
  color: #3b82f6;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.task-action-btn:hover {
  background: #3b82f6;
  color: white;
}

.task-completed {
  font-size: 14px;
  color: #10b981;
  font-weight: 500;
}

/* Форма чекина */
.checkin-form {
  margin-top: 12px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.checkin-note {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  margin-bottom: 12px;
}

.checkin-note:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.checkin-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.checkin-submit-btn {
  padding: 8px 16px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.checkin-submit-btn:hover:not(:disabled) {
  background: #2563eb;
}

.checkin-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.checkin-cancel-btn {
  padding: 8px 16px;
  background: transparent;
  color: #6b7280;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.checkin-cancel-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

/* History Charts Block */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-gap: 16px;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-item {
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
}

.chart-item h4 {
  margin: 0 0 12px 0;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.week-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.week-bars {
  display: flex;
  gap: 4px;
  height: 60px;
  align-items: end;
}

.day-bar {
  flex: 1 1;
  min-height: 4px;
  border-radius: 2px;
  transition: all 0.2s ease;
}

.day-bar.success {
  background: #10b981;
}

.day-bar.fail {
  background: #ef4444;
  height: 20% !important;
}

.week-labels {
  display: flex;
  gap: 4px;
}

.week-labels span {
  flex: 1 1;
  text-align: center;
  font-size: 10px;
  color: #6b7280;
}

.craving-timeline {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
}

.timeline-hours {
  display: flex;
  width: 100%;
  justify-content: space-between;
}

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

.hour-intensity {
  width: 8px;
  height: 32px;
  border-radius: 4px;
}

.hour-intensity.low {
  background: #d1fae5;
}

.hour-intensity.medium {
  background: #fbbf24;
}

.hour-intensity.high {
  background: #f87171;
}

.hour-marker span {
  font-size: 10px;
  color: #6b7280;
}

.success-interventions h4 {
  margin: 0 0 12px 0;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.intervention-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.intervention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #f0fdf4;
  border-radius: 6px;
  margin-bottom: 4px;
}

.intervention-emoji {
  font-size: 14px;
  flex-shrink: 0;
}

.intervention-name {
  flex: 1 1;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
}

.success-rate {
  font-size: 11px;
  font-weight: 600;
  color: #10b981;
  background: #dcfce7;
  padding: 2px 6px;
  border-radius: 10px;
}

.intervention-descriptions {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.intervention-description {
  font-size: 10px;
  color: #6b7280;
  margin: 4px 0;
  line-height: 1.3;
}

.intervention-description strong {
  color: #374151;
}

/* Quick Actions Block */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 12px;
  gap: 12px;
}

.action-card {
  /* Сброс дефолтных стилей кнопки */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none;
  margin: 0;
  padding: 0;
  background: none;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  
  /* Наши стили */
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 2px !important;
  padding: 8px 6px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 6px !important;
  background: white !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  text-align: center !important;
  min-height: 70px !important;
  max-height: 70px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.action-card:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.action-card:active {
  transform: translateY(0);
  transition: transform 0.1s ease;
}

/* Цветовые схемы для действий */
.action-card.emergency,
.action-card.red {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%) !important;
  border-color: #fca5a5 !important;
}

.action-card.green {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
  border-color: #bbf7d0 !important;
}

.action-card.blue {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
  border-color: #93c5fd !important;
}

.action-card.purple {
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%) !important;
  border-color: #c4b5fd !important;
}

.action-card.gold {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
  border-color: #fde68a !important;
}

.action-emoji {
  font-size: 18px !important;
  margin-bottom: 2px !important;
  line-height: 1 !important;
  display: block !important;
}

.action-title {
  font-size: 10px !important;
  font-weight: 600 !important;
  color: #374151 !important;
  line-height: 1.1 !important;
  margin-bottom: 1px !important;
  display: block !important;
}

.action-description {
  font-size: 8px !important;
  color: #6b7280 !important;
  line-height: 1.1 !important;
  display: block !important;
  opacity: 0.8 !important;
}

.action-card.emergency .action-title,
.action-card.red .action-title {
  color: #dc2626 !important;
}

.action-card.green .action-title {
  color: #059669 !important;
}

.action-card.blue .action-title {
  color: #1d4ed8 !important;
}

.action-card.purple .action-title {
  color: #7c3aed !important;
}

.action-card.gold .action-title {
  color: #d97706 !important;
}

/* Settings Block */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.setting-item:hover {
  background: #f3f4f6;
}

.setting-item.danger {
  color: #dc2626;
}

.setting-item.danger:hover {
  background: #fef2f2;
}

.setting-item svg {
  color: #6b7280;
  flex-shrink: 0;
}

.setting-item.danger svg {
  color: #dc2626;
}

.setting-item span {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.setting-item.danger span {
  color: #dc2626;
}





/* Common styles */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Tablet - увеличиваем размеры с 481px */
@media (min-width: 481px) {
  .challenge-header {
    padding: 16px;
    gap: 12px;
  }

  .challenge-main-title {
    font-size: 18px;
    gap: 8px;
    margin-bottom: 8px;
  }

  .challenge-content {
    padding: 16px;
    gap: 16px;
  }

  .ai-suggestion-block,
  .today-progress-block,
  .history-charts-block,
  .quick-actions-block,
  .challenge-settings-block,
  .ai-insights-block {
    padding: 16px;
    border-radius: 12px;
  }

  .charts-grid {
    grid-template-columns: 1fr 1fr;
  }

  .action-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  .action-card {
    min-height: 80px !important;
    max-height: 80px !important;
    padding: 10px 8px !important;
  }

  .action-emoji {
    font-size: 20px !important;
    margin-bottom: 3px !important;
  }

  .action-title {
    font-size: 11px !important;
    margin-bottom: 2px !important;
  }

  .action-description {
    font-size: 9px !important;
  }
}

/* Desktop - 768px и выше */
@media (min-width: 768px) {
  .challenge-header {
    padding: 20px;
  }

  .challenge-main-title {
    font-size: 24px;
  }

  .challenge-content {
    padding: 20px;
    gap: 20px;
  }

  .ai-suggestion-block,
  .today-progress-block,
  .history-charts-block,
  .quick-actions-block,
  .challenge-settings-block,
  .ai-insights-block {
    padding: 20px;
  }

  .action-grid {
    gap: 20px;
  }

  .action-card {
    min-height: 90px !important;
    max-height: 90px !important;
    padding: 12px 10px !important;
  }

  .action-emoji {
    font-size: 22px !important;
    margin-bottom: 4px !important;
  }

  .action-title {
    font-size: 12px !important;
    margin-bottom: 2px !important;
  }

  .action-description {
    font-size: 10px !important;
  }
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
  .challenge-page {
    background: #111827;
  }

  .challenge-header {
    background: #1f2937;
    border-bottom-color: #374151;
  }

  .challenge-main-title {
    color: #e5e7eb;
  }

  .day-counter {
    color: #60a5fa;
  }

  .streak-indicator {
    color: #fbbf24;
  }

  .status-badge.active {
    background: #065f46;
    color: #d1fae5;
  }

  .status-badge.paused {
    background: #92400e;
    color: #fef3c7;
  }

  .status-badge.completed {
    background: #1e40af;
    color: #dbeafe;
  }

  .ai-suggestion-block,
  .today-progress-block,
  .history-charts-block,
  .quick-actions-block,
  .challenge-settings-block,
  .ai-insights-block {
    background: #1f2937;
    border-color: #374151;
  }

  .ai-suggestion-block h3,
  .today-progress-block h3,
  .history-charts-block h3,
  .quick-actions-block h3,
  .challenge-settings-block h3,
  .ai-insights-block h3 {
    color: #e5e7eb;
  }

  .progress-percent {
    color: #e5e7eb;
  }

  .progress-label,
  .chart-item h4,
  .success-interventions h4 {
    color: #9ca3af;
  }

  .task-item {
    background: #374151;
    border-color: #4b5563;
  }

  .task-item span {
    color: #d1d5db;
  }

  .task-completed {
    color: #34d399;
  }

  .checkin-form {
    background: #1f2937;
    border-color: #374151;
  }

  .checkin-note {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
  }

  .checkin-note:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  }

  .checkin-cancel-btn {
    color: #9ca3af;
    border-color: #4b5563;
  }

  .checkin-cancel-btn:hover {
    background: #374151;
    border-color: #6b7280;
  }

  .chart-item {
    background: #374151;
  }

  .action-card {
    background: #374151 !important;
    border-color: #4b5563 !important;
  }

  .action-title {
    color: #d1d5db !important;
  }

  .action-description {
    color: #9ca3af !important;
  }

  /* Цветовые схемы для темной темы */
  .action-card.emergency,
  .action-card.red {
    background: #7f1d1d !important;
    border-color: #991b1b !important;
  }

  .action-card.green {
    background: #064e3b !important;
    border-color: #065f46 !important;
  }

  .action-card.blue {
    background: #1e3a8a !important;
    border-color: #1e40af !important;
  }

  .action-card.purple {
    background: #581c87 !important;
    border-color: #6b21a8 !important;
  }

  .action-card.gold {
    background: #92400e !important;
    border-color: #b45309 !important;
  }

  .action-card.emergency .action-title,
  .action-card.red .action-title {
    color: #fecaca !important;
  }

  .action-card.green .action-title {
    color: #a7f3d0 !important;
  }

  .action-card.blue .action-title {
    color: #dbeafe !important;
  }

  .action-card.purple .action-title {
    color: #e9d5ff !important;
  }

  .action-card.gold .action-title {
    color: #fde68a !important;
  }

  .setting-item span {
    color: #d1d5db;
  }

  .setting-item svg {
    color: #9ca3af;
  }

  .back-button,
  .settings-button {
    background: #374151;
    color: #9ca3af;
  }

  .back-button:hover,
  .settings-button:hover {
    background: #4b5563;
    color: #d1d5db;
  }
}

/* Mobile First - AI Insights Component */
.ai-insights-block {
  background: white;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-insights-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  position: relative;
}

.ai-insights-header svg {
  color: #3b82f6;
  flex-shrink: 0;
}

.ai-insights-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  flex: 1 1;
}

.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.refresh-btn:hover {
  background: #e5e7eb;
  color: #374151;
  transform: rotate(90deg);
}

/* Agent Info */
.agent-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  margin-bottom: 12px;
}

.agent-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.agent-emoji {
  font-size: 16px;
}

.agent-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agent-name {
  font-size: 11px;
  font-weight: 600;
  color: #1e40af;
}

.agent-personality {
  font-size: 10px;
  color: #1e40af;
  opacity: 0.8;
}

.last-updated {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: #6b7280;
}

/* Loading State */
.ai-insights-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  justify-content: center;
  color: #6b7280;
}

.loading-spinner-small {
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Error State */
.ai-insights-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  color: #ef4444;
  text-align: center;
}

.retry-btn {
  padding: 6px 12px;
  border: 1px solid #ef4444;
  border-radius: 6px;
  background: white;
  color: #ef4444;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.retry-btn:hover {
  background: #ef4444;
  color: white;
}

/* Insights List */
.insights-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.insight-item {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.insight-item.success {
  background: #f0fdf4;
  border-color: #a7f3d0;
}

.insight-item.warning {
  background: #fefce8;
  border-color: #fde68a;
}

.insight-item.info {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.insight-item.tip {
  background: #faf5ff;
  border-color: #ddd6fe;
}

.insight-item.motivation {
  background: #fef2f2;
  border-color: #fecaca;
}

.insight-item.celebration {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
}

.insight-header {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  flex-shrink: 0;
  margin-top: 2px;
}

.insight-emoji {
  font-size: 14px;
}

.insight-icon {
  flex-shrink: 0;
}

.insight-icon.success {
  color: #10b981;
}

.insight-icon.warning {
  color: #f59e0b;
}

.insight-icon.info {
  color: #3b82f6;
}

.insight-icon.tip {
  color: #8b5cf6;
}

.insight-icon.motivation {
  color: #ef4444;
}

.insight-icon.celebration {
  color: #f59e0b;
}

.insight-content {
  flex: 1 1;
  min-width: 0;
}

.insight-text {
  margin: 0 0 6px 0;
  font-size: 12px;
  line-height: 1.4;
  color: #374151;
}

.insight-action-btn {
  padding: 4px 8px;
  border: 1px solid #3b82f6;
  border-radius: 4px;
  background: white;
  color: #3b82f6;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.insight-action-btn:hover {
  background: #3b82f6;
  color: white;
}

/* Tips Section */
.tips-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.tips-section h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

.tips-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tip-item {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  background: #f9fafb;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.tip-emoji {
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
}

.tip-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1;
}

.tip-text {
  font-size: 11px;
  color: #374151;
  line-height: 1.3;
}

.tip-timing {
  font-size: 10px;
  color: #6b7280;
  font-style: italic;
}

/* No Insights State */
.no-insights {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
}

.no-insights-icon {
  color: #d1d5db;
}

.no-insights p {
  margin: 0;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

/* Tablet - 481px+ */
@media (min-width: 481px) {
  .ai-insights-block {
    padding: 16px;
    border-radius: 12px;
  }

  .ai-insights-header h3 {
    font-size: 16px;
  }

  .agent-name {
    font-size: 12px;
  }

  .agent-personality {
    font-size: 11px;
  }

  .insight-text {
    font-size: 13px;
  }

  .tip-text {
    font-size: 12px;
  }

  .tips-section h4 {
    font-size: 13px;
  }

  .insight-action-btn {
    font-size: 11px;
    padding: 5px 10px;
  }

  .no-insights p {
    font-size: 13px;
  }
}

/* Desktop - 768px+ */
@media (min-width: 768px) {
  .ai-insights-block {
    padding: 20px;
  }

  .ai-insights-header h3 {
    font-size: 18px;
  }

  .insights-list {
    gap: 10px;
  }

  .insight-item {
    padding: 12px;
  }

  .insight-text {
    font-size: 14px;
  }

  .tip-text {
    font-size: 13px;
  }

  .tips-section h4 {
    font-size: 14px;
  }

  .agent-name {
    font-size: 13px;
  }

  .agent-personality {
    font-size: 12px;
  }
}

/* Dark Theme */
@media (prefers-color-scheme: dark) {
  .ai-insights-block {
    background: #1f2937;
    border-color: #374151;
  }

  .ai-insights-header h3 {
    color: #e5e7eb;
  }

  .refresh-btn {
    background: #374151;
    color: #9ca3af;
  }

  .refresh-btn:hover {
    background: #4b5563;
    color: #d1d5db;
  }

  .agent-info {
    background: #1e3a8a;
    border-color: #1e40af;
  }

  .agent-name,
  .agent-personality {
    color: #dbeafe;
  }

  .last-updated {
    color: #9ca3af;
  }

  .insight-item.success {
    background: #064e3b;
    border-color: #065f46;
  }

  .insight-item.warning {
    background: #92400e;
    border-color: #b45309;
  }

  .insight-item.info {
    background: #1e3a8a;
    border-color: #1e40af;
  }

  .insight-item.tip {
    background: #581c87;
    border-color: #6b21a8;
  }

  .insight-item.motivation {
    background: #7f1d1d;
    border-color: #991b1b;
  }

  .insight-item.celebration {
    background: #92400e;
    border-color: #b45309;
  }

  .insight-text {
    color: #d1d5db;
  }

  .tip-item {
    background: #374151;
    border-color: #4b5563;
  }

  .tip-text {
    color: #d1d5db;
  }

  .tip-timing {
    color: #9ca3af;
  }

  .tips-section h4 {
    color: #d1d5db;
  }

  .no-insights-icon {
    color: #6b7280;
  }

  .no-insights p {
    color: #9ca3af;
  }

  .insight-action-btn {
    background: #374151;
    border-color: #60a5fa;
    color: #60a5fa;
  }

  .insight-action-btn:hover {
    background: #60a5fa;
    color: #1f2937;
  }

  .retry-btn {
    background: #374151;
    border-color: #f87171;
    color: #f87171;
  }

  .retry-btn:hover {
    background: #f87171;
    color: #1f2937;
  }
}

/* ChallengeAnalytics.css */

.analytics-section {
  background: #ffffff;
  background: var(--card-background, #ffffff);
  border-radius: 16px;
  padding: 24px;
  margin: 16px 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
  border: 1px solid var(--border-color, #e5e7eb);
}

.analytics-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.analytics-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  color: var(--text-primary, #1f2937);
}

.analytics-header svg {
  color: #3b82f6;
  color: var(--primary-color, #3b82f6);
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-gap: 20px;
  gap: 20px;
}

/* Analytics Cards */
.analytics-card {
  background: #f8fafc;
  background: var(--card-secondary-background, #f8fafc);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  border: 1px solid var(--border-light, #e2e8f0);
  transition: all 0.2s ease;
}

.analytics-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.card-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  color: var(--text-primary, #1f2937);
}

.card-header svg {
  color: #3b82f6;
  color: var(--primary-color, #3b82f6);
}

/* Weekly Streak Chart */
.streak-card {
  grid-column: span 1;
}

.week-chart {
  margin-bottom: 16px;
}

.week-bars {
  display: flex;
  justify-content: space-between;
  align-items: end;
  height: 120px;
  padding: 0 8px;
  margin-bottom: 8px;
}

.day-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1 1;
}

.day-bar {
  width: 24px;
  min-height: 8px;
  border-radius: 4px 4px 0 0;
  transition: all 0.3s ease;
  cursor: pointer;
}

.day-bar.success {
  background: linear-gradient(to top, #10b981, #34d399);
}

.day-bar.fail {
  background: linear-gradient(to top, #ef4444, #f87171);
  opacity: 0.6;
}

.day-bar:hover {
  transform: scale(1.1);
}

.day-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  color: var(--text-secondary, #6b7280);
}

.streak-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #ffffff;
  background: var(--card-background, #ffffff);
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  border: 1px solid var(--border-light, #e2e8f0);
}

.streak-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.challenge-analytics .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #10b981;
  color: var(--success-color, #10b981);
}

.challenge-analytics .stat-label {
  font-size: 0.75rem;
  color: #6b7280;
  color: var(--text-secondary, #6b7280);
}

.streak-percentage {
  font-size: 0.875rem;
  font-weight: 600;
  color: #3b82f6;
  color: var(--primary-color, #3b82f6);
  padding: 4px 12px;
  background: #dbeafe;
  background: var(--primary-light, #dbeafe);
  border-radius: 12px;
}

/* Craving Timeline */
.craving-card {
  grid-column: span 1;
}

.timeline-container {
  display: flex;
  justify-content: space-between;
  align-items: end;
  height: 100px;
  margin-bottom: 16px;
  padding: 0 8px;
}

.time-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1 1;
}

.intensity-bar {
  width: 16px;
  height: 80px;
  background: #f1f5f9;
  background: var(--background-secondary, #f1f5f9);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.intensity-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 8px;
  transition: height 0.3s ease;
}

.intensity-bar.high .intensity-fill {
  height: 80%;
  background: linear-gradient(to top, #ef4444, #f87171);
}

.intensity-bar.medium .intensity-fill {
  height: 50%;
  background: linear-gradient(to top, #f59e0b, #fbbf24);
}

.intensity-bar.low .intensity-fill {
  height: 25%;
  background: linear-gradient(to top, #10b981, #34d399);
}

.time-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  color: var(--text-secondary, #6b7280);
}

.craving-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #6b7280;
  color: var(--text-secondary, #6b7280);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.legend-color.high {
  background: #ef4444;
}

.legend-color.medium {
  background: #f59e0b;
}

.legend-color.low {
  background: #10b981;
}

/* Success Interventions */
.interventions-card {
  grid-column: span 1;
}

.interventions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.intervention-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #ffffff;
  background: var(--card-background, #ffffff);
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  border: 1px solid var(--border-light, #e2e8f0);
}

.intervention-info {
  flex: 1 1;
  margin-right: 16px;
}

.intervention-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1f2937;
  color: var(--text-primary, #1f2937);
  margin-bottom: 4px;
}

.success-bar {
  width: 100%;
  height: 4px;
  background: #f1f5f9;
  background: var(--background-secondary, #f1f5f9);
  border-radius: 2px;
  overflow: hidden;
}

.success-fill {
  height: 100%;
  background: linear-gradient(to right, #10b981, #34d399);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.success-rate {
  font-size: 0.875rem;
  font-weight: 600;
  color: #10b981;
  color: var(--success-color, #10b981);
}

/* Recent Activity */
.activity-card {
  grid-column: span 1;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #ffffff;
  background: var(--card-background, #ffffff);
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  border: 1px solid var(--border-light, #e2e8f0);
}

.activity-date {
  font-size: 0.75rem;
  color: #6b7280;
  color: var(--text-secondary, #6b7280);
}

.activity-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.activity-type {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1f2937;
  color: var(--text-primary, #1f2937);
}

.activity-day {
  font-size: 0.75rem;
  color: #6b7280;
  color: var(--text-secondary, #6b7280);
}

.no-activity {
  text-align: center;
  padding: 20px;
  color: #6b7280;
  color: var(--text-secondary, #6b7280);
}

/* Loading States */
.analytics-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
}

.analytics-error {
  text-align: center;
  padding: 40px;
  color: #6b7280;
  color: var(--text-secondary, #6b7280);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border: 3px solid var(--border-light, #e2e8f0);
  border-top: 3px solid #3b82f6;
  border-top: 3px solid var(--primary-color, #3b82f6);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .analytics-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .analytics-section {
    padding: 16px;
    margin: 12px 0;
  }
  
  .week-bars {
    height: 80px;
    padding: 0 4px;
  }
  
  .day-bar {
    width: 20px;
  }
  
  .timeline-container {
    height: 60px;
    padding: 0 4px;
  }
  
  .intensity-bar {
    width: 12px;
    height: 50px;
  }
  
  .craving-legend {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .analytics-section {
    --card-background: #1f2937;
    --card-secondary-background: #374151;
    --border-color: #4b5563;
    --border-light: #6b7280;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --background-secondary: #4b5563;
    --primary-light: #1e40af;
  }
}

/* Protocol Card - extracted from SupplementsPage.css */

.protocol-card {
  background: var(--bg-primary);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  border-top: 4px solid var(--bg-accent);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  overflow: hidden;
  position: relative;
}

.protocol-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.protocol-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
}

.protocol-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1 1;
}

.protocol-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.title-text {
  flex: 1 1;
  min-width: 0;
}

.protocol-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.protocol-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.protocol-price {
  text-align: right;
  flex-shrink: 0;
}

.price-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--bg-accent);
  margin: 0 0 2px 0;
  line-height: 1;
}

.price-duration {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin: 0;
  line-height: 1;
}

.protocol-body {
  padding: 20px;
}

.protocol-description {
  margin-bottom: 16px;
}

.protocol-description p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.protocol-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.target-tag {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  text-transform: capitalize;
}

.target-tag.more {
  background: var(--bg-accent-light);
  color: var(--bg-accent);
  border-color: var(--bg-accent);
}

.protocol-benefits {
  margin-bottom: 0;
}

.protocol-benefits h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.protocol-benefits ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.protocol-benefits li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 2px 0;
  position: relative;
  padding-left: 12px;
  line-height: 1.4;
}

.protocol-benefits li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--bg-accent);
  font-weight: 600;
  font-size: 0.8rem;
}

.protocol-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border-color);
}

.btn-details,
.btn-add-cart,
.btn-remove-cart {
  flex: 1 1;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  border: none;
}

.btn-details {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-details:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-add-cart {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-add-cart:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-add-cart:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-remove-cart {
  background: var(--bg-tertiary);
  color: var(--text-error);
  border: 1px solid var(--border-error);
}

.btn-remove-cart:hover:not(:disabled) {
  background: var(--bg-error-light);
  color: var(--text-error);
}

.btn-remove-cart:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 768px) {
  .protocol-card {
    border-radius: 12px;
  }

  .protocol-header {
    padding: 16px 16px 12px;
  }

  .protocol-body {
    padding: 16px;
  }

  .protocol-actions {
    padding: 12px 16px 16px;
    flex-direction: column;
  }

  .btn-details,
  .btn-add-cart,
  .btn-remove-cart {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .protocol-name {
    font-size: 1rem;
  }

  .protocol-subtitle {
    font-size: 0.85rem;
  }

  .price-value {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .protocol-header {
    flex-direction: column;
    gap: 12px;
  }

  .protocol-price {
    text-align: left;
    align-self: flex-start;
  }

  .protocol-title {
    width: 100%;
  }
}

/* Cart Summary - enhanced with detailed cart view */

.cart-summary {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  min-width: 300px;
  max-width: 420px;
  max-height: 85vh;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
  display: flex;
  flex-direction: column;
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.cart-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  flex: 1 1;
}

.total-price {
  font-weight: bold;
  margin-left: auto;
}

.cart-toggle {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.cart-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.cart-details {
  flex: 1 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  overflow: hidden;
}

/* Стилизация скроллбара для списка товаров */
.cart-items::-webkit-scrollbar {
  width: 6px;
}

.cart-items::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  flex: 1 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.cart-item {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-item-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.cart-item-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1 1;
}

.cart-item-emoji {
  font-size: 24px;
  flex-shrink: 0;
}

.cart-item-details h4 {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 600;
}

.cart-item-details p {
  margin: 0 0 4px 0;
  font-size: 12px;
  opacity: 0.8;
}

.cart-item-price {
  font-size: 12px;
  opacity: 0.7;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 2px;
}

.quantity-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.quantity-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.quantity-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quantity {
  font-size: 14px;
  font-weight: 500;
  min-width: 20px;
  text-align: center;
  padding: 0 4px;
}

.remove-btn {
  background: none;
  border: none;
  color: #ff6b6b;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-btn:hover:not(:disabled) {
  background: rgba(255, 107, 107, 0.2);
  transform: scale(1.1);
}

.remove-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cart-item-total {
  font-weight: bold;
  font-size: 16px;
  text-align: right;
  color: #4ECDC4;
}

.cart-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.btn-clear-cart {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.3);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-clear-cart:hover:not(:disabled) {
  background: rgba(255, 107, 107, 0.3);
  transform: translateY(-1px);
}

.btn-clear-cart:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-checkout {
  width: 100%;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 14px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s ease;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  flex-shrink: 0;
  margin-top: auto;
}

.btn-checkout:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-checkout:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

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

/* Mobile responsive */
@media (max-width: 768px) {
  .cart-summary {
    bottom: 15px;
    right: 15px;
    left: 15px;
    min-width: auto;
    max-width: none;
  }

  .cart-item-header {
    flex-direction: column;
    gap: 8px;
  }

  .cart-item-info {
    flex-direction: column;
    gap: 8px;
  }

  .cart-item-controls {
    align-self: flex-end;
  }
}
/* Checkout Modal - extracted from SupplementsPage.css */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.checkout-modal {
  background: var(--bg-primary);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 30px 16px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 30px 30px;
}

/* Многошаговый процесс оформления заказа */
.checkout-steps {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1 1;
  max-width: 120px;
  position: relative;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 15px;
  left: 60%;
  right: -40%;
  height: 2px;
  background: var(--border-color);
  z-index: 1;
}

.step.completed:not(:last-child)::after {
  background: var(--bg-accent);
}

.step-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
}

.step.active .step-number {
  background: var(--bg-accent);
  color: white;
}

.step.completed .step-number {
  background: var(--bg-accent);
  color: white;
}

.step-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.step.active .step-label {
  color: var(--bg-accent);
}

/* Order Summary */
.order-summary {
  margin-bottom: 24px;
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
}

.order-summary h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.order-items {
  margin-bottom: 16px;
}

.order-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  grid-gap: 20px;
  gap: 20px;
}

.order-item:last-child {
  border-bottom: none;
}

.item-details {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.item-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.item-emoji {
  font-size: 24px;
  flex-shrink: 0;
}

.item-name {
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
  line-height: 1.3;
}

.item-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.item-right-group {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-self: end;
}

.item-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 4px;
}

.quantity-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.quantity-btn:hover:not(:disabled) {
  background: var(--border-color);
}

.quantity-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quantity {
  font-weight: 600;
  min-width: 24px;
  text-align: center;
  padding: 0 8px;
  color: var(--text-primary);
}

.item-pricing {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 100px;
}

.item-unit-price {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.2;
}

.item-total-price {
  font-weight: 700;
  color: var(--bg-accent);
  font-size: 1.1rem;
  line-height: 1.2;
}

.remove-item-btn {
  background: none;
  border: none;
  color: #ff6b6b;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0.7;
}

.remove-item-btn:hover:not(:disabled) {
  background: rgba(255, 107, 107, 0.1);
  opacity: 1;
  transform: scale(1.1);
}

.remove-item-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.order-total {
  text-align: right;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.order-total strong {
  font-size: 1.2rem;
  color: var(--text-primary);
}

/* Shipping Section */
.shipping-section {
  margin-bottom: 24px;
}

.shipping-section h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.address-display {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
}

.address-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.address-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.address-field strong {
  color: var(--text-primary);
}

.address-field span {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.address-field.notes {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.edit-address-btn,
.add-address-btn {
  margin-top: 12px;
  padding: 8px 16px;
  background: var(--bg-accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.edit-address-btn:hover,
.add-address-btn:hover {
  background: var(--bg-accent-dark);
}

.no-address {
  text-align: center;
  color: var(--text-secondary);
}

/* Payment Section */
.payment-section {
  margin: 20px 0;
}

.order-progress {
  margin: 20px 0;
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  transition: width 0.3s ease;
}

.current-order-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin: 20px 0;
  text-align: center;
}

.current-order-info h4 {
  margin: 0 0 8px 0;
  color: var(--text-primary);
}

.current-order-info p {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--bg-accent);
}

.payment-methods {
  margin: 20px 0;
}

.payment-methods h4 {
  margin-bottom: 16px;
  color: var(--text-primary);
}

.payment-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payment-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.payment-option:hover {
  border-color: var(--bg-accent);
  background: var(--bg-hover);
}

.payment-option.active {
  border-color: var(--bg-accent);
  background: var(--bg-accent-light);
}

.payment-option span:first-of-type {
  margin-left: 12px;
  font-weight: 600;
  flex: 1 1;
}

.payment-desc {
  font-size: 12px;
  color: var(--text-secondary) !important;
  margin-left: 4px !important;
  flex: none !important;
}

/* Processing Section */
.processing-section {
  text-align: center;
  padding: 40px 20px;
}

.processing-animation {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.success-icon {
  color: #10b981;
  animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.processing-animation h3 {
  margin: 0;
  color: var(--text-primary);
}

.processing-animation p {
  margin: 0;
  color: var(--text-secondary);
}

/* Checkout Actions */
.checkout-actions {
  display: flex;
  gap: 15px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  margin-top: 20px;
}

.btn-cancel {
  flex: 1 1;
  padding: 14px 20px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-cancel:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-order {
  flex: 2 1;
  padding: 14px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-order:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-order:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Desktop улучшения для многошагового процесса */
@media (min-width: 768px) {
  .payment-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 16px;
    gap: 16px;
  }

  .checkout-steps {
    padding: 30px 0;
  }

  .step {
    max-width: 150px;
  }

  .checkout-modal {
    max-width: 600px;
  }
}

/* Mobile responsive for checkout */
@media (max-width: 768px) {
  .checkout-modal {
    margin: 10px;
    max-height: 95vh;
  }
  
  .checkout-actions {
    flex-direction: column;
  }
  
  .btn-cancel, .btn-order {
    flex: none;
  }

  .modal-body {
    padding: 16px 20px 24px;
  }

  .modal-header {
    padding: 20px 20px 12px;
  }
}

/* Supplements Page - адаптированный под тему приложения */
.supplements-page {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-secondary);
  width: 100%;
  overflow-x: hidden;
}

.page-header {
  text-align: center;
  margin-bottom: 40px;
  color: var(--text-primary);
  padding: 30px 20px;
  background: var(--bg-primary);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.demo-notice p {
  color: var(--text-tertiary);
  font-style: italic;
}

/* Cache status indicators */
.cache-status {
  margin-top: 15px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.cache-indicator {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-right: 8px;
}

.cache-indicator.offline {
  background: #FF6B6B;
  color: white;
}

.cache-indicator.refreshing {
  background: #4ECDC4;
  color: white;
  animation: pulse 2s infinite;
}

.cache-indicator.stale {
  background: #FFD93D;
  color: #8B4513;
}

.cache-indicator.fresh {
  background: #A8E6CF;
  color: #2E7D32;
}

.demo-notice {
  margin-top: 10px;
  padding: 10px;
  border-radius: 6px;
  background: rgba(78, 205, 196, 0.1);
  border: 1px solid rgba(78, 205, 196, 0.3);
}

.retry-btn:hover {
  background: #3BB5A8 !important;
  transform: translateY(-1px);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Cart Summary */
.cart-summary {
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.cart-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 600;
}

.cart-total {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--bg-accent);
}

.btn-checkout {
  background: var(--gradient-primary);
  color: var(--text-inverse);
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
}

.btn-checkout:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-checkout:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Protocols Grid */
.protocols-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  grid-gap: 30px;
  gap: 30px;
  margin-bottom: 40px;
  width: 100%;
}

/* Protocol Cards */
.protocol-card {
  background: var(--bg-primary);
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.protocol-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 60px rgba(102, 126, 234, 0.15);
  border-color: var(--border-accent);
}

.protocol-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.protocol-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1;
}

.protocol-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  flex-shrink: 0;
}

.title-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1;
}

.protocol-name {
  color: var(--text-primary);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.protocol-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
  font-style: italic;
  line-height: 1.2;
}

.protocol-price {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.price-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--bg-accent);
  margin: 0;
  line-height: 1;
}

.price-duration {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin: 0;
  line-height: 1;
}

.protocol-description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Benefits Section */
.benefits-section h4 {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.benefits-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}

.benefit-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.benefit-item svg {
  color: #10b981;
  flex-shrink: 0;
}

/* Timing Info */
.timing-info {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 15px;
}

.timing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
}

.symptoms {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Action Buttons */
.protocol-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn-details, .btn-add-cart, .btn-remove-cart {
  flex: 1 1;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.btn-details {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-details:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.btn-add-cart {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  position: relative;
}

.btn-add-cart::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s;
}

.btn-add-cart:hover::before {
  left: 100%;
}

.btn-add-cart:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-remove-cart {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-remove-cart:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

/* Modal Actions */
.modal-actions {
  padding: 20px 0 0 0;
  border-top: 1px solid var(--border-color);
  margin-top: 30px;
}

.modal-btn {
  width: 100%;
  padding: 16px 24px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.modal-btn.btn-add-cart {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.modal-btn.btn-add-cart:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.modal-btn.btn-remove-cart {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.modal-btn.btn-remove-cart:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: 20px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.modal-header {
  padding: 30px 30px 0 30px;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 0 30px 30px 30px;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 10px;
}

.modal-protocol-icon {
  width: 60px;
  height: 60px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.modal-protocol-name {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.modal-protocol-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 0;
  font-style: italic;
}

.modal-price {
  text-align: center;
  padding: 20px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin: 20px 0;
}

.modal-price-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--bg-accent);
  margin: 0;
}

.modal-price-duration {
  color: var(--text-tertiary);
  margin: 5px 0 0 0;
}

.modal-description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 30px;
}

/* Composition Section */
.composition-section {
  margin-bottom: 30px;
}

.composition-section h3 {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.composition-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.composition-item {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 15px;
  border: 1px solid var(--border-color);
}

.component-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.component-header strong {
  color: var(--text-primary);
  font-size: 1rem;
}

.dosage {
  color: var(--bg-accent);
  font-weight: 600;
  font-size: 0.9rem;
}

.component-description {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 0;
}

/* Target Section */
.target-section {
  margin-bottom: 30px;
}

.target-section h3 {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.target-challenges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.challenge-tag {
  background: var(--bg-accent);
  color: var(--text-inverse);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Info Cards at Bottom */
.info-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-gap: 30px;
  gap: 30px;
  margin-top: 40px;
}

.info-card {
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.info-card h3 {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin-bottom: 15px;
}

.info-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* Loading and Error States */
.loading-container, .error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--bg-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-container p, .error-container p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin: 0;
}

.error-container h2 {
  color: var(--text-primary);
  margin-bottom: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .supplements-page {
    padding: 15px;
  }
  
  .protocols-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .protocol-card {
    padding: 20px;
  }
  
  .page-header {
    padding: 20px 15px;
  }
  
  .page-header h1 {
    font-size: 2rem;
  }
  
  .protocol-header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  
  .protocol-title {
    align-items: flex-start;
  }
  
  .protocol-price {
    align-items: flex-start;
    text-align: left;
  }
  
  .cart-summary {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .protocol-actions {
    flex-direction: column;
  }
  
  .modal-content {
    margin: 10px;
    max-height: 95vh;
  }
  
  .modal-header, .modal-body {
    padding: 20px;
  }
  
  .info-section {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Checkout Modal */
.checkout-modal {
  background: var(--bg-primary);
  border-radius: 20px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.order-summary {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
}

.order-summary h3 {
  color: var(--text-primary);
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.order-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 15px;
}

.order-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--bg-primary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-name {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
}

.item-subtitle {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-style: italic;
}

.item-price {
  color: var(--bg-accent);
  font-weight: 700;
  font-size: 1.1rem;
}

.order-total {
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
  text-align: right;
  font-size: 1.2rem;
  color: var(--text-primary);
}

.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.checkout-form h3 {
  color: var(--text-primary);
  margin-bottom: 15px;
  font-size: 1.1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.shipping-section h3 {
  color: var(--text-primary);
  margin-bottom: 15px;
  font-size: 1.1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

/* Address Display */
.address-display {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.address-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.address-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.address-field strong {
  color: var(--text-primary);
  font-weight: 600;
}

.address-field span {
  color: var(--text-secondary);
}

.address-field.notes {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: 8px;
  font-style: italic;
}

.edit-address-btn, .add-address-btn {
  margin-top: 15px;
  padding: 10px 16px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.edit-address-btn:hover, .add-address-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.no-address {
  text-align: center;
  color: var(--text-secondary);
}

.no-address p {
  margin-bottom: 15px;
}

.add-address-btn {
  background: var(--gradient-primary);
  color: white;
  border: none;
  font-weight: 600;
}

.add-address-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.checkout-actions {
  display: flex;
  gap: 15px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  margin-top: 20px;
}

.btn-cancel {
  flex: 1 1;
  padding: 14px 20px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-cancel:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-order {
  flex: 2 1;
  padding: 14px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-order:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-order:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Mobile responsive for checkout */
@media (max-width: 768px) {
  .checkout-modal {
    margin: 10px;
    max-height: 95vh;
  }
  
  .checkout-actions {
    flex-direction: column;
  }
  
  .btn-cancel, .btn-order {
    flex: none;
  }
}

/* Note: Checkout styles moved to SupplementCheckoutModal.css */

/* High contrast mode support */
@media (prefers-contrast: high) {
  .protocol-card {
    border-width: 2px;
  }
  
  .btn-details, .btn-add-cart, .btn-remove-cart {
    border-width: 2px;
  }
}
/* Main Screen Styles - Mobile First */
.main-screen {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  position: relative;
  /* iOS safe area - ensure content stays within safe area */
  height: 100vh;
  height: -webkit-fill-available;
  /* Allow scrolling on mobile devices */
  overflow: visible;
  /* Remove bottom safe area to eliminate empty space */
  padding-bottom: 0;
}

.main-header {
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 20px 16px;
}

.main-nav {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 16px;
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 0;
}

.nav-tab {
  background: none;
  border: none;
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.nav-tab:hover {
  color: #374151;
  background: #f9fafb;
}

.nav-tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.nav-tab.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header-text {
  flex: 1 1;
  text-align: left;
}

.header-actions {
  flex-shrink: 0;
}

.header-content h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #667eea; /* Fallback for browsers that don't support background-clip */
}

.header-content p {
  margin: 0;
  color: #6b7280;
  font-size: 16px;
  line-height: 1.5;
}

.main-content {
  flex: 1 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
  width: 100%;
  box-sizing: border-box;
  /* iOS safe area - allow natural scrolling */
  overflow-y: visible;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  /* Ensure content can expand naturally */
  min-height: 0;
}

.user-profile-section {
  margin-bottom: 32px;
}

.features-section {
  margin-bottom: 32px;
}

.features-section h2 {
  text-align: center;
  margin: 0 0 24px 0;
  font-size: 24px;
  font-weight: 600;
  color: #1f2937;
}

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-gap: 16px;
  gap: 16px;
}

.feature-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.feature-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.feature-card h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.feature-card p {
  margin: 0;
  color: #6b7280;
  line-height: 1.5;
  font-size: 14px;
}

.quick-actions {
  margin-bottom: 32px;
}

.quick-actions h2 {
  text-align: center;
  margin: 0 0 24px 0;
  font-size: 24px;
  font-weight: 600;
  color: #1f2937;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.action-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.action-card span {
  font-size: 32px;
  display: block;
  margin-bottom: 12px;
}

.action-card p {
  margin: 0;
  line-height: 1.5;
  font-size: 16px;
}

.main-footer {
  background: white;
  border-top: 1px solid #e5e7eb;
  padding: 20px 16px;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-content p {
  margin: 0;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.5;
}

.footer-content strong {
  color: #374151;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .main-content {
    padding-top: 80px; /* Space for mobile header */
    /* iOS safe area - allow natural content flow */
    min-height: calc(100vh - 80px);
    min-height: calc(-webkit-fill-available - 80px);
    /* Remove fixed height to allow content to expand */
    height: auto;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .header-text {
    text-align: center;
    width: 100%;
  }

  .header-actions {
    align-self: center;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding-top: 70px; /* Smaller space for mobile header on small screens */
    /* iOS safe area - allow natural content flow */
    min-height: calc(100vh - 70px);
    min-height: calc(-webkit-fill-available - 70px);
    /* Remove fixed height to allow content to expand */
    height: auto;
  }

  .header-content {
    gap: 12px;
  }

  .header-content h1 {
    font-size: 24px;
  }

  .header-content p {
    font-size: 14px;
  }
}

/* Mobile navigation adjustments */
@media (max-width: 767px) {
  .nav-tab {
    padding: 12px 16px;
    font-size: 14px;
  }

  .main-nav {
    padding: 0 12px;
  }
}

/* Tablet Styles */
@media (min-width: 768px) {
  .main-header {
    padding: 32px 24px;
  }

  .header-content h1 {
    font-size: 36px;
  }

  .header-content p {
    font-size: 18px;
  }

  .main-content {
    padding: 40px 24px;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .feature-card {
    padding: 32px;
  }

  .feature-card h3 {
    font-size: 20px;
  }

  .feature-card p {
    font-size: 16px;
  }

  .action-card {
    padding: 32px;
  }

  .action-card p {
    font-size: 18px;
  }
}

/* Desktop Styles */
@media (min-width: 1024px) {
  .main-header {
    padding: 40px 32px;
  }

  .header-content h1 {
    font-size: 42px;
  }

  .main-content {
    padding: 48px 32px;
  }

  .features-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
  }

  .user-profile-section {
    margin-bottom: 48px;
  }

  .features-section {
    margin-bottom: 48px;
  }

  .quick-actions {
    margin-bottom: 48px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .feature-card {
    transition: none;
  }

  .feature-card:hover {
    transform: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .feature-card {
    border: 2px solid #000;
  }

  .action-card {
    border: 2px solid #fff;
  }
}

/* Layout adjustments for sidebar */
.main-content {
  margin-left: 0;
  transition: margin-left 0.3s ease;
}

.content-section {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Chat section should take full height minus header */
.content-section.chat-section {
  height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  padding: 0;
}

.content-section.chat-section .page-header {
  flex-shrink: 0;
  margin-bottom: 0;
}

.content-section.chat-section .chat-container {
  flex: 1 1;
  border-radius: 0;
  box-shadow: none;
  border: none;
}

.coming-soon {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-primary);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.coming-soon h2 {
  margin: 0 0 16px 0;
  font-size: 32px;
  color: var(--text-primary);
}

.coming-soon p {
  margin: 0;
  font-size: 18px;
  color: var(--text-secondary);
}

/* Tablet layout - промежуточные экраны */
@media (min-width: 768px) and (max-width: 1200px) {
  .main-content {
    margin-left: 280px; /* Default full sidebar width */
    padding: 24px;
    max-width: calc(100% - 280px); /* Учитываем ширину сайдбара */
    width: calc(100% - 280px);
    transition: margin-left 0.3s ease, max-width 0.3s ease, width 0.3s ease;
  }

  .main-content.sidebar-collapsed {
    margin-left: 60px; /* Collapsed sidebar width */
    max-width: calc(100% - 60px); /* Учитываем свернутую ширину сайдбара */
    width: calc(100% - 60px);
  }

  .main-header {
    padding: 24px;
  }

  .header-content h1 {
    font-size: 32px;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

/* Desktop layout with sidebar */
@media (min-width: 1201px) {
  .main-content {
    margin-left: 280px;
    padding: 32px;
    max-width: calc(100% - 280px); /* Учитываем ширину сайдбара */
    width: calc(100% - 280px);
    transition: margin-left 0.3s ease, max-width 0.3s ease, width 0.3s ease;
  }

  .main-content.sidebar-collapsed {
    margin-left: 60px;
    max-width: calc(100% - 60px); /* Учитываем свернутую ширину сайдбара */
    width: calc(100% - 60px);
  }
}

/* Floating Button Styles */
.floating-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  overflow: visible;
}

.floating-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
}

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

.floating-button.open {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
  box-shadow: 0 8px 32px rgba(255, 107, 107, 0.3);
}

.floating-button.open:hover {
  box-shadow: 0 12px 40px rgba(255, 107, 107, 0.4);
}

/* Notification Badge */
.notification-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff4757;
  color: white;
  border-radius: 12px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  border: 2px solid white;
  animation: pulse-badge 2s infinite;
}

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

/* Tooltip */
.floating-button-tooltip {
  position: absolute;
  bottom: 100%;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  margin-bottom: 8px;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}

.floating-button-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 16px;
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.8);
}

.floating-button:hover .floating-button-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-4px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .floating-button {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }
  
  .floating-button-tooltip {
    right: -50px;
    transform: translateX(50%);
  }
  
  .floating-button-tooltip::after {
    right: 50%;
    transform: translateX(50%);
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .floating-button,
  .floating-button-tooltip,
  .notification-badge {
    transition: none;
    animation: none;
  }
}

/* Chat Modal Styles */
.chat-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
}

/* Desktop version - no backdrop needed, removed */

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

.chat-modal {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.3s ease-out;
  position: relative;
}

/* Desktop version - positioned above floating button */
.chat-modal.desktop {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  max-height: 600px;
  animation: slideUpFromBottom 0.3s ease-out;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
}

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

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

.chat-modal-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  /* iOS Safari fix: prevent content from stretching beyond bounds */
  max-height: 100%;
  overflow: hidden;
}

/* Mobile version - full screen */
.chat-modal-backdrop.mobile {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
  background: rgba(0, 0, 0, 0.8);
  /* Use dynamic viewport height for iOS compatibility */
  height: 100dvh;
  height: 100vh; /* Fallback for older browsers */
  height: -webkit-fill-available; /* iOS Safari fallback */
}

.chat-modal.mobile {
  width: 100%;
  /* Use dynamic viewport height that excludes virtual keyboard on iOS */
  height: 100dvh;
  height: 100vh; /* Fallback for older browsers */
  height: -webkit-fill-available; /* iOS Safari fallback */
  max-width: none;
  max-height: none;
  border-radius: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  animation: slideUpMobile 0.3s ease-out;
  /* Ensure content respects safe areas on iOS */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: border-box;
  /* iOS Safari fix: prevent content from extending beyond viewport when virtual keyboard appears */
  overflow: hidden;
}

@keyframes slideUpMobile {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

/* Mobile Responsive - fallback for old media queries */
@media (max-width: 768px) {
  .chat-modal-backdrop:not(.desktop) {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }

  .chat-modal:not(.desktop) {
    width: 100%;
    /* Use dynamic viewport height for iOS compatibility */
    height: 100dvh;
    height: 100vh; /* Fallback for older browsers */
    height: -webkit-fill-available; /* iOS Safari fallback */
    max-width: none;
    max-height: none;
    border-radius: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    animation: slideUpMobile 0.3s ease-out;
    /* Ensure content respects safe areas on iOS */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
    /* iOS Safari fix: prevent content from extending beyond viewport when virtual keyboard appears */
    overflow: hidden;
  }
}

@media (max-width: 480px) {
  .chat-modal-backdrop:not(.desktop) {
    padding: 0;
  }

  .chat-modal:not(.desktop) {
    border-radius: 0;
    /* Use dynamic viewport height for iOS compatibility */
    max-height: 100dvh;
    max-height: 100vh; /* Fallback for older browsers */
    max-height: -webkit-fill-available; /* iOS Safari fallback */
  }

  .chat-modal.desktop {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 90px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .chat-modal {
    background: #1a1a1a;
    border: 1px solid #333;
  }
}

/* iOS-specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) {
  .chat-modal.mobile,
  .chat-modal:not(.desktop) {
    /* Force iOS to respect the viewport boundaries */
    height: calc(100vh - env(keyboard-inset-height, 0px));
    height: 100dvh; /* Fallback to dynamic viewport */
    height: -webkit-fill-available; /* iOS Safari fallback */
    /* Prevent content from being pushed up by virtual keyboard */
    position: fixed;
    top: 0;
    bottom: 0;
  }

  .chat-modal-backdrop.mobile {
    /* Ensure backdrop covers the full visible area */
    height: calc(100vh - env(keyboard-inset-height, 0px));
    height: 100dvh; /* Fallback to dynamic viewport */
    height: -webkit-fill-available; /* iOS Safari fallback */
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .chat-modal-backdrop,
  .chat-modal {
    animation: none;
  }

  .chat-modal-backdrop {
    -webkit-backdrop-filter: none;
            backdrop-filter: none;
  }
}

/* Auth Forms Styles - Mobile First */
.auth-form {
  width: 100%;
  max-width: 400px;
  padding: 24px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  margin: 0 auto;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-icon {
  color: #667eea;
  margin-bottom: 16px;
}

.auth-header h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
}

.auth-header p {
  margin: 0;
  color: #6b7280;
  font-size: 16px;
  line-height: 1.5;
}

.auth-form-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-weight: 600;
  color: #374151;
  font-size: 14px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 16px 12px 48px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s ease;
  background: white;
  color: #1f2937;
}

.input-wrapper input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-wrapper input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-wrapper input:disabled {
  background: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
}

.input-icon {
  position: absolute;
  left: 16px;
  color: #9ca3af;
  pointer-events: none;
  z-index: 1;
}

.password-toggle {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.password-toggle:hover {
  color: #667eea;
}

.password-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.error-message {
  color: #ef4444;
  font-size: 14px;
  font-weight: 500;
  margin-top: 4px;
}

.auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
}

.auth-submit-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 0; /* Убираем padding, используем только height */
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  height: 56px; /* Фиксированная высота */
  width: 100%; /* Фиксированная ширина */
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  min-height: 56px; /* Минимальная высота для предотвращения сжатия */
}

.auth-submit-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.auth-submit-button:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Предотвращение изменения размера кнопки при загрузке */
.auth-submit-button.loading {
  pointer-events: none;
}

/* Убираем стили для .button-content, так как теперь используем inline стили */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
  flex-grow: 0;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.auth-footer p {
  margin: 0;
  color: #6b7280;
  font-size: 14px;
}

.auth-link {
  color: #667eea;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-link:hover:not(:disabled) {
  color: #5a67d8;
  text-decoration: underline;
}

.auth-link:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tablet Styles */
@media (min-width: 768px) {
  .auth-form {
    padding: 32px;
  }

  .auth-header h2 {
    font-size: 28px;
  }

  .auth-header p {
    font-size: 18px;
  }

  .form-group label {
    font-size: 16px;
  }

  .input-wrapper input {
    padding: 14px 18px 14px 52px;
    font-size: 18px;
  }

  .input-icon {
    left: 18px;
  }

  .password-toggle {
    right: 18px;
  }

  .auth-submit-button {
    padding: 16px 24px;
    font-size: 18px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .auth-form {
    background: #1f2937;
    border: 1px solid #374151;
  }

  .auth-header h2 {
    color: #e5e7eb;
  }

  .auth-header p {
    color: #9ca3af;
  }

  .form-group label {
    color: #e5e7eb;
  }

  .input-wrapper input {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
  }

  .input-wrapper input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.1);
  }

  .input-wrapper input.error {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.1);
  }

  .input-wrapper input:disabled {
    background: #1f2937;
    color: #6b7280;
  }

  .input-icon {
    color: #6b7280;
  }

  .password-toggle {
    color: #6b7280;
  }

  .password-toggle:hover {
    color: #818cf8;
  }

  .error-message {
    color: #f87171;
  }

  .auth-error {
    background: #2d1b1b;
    border-color: #7f1d1d;
    color: #fca5a5;
  }

  .auth-footer {
    border-top-color: #374151;
  }

  .auth-footer p {
    color: #9ca3af;
  }

  .auth-link {
    color: #818cf8;
  }

  .auth-link:hover:not(:disabled) {
    color: #a5b4fc;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .input-wrapper input {
    border-width: 3px;
  }

  .auth-submit-button {
    border: 3px solid transparent;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .input-wrapper input,
  .auth-submit-button,
  .password-toggle,
  .auth-link {
    transition: none;
  }

  .spinner {
    animation: none;
  }

  .auth-submit-button:hover:not(:disabled) {
    transform: none;
  }
}

/* Forgot Password Specific Styles */
.forgot-password-link {
  text-align: right;
  margin-top: 4px;
}

.auth-link.small {
  font-size: 13px;
  color: #667eea;
  font-weight: 500;
}

.success-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: white;
  animation: successPulse 2s ease-in-out infinite;
}

@keyframes successPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.info-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.info-box svg {
  color: #0284c7;
  flex-shrink: 0;
  margin-top: 2px;
}

.info-box h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #0284c7;
}

.info-box ul {
  margin: 0;
  padding-left: 16px;
  color: #0369a1;
  font-size: 14px;
}

.info-box li {
  margin-bottom: 4px;
}

.auth-submit-button.secondary {
  background: #f3f4f6;
  color: #374151;
  border: 2px solid #e5e7eb;
}

.auth-submit-button.secondary:hover:not(:disabled) {
  background: #e5e7eb;
  border-color: #d1d5db;
  transform: translateY(-1px);
}

.success-message {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  font-weight: 500;
}

/* Password Strength Indicator */
.password-strength {
  margin-top: 8px;
}

.strength-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.strength-fill {
  height: 100%;
  transition: all 0.3s ease;
  border-radius: 2px;
}

.strength-fill.strength-1 {
  background: #ef4444;
  width: 25%;
}

.strength-fill.strength-2 {
  background: #f97316;
  width: 50%;
}

.strength-fill.strength-3 {
  background: #eab308;
  width: 75%;
}

.strength-fill.strength-4 {
  background: #22c55e;
  width: 100%;
}

.strength-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 4px;
  gap: 4px;
  font-size: 12px;
}

.strength-check {
  padding: 2px 0;
}

.strength-check.valid {
  color: #22c55e;
}

.strength-check.invalid {
  color: #ef4444;
}

/* Animations for password reset forms */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-form {
  animation: slideInUp 0.4s ease-out;
}

/* Mobile responsive adjustments for reset forms */
@media (max-width: 768px) {
  .info-box {
    flex-direction: column;
    text-align: center;
  }

  .strength-checks {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .forgot-password-link {
    text-align: center;
  }
}

/* Auth Modal Styles */
.auth-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
}

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

.auth-modal {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
  position: relative;
}

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

.auth-modal-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .auth-modal-backdrop {
    padding: 10px;
    align-items: flex-end;
  }
  
  .auth-modal {
    max-width: 100%;
    max-height: 85vh;
    animation: slideUpMobile 0.3s ease-out;
  }
  
  @keyframes slideUpMobile {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
}

@media (max-width: 480px) {
  .auth-modal-backdrop {
    padding: 0;
    align-items: flex-start;
    padding-top: 10vh;
  }
  
  .auth-modal {
    max-height: 90vh;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .auth-modal-backdrop,
  .auth-modal {
    animation: none;
  }
  
  .auth-modal-backdrop {
    -webkit-backdrop-filter: none;
            backdrop-filter: none;
  }
}

.cache-monitor {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  font-family: monospace;
}

.cache-monitor-toggle {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.cache-monitor-toggle:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.cache-monitor-panel {
  position: absolute;
  top: 50px;
  right: 0;
  min-width: 300px;
  background: rgba(0, 0, 0, 0.95);
  color: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}

.cache-monitor-panel h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  color: #4ade80;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 8px;
}

.cache-stats {
  margin-bottom: 16px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}

.stat-row:last-child {
  margin-bottom: 0;
}

.cache-monitor .stat-value {
  font-weight: bold;
  color: #e5e7eb;
}

.cache-monitor .stat-value.good {
  color: #4ade80;
}

.cache-monitor .stat-value.medium {
  color: #fbbf24;
}

.cache-monitor .stat-value.poor {
  color: #f87171;
}

.cache-monitor .stat-value.small {
  font-size: 10px;
  opacity: 0.8;
}

.cache-actions {
  display: flex;
  gap: 8px;
}

.cache-btn {
  flex: 1 1;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cache-btn.clear {
  background: #dc2626;
  color: white;
}

.cache-btn.clear:hover {
  background: #b91c1c;
}

.cache-btn.stop {
  background: #f59e0b;
  color: white;
}

.cache-btn.stop:hover {
  background: #d97706;
}

/* Скрываем в мобильной версии */
@media (max-width: 768px) {
  .cache-monitor {
    display: none;
  }
}

.cache-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f8fafc;
  background: var(--bg-primary, #f8fafc);
  color: #1f2937;
  color: var(--text-primary, #1f2937);
}

.cache-loader-content {
  text-align: center;
  max-width: 400px;
  padding: 40px 20px;
}

.cache-loader-spinner {
  margin-bottom: 24px;
}

.cache-loader-spinner .spinning {
  color: #667eea;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.cache-loader h3 {
  margin: 0 0 12px 0;
  font-size: 24px;
  font-weight: 600;
  color: #1f2937;
  color: var(--text-primary, #1f2937);
}

.cache-loader p {
  margin: 0;
  font-size: 16px;
  color: #6b7280;
  color: var(--text-secondary, #6b7280);
  line-height: 1.5;
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
  .cache-loader {
    background: #111827;
    background: var(--bg-primary, #111827);
  }
  
  .cache-loader h3 {
    color: #f9fafb;
    color: var(--text-primary, #f9fafb);
  }
  
  .cache-loader p {
    color: #d1d5db;
    color: var(--text-secondary, #d1d5db);
  }
}

.offline-indicator {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  max-width: 400px;
  min-width: 200px;
}

.offline-indicator.offline {
  border-color: #f59e0b;
  background: rgba(254, 243, 199, 0.95);
}

.offline-indicator.expanded {
  max-height: 80vh;
  overflow-y: auto;
}

.offline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  -webkit-user-select: none;
          user-select: none;
}

.offline-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.offline-status .online {
  color: #059669;
}

.offline-status .offline {
  color: #f59e0b;
}

.status-text {
  color: #1f2937;
  color: var(--text-primary, #1f2937);
}

.operations-badge {
  background: #667eea;
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.quick-stats {
  display: flex;
  gap: 8px;
  align-items: center;
}

.stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 6px;
}

.stat.processing {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.1);
}

.stat.pending {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.stat.failed {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

.offline-details {
  border-top: 1px solid #e5e7eb;
  padding: 0;
}

.operations-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  border-bottom: 1px solid #f3f4f6;
}

.operations-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  color: var(--text-primary, #1f2937);
}

.queue-blocker {
  background: #fef3cd;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: #92400e;
  margin: 8px 0;
  text-align: center;
}

.operations-actions {
  display: flex;
  gap: 4px;
}

.retry-btn,
.clear-btn,
.clear-all-btn {
  background: none;
  border: none;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.2s ease;
}

.retry-btn:hover {
  background: #f3f4f6;
  color: #2563eb;
}

.clear-btn:hover {
  background: #f3f4f6;
  color: #dc2626;
}

.clear-all-btn:hover {
  background: #fef2f2;
  color: #dc2626;
  transform: scale(1.1);
}

.operations-list {
  max-height: 300px;
  overflow-y: auto;
}

.operation-item {
  padding: 8px 16px;
  border-bottom: 1px solid #f9fafb;
}

.operation-item:last-child {
  border-bottom: none;
}

.operation-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.operation-name {
  flex: 1 1;
  font-weight: 500;
  color: #1f2937;
  color: var(--text-primary, #1f2937);
}

.operation-time {
  color: #6b7280;
  font-size: 11px;
}

.operation-error {
  margin-top: 4px;
  padding: 4px 8px;
  background: #fef2f2;
  color: #dc2626;
  font-size: 11px;
  border-radius: 4px;
  border-left: 3px solid #dc2626;
}

.operation-retries {
  margin-top: 4px;
  font-size: 11px;
  color: #f59e0b;
  font-weight: 500;
}

/* Иконки статусов */
.status-pending {
  color: #f59e0b;
  animation: pulse 2s infinite;
}

.status-processing {
  color: #2563eb;
  animation: spin 1s linear infinite;
}

.status-completed {
  color: #059669;
}

.status-failed {
  color: #dc2626;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
  .offline-indicator {
    background: rgba(17, 24, 39, 0.95);
    border-color: #374151;
  }

  .offline-indicator.offline {
    border-color: #f59e0b;
    background: rgba(69, 26, 3, 0.95);
  }

  .operations-header {
    border-bottom-color: #374151;
  }

  .offline-details {
    border-top-color: #374151;
  }

  .operation-item {
    border-bottom-color: #1f2937;
  }
}

/* Мобильная версия */
@media (max-width: 768px) {
  .offline-indicator {
    left: 10px;
    right: 10px;
    max-width: none;
  }
}

.intro-tour-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* iOS safe area support */
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  animation: fadeIn 0.4s ease-out;
}

.intro-tour-overlay.dark {
  background: rgba(0, 0, 0, 0.95);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    -webkit-backdrop-filter: blur(0px);
            backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    -webkit-backdrop-filter: blur(12px);
            backdrop-filter: blur(12px);
  }
}

.intro-tour-container {
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  max-width: 500px;
  width: 100%;
  max-height: calc(
    100vh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
  );
  overflow: hidden;
  animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
}

.intro-tour-overlay.dark .intro-tour-container {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
}

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

/* Animated Background */
.intro-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 120px;
  opacity: 0.08;
  z-index: 0;
}

.intro-tour-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
  position: relative;
  z-index: 1;
}

.intro-tour-progress {
  display: flex;
  gap: 12px;
}

@media (max-width: 768px) {
  .intro-tour-progress {
    gap: 8px;
  }
}

.intro-progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  position: relative;
}

@media (max-width: 768px) {
  .intro-progress-dot {
    width: 8px;
    height: 8px;
  }
}

.intro-progress-dot.active {
  transform: scale(1.3);
}

.intro-progress-dot:hover {
  transform: scale(1.1);
}

.intro-skip-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #666;
  cursor: pointer;
  padding: 12px;
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
  .intro-skip-btn {
    padding: 8px;
  }
}

.intro-skip-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #333;
  transform: scale(1.1);
}

.intro-tour-overlay.dark .intro-skip-btn {
  background: rgba(255, 255, 255, 0.05);
  color: #ccc;
}

.intro-tour-overlay.dark .intro-skip-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.intro-tour-content {
  padding: 32px 28px;
  text-align: center;
  position: relative;
  z-index: 1;
  flex: 1 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
}

.intro-step-icon-container {
  margin-bottom: 28px;
  display: flex;
  justify-content: center;
}

.intro-step-icon {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  animation: bounceIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.intro-step-icon::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shine 2s infinite;
}

@keyframes shine {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3) rotate(-180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.1) rotate(-90deg);
  }
  70% {
    transform: scale(0.95) rotate(0deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.intro-step-title {
  font-size: 28px;
  font-weight: 800;
  color: #333;
  margin: 0 0 16px 0;
  line-height: 1.2;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleSlideIn 0.6s ease-out 0.2s both;
}

.intro-tour-overlay.dark .intro-step-title {
  color: #fff;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.intro-step-description {
  font-size: 18px;
  color: #666;
  line-height: 1.6;
  margin: 0 auto 24px auto;
  max-width: 450px;
  text-align: center;
  animation: descriptionSlideIn 0.6s ease-out 0.4s both;
}

.intro-tour-overlay.dark .intro-step-description {
  color: #ccc;
}

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

/* Features List */
.intro-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-gap: 16px;
  gap: 16px;
  margin-top: 20px;
  max-width: 450px;
  margin-left: auto;
  margin-right: auto;
}

.intro-feature-item {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 14px;
  padding: 14px;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: featureSlideIn 0.6s ease-out both;
  transition: all 0.3s ease;
}

.intro-feature-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.intro-tour-overlay.dark .intro-feature-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.intro-feature-text {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  display: block;
}

.intro-tour-overlay.dark .intro-feature-text {
  color: #fff;
}

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

.intro-tour-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1;
}

.intro-tour-overlay.dark .intro-tour-navigation {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.intro-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border: none;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 110px;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.intro-nav-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.intro-nav-btn:hover::before {
  left: 100%;
}

.intro-nav-btn.primary {
  color: white;
  position: relative;
}

.intro-nav-btn.primary:hover {
  transform: translateY(-3px) scale(1.05);
}

.intro-nav-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #666;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.intro-nav-btn.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  color: #333;
  transform: translateY(-2px);
}

.intro-tour-overlay.dark .intro-nav-btn.secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.intro-tour-overlay.dark .intro-nav-btn.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.intro-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.intro-nav-center {
  flex: 1 1;
  display: flex;
  justify-content: center;
}

.intro-step-counter {
  font-size: 16px;
  color: #999;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 20px;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}

.intro-tour-overlay.dark .intro-step-counter {
  color: #ccc;
  background: rgba(255, 255, 255, 0.05);
}

/* Адаптивность */
@media (max-width: 768px) {
  .intro-tour-overlay {
    padding: 0;
    align-items: stretch;
    /* iOS safe area support for mobile */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .intro-tour-container {
    max-width: 100%;
    border-radius: 0;
    max-height: 100vh;
    max-height: -webkit-fill-available;
    height: 100vh;
    height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
  }

  .intro-background {
    height: 80px;
  }

  .intro-tour-header {
    padding: 8px 12px 0;
  }

  .intro-tour-content {
    padding: 12px 12px;
    flex: 1 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .intro-step-icon-container {
    margin-bottom: 12px;
  }

  .intro-step-icon {
    width: 50px;
    height: 50px;
  }

  .intro-step-title {
    font-size: 18px;
    margin: 0 0 8px 0;
  }

  .intro-step-description {
    font-size: 14px;
    margin: 0 auto 12px auto;
    max-width: 300px;
    text-align: center;
  }

  .intro-features {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
    max-width: 300px;
  }

  .intro-feature-item {
    padding: 8px;
    border-radius: 8px;
  }

  .intro-feature-text {
    font-size: 12px;
  }

  .intro-tour-navigation {
    padding: 8px 12px 12px;
    margin-top: auto;
  }

  .intro-nav-btn {
    padding: 12px 20px;
    font-size: 14px;
    min-width: 120px;
  }

  .intro-dont-show-again {
    padding: 0 12px 6px;
  }
}

@media (max-width: 480px) {
  .intro-tour-overlay {
    padding: 0;
    align-items: stretch;
    /* iOS safe area support for small screens */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .intro-tour-container {
    border-radius: 0;
    max-height: 100vh;
    max-height: -webkit-fill-available;
    height: 100vh;
    height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
  }

  .intro-tour-header {
    padding: 6px 8px 0;
  }

  .intro-tour-progress {
    gap: 6px;
  }

  .intro-progress-dot {
    width: 6px;
    height: 6px;
  }

  .intro-skip-btn {
    padding: 6px;
  }

  .intro-tour-content {
    padding: 8px 8px;
    flex: 1 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .intro-step-icon {
    width: 40px;
    height: 40px;
  }

  .intro-step-title {
    font-size: 16px;
  }

  .intro-step-description {
    font-size: 12px;
    text-align: center;
  }

  .intro-features {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .intro-feature-item {
    padding: 6px;
  }

  .intro-feature-text {
    font-size: 11px;
  }

  .intro-tour-navigation {
    flex-direction: row;
    gap: 4px;
    padding: 8px;
    margin-top: auto;
  }

  .intro-nav-btn {
    flex: 1 1;
    min-width: 100px;
    padding: 10px 12px;
    font-size: 12px;
  }

  .intro-nav-center {
    order: 0;
    flex: 0 0 auto;
  }

  .intro-step-counter {
    font-size: 10px;
    padding: 2px 4px;
  }
}

/* Don't show again checkbox styles */
.intro-dont-show-again {
  padding: 0 24px 16px;
  display: flex;
  justify-content: center;
}

.intro-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  color: var(--text-secondary, #666);
  transition: color 0.2s ease;
}

.intro-checkbox-label:hover {
  color: #333;
  color: var(--text-primary, #333);
}

.intro-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #667eea;
  accent-color: var(--primary-color, #667eea);
}

.intro-checkbox-text {
  -webkit-user-select: none;
          user-select: none;
}

/* Dark mode styles for checkbox */
.dark .intro-checkbox-label {
  color: #aaa;
  color: var(--text-secondary-dark, #aaa);
}

.dark .intro-checkbox-label:hover {
  color: #fff;
  color: var(--text-primary-dark, #fff);
}

/* Mobile styles for checkbox */
@media (max-width: 768px) {
  .intro-dont-show-again {
    padding: 0 12px 6px;
    margin-top: auto;
  }

  .intro-checkbox-label {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .intro-dont-show-again {
    padding: 0 8px 4px;
    margin-top: auto;
  }

  .intro-checkbox-label {
    font-size: 10px;
  }
}

/* Telegram Environment Styles */
.telegram-environment {
  transition: all 0.3s ease;
}

.telegram-environment.in-telegram {
  /* Адаптация для Telegram */
  min-height: 100vh;
  background: #0f0f0f;
  background: var(--telegram-bg-color, #0f0f0f);
  color: #ffffff;
  color: var(--telegram-text-color, #ffffff);
}

.telegram-environment.web {
  /* Обычная веб версия */
}

/* Индикатор загрузки */
.telegram-environment-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #0f0f0f;
  color: #ffffff;
}

.loading-container {
  text-align: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(102, 126, 234, 0.3);
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Индикатор среды разработки */
.telegram-env-indicator {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 10000;
}

.env-indicator-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}

.env-indicator-button:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: rgba(255, 255, 255, 0.3);
}

.env-details-popup {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 280px;
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  -webkit-backdrop-filter: blur(20px);
          backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.env-details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(102, 126, 234, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.env-details-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.env-details-header button {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.env-details-header button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.env-details-content {
  padding: 16px;
}

.env-detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12px;
}

.env-detail-item:last-child {
  margin-bottom: 0;
}

.env-detail-item .label {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.env-detail-item .value {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #ffffff;
  font-weight: 600;
}

.env-detail-item .value.telegram {
  color: #2aabee;
}

.env-detail-item .value.web {
  color: #667eea;
}

.env-detail-item .value.premium {
  color: #ffd700;
}

.env-detail-item.error {
  color: #ff6b6b;
}

.env-detail-item.error .label,
.env-detail-item.error .value {
  color: #ff6b6b;
}

.env-detail-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 12px 0;
}

/* Telegram тема - CSS переменные */
.telegram-environment.in-telegram {
  --primary-color: var(--telegram-button-color, #667eea);
  --primary-text: var(--telegram-button-text-color, #ffffff);
  --background-color: var(--telegram-bg-color, #0f0f0f);
  --text-color: var(--telegram-text-color, #ffffff);
  --hint-color: var(--telegram-hint-color, rgba(255, 255, 255, 0.5));
  --link-color: var(--telegram-link-color, #2aabee);
}

/* Глобальные стили для Telegram среды */
body.telegram-environment {
  background: #0f0f0f;
  background: var(--telegram-bg-color, #0f0f0f);
  color: #ffffff;
  color: var(--telegram-text-color, #ffffff);
}

body.telegram-environment * {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

body.telegram-environment *::-webkit-scrollbar {
  width: 6px;
}

body.telegram-environment *::-webkit-scrollbar-track {
  background: transparent;
}

body.telegram-environment *::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

body.telegram-environment *::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Адаптация кнопок для Telegram */
.telegram-environment.in-telegram .btn-primary,
.telegram-environment.in-telegram .connect-wallet-btn,
.telegram-environment.in-telegram .telegram-connect {
  background: #667eea;
  background: var(--telegram-button-color, #667eea);
  color: #ffffff;
  color: var(--telegram-button-text-color, #ffffff);
  border: none;
}

.telegram-environment.in-telegram .btn-primary:hover,
.telegram-environment.in-telegram .connect-wallet-btn:hover {
  background: #667eea;
  background: var(--telegram-button-color, #667eea);
  opacity: 0.9;
}

/* Адаптация ссылок для Telegram */
.telegram-environment.in-telegram a {
  color: #2aabee;
  color: var(--telegram-link-color, #2aabee);
}

/* Адаптация форм для Telegram */
.telegram-environment.in-telegram input,
.telegram-environment.in-telegram textarea,
.telegram-environment.in-telegram select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  color: var(--telegram-text-color, #ffffff);
}

.telegram-environment.in-telegram input::placeholder,
.telegram-environment.in-telegram textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
  color: var(--telegram-hint-color, rgba(255, 255, 255, 0.5));
}

/* Адаптация модальных окон для Telegram */
.telegram-environment.in-telegram .modal-content,
.telegram-environment.in-telegram .chat-modal {
  background: #0f0f0f;
  background: var(--telegram-bg-color, #0f0f0f);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Адаптация для viewport Telegram */
.telegram-environment.in-telegram #root {
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 0;
  padding-right: 0;
}

.telegram-environment.in-telegram .App {
  /* No padding - let individual components handle safe area */
}

/* Стили для TON кошелька */
.telegram-wallet .wallet-header .mode-indicator.telegram {
  background: linear-gradient(45deg, #2aabee, #229ed9);
  color: #ffffff;
}

.telegram-wallet .ton-wallet-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.telegram-wallet .ton-info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

/* Адаптация анимаций для Telegram */
.telegram-environment.in-telegram * {
  animation-duration: 0.2s !important;
  transition-duration: 0.2s !important;
}

/* Скрытие элементов, не нужных в Telegram */
.telegram-environment.in-telegram .desktop-only {
  display: none !important;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
  .telegram-environment.in-telegram {
    padding: 0;
  }

  .env-details-popup {
    right: -10px;
    min-width: 260px;
  }
}

/* Адаптация для темной темы Telegram */
@media (prefers-color-scheme: dark) {
  .telegram-environment.in-telegram {
    --telegram-bg-color: #1a1a1a;
    --telegram-text-color: #ffffff;
    --telegram-hint-color: rgba(255, 255, 255, 0.5);
  }
}

/* Адаптация для светлой темы Telegram */
@media (prefers-color-scheme: light) {
  .telegram-environment.in-telegram {
    --telegram-bg-color: #ffffff;
    --telegram-text-color: #000000;
    --telegram-hint-color: rgba(0, 0, 0, 0.5);
  }
}

/* CSS Variables for Themes */
:root {
  /* Light theme (default) */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-hover: #e2e8f0;
  --bg-accent: #667eea;

  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-inverse: #ffffff;

  --border-color: #e5e7eb;
  --border-hover: #d1d5db;
  --border-accent: #667eea;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --bg-hover: #4b5563;
    --bg-accent: #667eea;

    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-tertiary: #9ca3af;
    --text-inverse: #111827;

    --border-color: #374151;
    --border-hover: #4b5563;
    --border-accent: #667eea;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  }
}

/* Global Styles - Mobile First */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  color: #1f2937;
  color: var(--text-primary);
  background: #f8fafc;
  background: var(--bg-secondary);
}

.App {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  position: relative;
  /* Ensure App fills the available space within safe area */
  height: 100%;
  /* iOS safe area - allow natural scrolling */
  overflow-x: hidden;
  overflow-y: auto;
  /* No padding to avoid giant indents */
}

/* Utilities */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for accessibility */
*:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

button:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .floating-button,
  .chat-modal {
    display: none !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  body {
    background: white;
    color: black;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Web3Modal стили для темной темы */

/* Переопределения для темной темы */
@media (prefers-color-scheme: dark) {
  /* Web3Modal глобальные переменные */
  w3m-modal {
    --w3m-background-color: #111827;
    --w3m-foreground-color: #1f2937;
    --w3m-accent-color: #667eea;
    --w3m-text-color: #f9fafb;
    --w3m-text-secondary-color: #d1d5db;
    --w3m-border-color: #374151;
    --w3m-overlay-background-color: rgba(0, 0, 0, 0.8);
  }

  /* Основные компоненты модального окна */
  w3m-modal,
  w3m-modal * {
    color: #f9fafb !important;
  }

  /* Фон модального окна */
  w3m-modal-container {
    background: #111827 !important;
  }

  /* Заголовки и текст */
  w3m-modal h1,
  w3m-modal h2,
  w3m-modal h3,
  w3m-modal p,
  w3m-modal span {
    color: #f9fafb !important;
  }

  /* Кнопки */
  w3m-modal button {
    background: #374151 !important;
    border-color: #4b5563 !important;
    color: #f9fafb !important;
  }

  w3m-modal button:hover {
    background: #4b5563 !important;
  }

  /* Элементы списка кошельков */
  w3m-wallet-button {
    background: #1f2937 !important;
    border-color: #374151 !important;
  }

  w3m-wallet-button:hover {
    background: #374151 !important;
  }

  /* Разделители */
  w3m-modal hr {
    border-color: #374151 !important;
  }

  /* Поля ввода */
  w3m-modal input {
    background: #1f2937 !important;
    border-color: #374151 !important;
    color: #f9fafb !important;
  }

  /* QR код контейнер */
  w3m-qr-code {
    background: #1f2937 !important;
  }

  /* Подвал модального окна */
  w3m-modal-footer {
    background: #1f2937 !important;
    border-top-color: #374151 !important;
  }
}

/* Улучшения для светлой темы тоже */
w3m-modal {
  --w3m-border-radius-master: 12px;
  --w3m-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

/* Анимации */
w3m-modal {
  transition: all 0.3s ease;
}

/* Убираем лишние эффекты для лучшей производительности */
w3m-modal * {
  transition: background 0.2s ease, color 0.2s ease;
}

