:root {
  --tg-theme-bg-color: #0f172a;
  --tg-theme-text-color: #ffffff;
  --tg-theme-hint-color: #64748b;
  --tg-theme-link-color: #06b6d4;
  --tg-theme-button-color: #0ea5e9;
  --tg-theme-button-text-color: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  background-attachment: fixed;
  color: var(--tg-theme-text-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Floating particles background */
.floating-particles {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(2px 2px at 20px 30px, rgba(59, 130, 246, 0.3), transparent),
    radial-gradient(2px 2px at 40px 70px, rgba(16, 185, 129, 0.3), transparent),
    radial-gradient(1px 1px at 90px 40px, rgba(139, 92, 246, 0.3), transparent),
    radial-gradient(1px 1px at 130px 80px, rgba(236, 72, 153, 0.3), transparent),
    radial-gradient(2px 2px at 160px 30px, rgba(59, 130, 246, 0.3), transparent);
  background-repeat: repeat;
  background-size: 200px 100px;
  animation: float-particles 20s linear infinite;
}

@keyframes float-particles {
  0% {
    transform: translateY(0px) rotate(0deg);
  }
  100% {
    transform: translateY(-100px) rotate(360deg);
  }
}

/* Glass morphism effects */
.glass-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.glass-header {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-nav {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
}

/* Hero gradient */
.hero-gradient {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.8) 0%,
    rgba(139, 92, 246, 0.8) 50%,
    rgba(16, 185, 129, 0.8) 100%
  );
  backdrop-filter: blur(20px);
  position: relative;
}

/* Modern inputs */
.modern-input {
  padding: 0.75rem;
  font-size: 1rem; /* 👈 фикс против автозума */
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  transition: all 0.3s ease;
}

.modern-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
  background: rgba(255, 255, 255, 0.15);
}

.modern-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}


/* Modern buttons */
.modern-button {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #10b981 100%);
  color: white;
  border: none;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.4);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.modern-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: left 0.5s;
}

.modern-button:hover::before {
  left: 100%;
}

.modern-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(59, 130, 246, 0.6);
}

/* Service cards */
.service-card {
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.service-card::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: left 0.6s;
}

.service-card:hover::before {
  left: 100%;
}

.service-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

/* Price badges */
.price-badge-new {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  display: inline-block;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

/* Navigation */
.nav-item {
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.3s ease;
  position: relative;
}

.nav-item:hover {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
}

.nav-item.active {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.2);
}

/* Chat messages */
.chat-message {
  max-width: 80%;
  word-wrap: break-word;
  animation: slideInMessage 0.3s ease-out;
}

.user-message {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: white;
  margin-left: auto;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.support-message {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

/* Animations */
@keyframes slideInMessage {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes bounceSlow {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

@keyframes pulseSlow {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Animation classes */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

.animate-slide-in-left {
  animation: slideInLeft 0.6s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

.animate-slide-in-up {
  animation: slideInUp 0.6s ease-out;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-bounce-slow {
  animation: bounceSlow 2s infinite;
}

.animate-pulse-slow {
  animation: pulseSlow 3s infinite;
}

/* Status indicators */
.status-online {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  animation: pulseSlow 2s infinite;
}

.status-offline {
  background: #6b7280;
}

/* Order cards */
.order-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-left: 4px solid #3b82f6;
  transition: all 0.3s ease;
}

.order-card:hover {
  transform: translateX(8px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Toggle switch */
.modern-toggle {
  transition: all 0.3s ease;
}

/* Profile options */
.profile-option {
  transition: all 0.3s ease;
}

.profile-option:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Quick action cards */
.quick-action-card {
  transition: all 0.3s ease;
}

.quick-action-card:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Page transitions */
.page {
  min-height: 100vh;
  transition: all 0.3s ease;
}

.page.hidden {
  display: none;
}

/* Responsive design */
@media (max-width: 640px) {
  .p-6 {
    padding: 1rem;
  }

  .space-y-6 > * + * {
    margin-top: 1rem;
  }

  .service-card {
    margin: 0 4px;
  }

  .hero-gradient {
    padding: 1.5rem;
  }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
  :root {
    --tg-theme-bg-color: #0f172a;
    --tg-theme-text-color: #ffffff;
    --tg-theme-hint-color: #64748b;
  }
}

/* Loading states */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Notification styles */
.notification {
  background: rgba(59, 130, 246, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 16px;
  color: white;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
  animation: slideInNotification 0.5s ease-out;
}

@keyframes slideInNotification {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Special effects for buttons */
.btn-glow {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
  }
  to {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.8);
  }
}

/* Мобильные исправления для Telegram Mini Apps */
.page {
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

/* Фиксированная высота для чата поддержки */
#support-page .flex-col {
  height: calc(100vh - 140px);
}

#support-page #chat-messages {
  min-height: 200px;
  max-height: calc(100vh - 280px);
}

/* Фиксированная высота для страницы заказа */
#order-page .flex-col {
  height: calc(100vh - 140px);
}

#order-page .flex-1 {
  max-height: calc(100vh - 220px);
  padding-bottom: 1rem;
}

/* Улучшенная прокрутка */
.overflow-y-auto {
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.5) transparent;
}

.overflow-y-auto::-webkit-scrollbar {
  width: 4px;
}

.overflow-y-auto::-webkit-scrollbar-track {
  background: transparent;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.5);
  border-radius: 2px;
}

/* Компактные элементы для мобильных */
@media (max-width: 480px) {
  .p-6 {
    padding: 1rem;
  }

  .p-4 {
    padding: 0.75rem;
  }

  .space-y-6 > * + * {
    margin-top: 1rem;
  }

  .space-y-4 > * + * {
    margin-top: 0.75rem;
  }

  .space-y-3 > * + * {
    margin-top: 0.5rem;
  }

  /* Уменьшаем размеры для экономии места */
  .text-3xl {
    font-size: 1.5rem;
  }

  .text-2xl {
    font-size: 1.25rem;
  }

  .text-xl {
    font-size: 1.125rem;
  }

  /* Компактные карточки услуг */
  .service-card {
    padding: 1rem;
  }

  .service-card .w-20 {
    width: 3.5rem;
    height: 3.5rem;
  }

  .service-card .text-3xl {
    font-size: 1.5rem;
  }

  /* Компактная навигация */
  .bottom-nav {
    padding: 0.5rem 0;
  }

  .nav-item {
    padding: 0.5rem;
  }

  .nav-item i {
    font-size: 1.125rem;
  }

  /* Компактные инпуты */
  .modern-input {
    padding: 0.75rem;
    font-size: 1rem;
  }

  /* Компактные кнопки */
  .modern-button {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
  }

  /* Компактный заголовок */
  .hero-gradient {
    padding: 1.5rem 1rem;
  }

  .hero-gradient .w-16 {
    width: 3rem;
    height: 3rem;
  }

  /* Компактные статистики */
  .glass-card p,
  .glass-card div {
    font-size: 0.875rem;
  }

  /* Уменьшаем отступы в формах */
  textarea {
    min-height: 60px;
  }

  /* Компактные уведомления */
  .notification {
    padding: 0.75rem;
    font-size: 0.875rem;
  }
}

/* Специальные стили для очень маленьких экранов */
@media (max-width: 360px) {
  .text-2xl {
    font-size: 1.125rem;
  }

  .service-card {
    padding: 0.75rem;
  }

  .service-card .w-20 {
    width: 3rem;
    height: 3rem;
  }

  .modern-input {
    padding: 0.625rem;
  }

  .modern-button {
    padding: 0.75rem;
  }

  .hero-gradient {
    padding: 1rem;
  }
}

/* Исправление для Telegram WebApp viewport */
@media screen and (max-height: 600px) {
  .page {
    min-height: 100vh;
  }

  #support-page .flex-col,
  #order-page .flex-col {
    height: calc(100vh - 120px);
  }

  #support-page #chat-messages {
    max-height: calc(100vh - 240px);
  }

  #order-page .flex-1 {
    max-height: calc(100vh - 200px);
  }
}
