/* Telegram Web App Theme Variables - Updated for warm paper theme */
:root {
  /* Warm paper theme colors */
  --tg-theme-bg-color: #F7F5F2;
  --tg-theme-text-color: #37352F;
  --tg-theme-hint-color: #9B9A97;
  --tg-theme-link-color: #00B588;
  --tg-theme-button-color: #00B588;
  --tg-theme-button-text-color: #ffffff;
  --tg-theme-secondary-bg-color: #FFFFFF;
  --tg-theme-header-bg-color: #FFFFFF;
  --tg-theme-section-bg-color: #FFFFFF;
  --tg-theme-section-header-text-color: #00B588;
  --tg-theme-subtitle-text-color: #9B9A97;
  --tg-theme-destructive-text-color: #ff3b30;
}

/* Dark theme support (will be set dynamically from Telegram) */
[data-theme="dark"] {
  --tg-theme-bg-color: #212121;
  --tg-theme-text-color: #ffffff;
  --tg-theme-hint-color: #707579;
  --tg-theme-link-color: #6ab7ff;
  --tg-theme-button-color: #5288c1;
  --tg-theme-button-text-color: #ffffff;
  --tg-theme-secondary-bg-color: #181818;
  --tg-theme-header-bg-color: #212121;
  --tg-theme-section-bg-color: #181818;
  --tg-theme-section-header-text-color: #6ab7ff;
  --tg-theme-subtitle-text-color: #707579;
  --tg-theme-destructive-text-color: #ff453a;
}

/* Safe Area Insets - для поддержки fullscreen режима */
:root {
  --safe-area-inset-top: env(safe-area-inset-top, 0px);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-inset-left: env(safe-area-inset-left, 0px);
  --safe-area-inset-right: env(safe-area-inset-right, 0px);
}

/* Custom Postprocessing Textarea Styles */
textarea {
  scrollbar-width: thin;
  scrollbar-color: rgba(55, 53, 47, 0.2) transparent;
}

textarea::-webkit-scrollbar {
  width: 6px;
}

textarea::-webkit-scrollbar-track {
  background: transparent;
}

textarea::-webkit-scrollbar-thumb {
  background-color: rgba(55, 53, 47, 0.2);
  border-radius: 3px;
}

textarea::-webkit-scrollbar-thumb:hover {
  background-color: rgba(55, 53, 47, 0.3);
}

/* Utility классы для safe area padding */
.safe-area-pt {
  padding-top: max(1rem, calc(env(safe-area-inset-top, 0px) + 1rem));
}

.safe-area-pt-lg {
  padding-top: max(2rem, calc(env(safe-area-inset-top, 0px) + 2rem));
}

.safe-area-pb {
  padding-bottom: max(1rem, calc(env(safe-area-inset-bottom, 0px) + 1rem));
}

.safe-area-px {
  padding-left: max(1.25rem, calc(env(safe-area-inset-left, 0px) + 1.25rem));
  padding-right: max(1.25rem, calc(env(safe-area-inset-right, 0px) + 1.25rem));
}

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

/* Body styles are now handled in index.html inline styles */

/* Hide elements with x-cloak until Alpine is ready */
[x-cloak] {
  display: none !important;
}

/* App container - for swipe gesture feedback */
#app {
  touch-action: pan-y;
  will-change: transform;
}

/* Loading and Error screens are now handled with Tailwind classes in HTML */

/* Buttons are now handled with Tailwind classes in HTML */
/* Keeping button classes for onboarding screens that use them */
.button-primary {
  background: #37352F;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-bottom: 10px;
  box-shadow: 0 2px 12px rgba(55, 53, 47, 0.2);
}

.button-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(55, 53, 47, 0.3);
}

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

.button-secondary {
  background: var(--tg-theme-card);
  color: var(--tg-theme-text-color);
  border: 1px solid var(--tg-theme-border);
  border-radius: 12px;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.button-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

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

/* Form Elements - kept for onboarding screens */
input[type="text"],
input[type="url"],
input[type="password"],
textarea {
  width: 100%;
  padding: 15px;
  font-size: 16px;
  border: 1px solid var(--tg-theme-border);
  border-radius: 12px;
  background: var(--tg-theme-card);
  color: var(--tg-theme-text-color);
  margin-bottom: 10px;
  font-family: inherit;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--tg-theme-button-color);
  box-shadow: 0 0 0 3px rgba(0, 181, 136, 0.1);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Typography - kept for onboarding screens */
h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--tg-theme-text-color);
}

h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--tg-theme-text-color);
}

h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--tg-theme-text-color);
}

p {
  margin-bottom: 12px;
  color: var(--tg-theme-text-color);
}

.text-hint {
  color: var(--tg-theme-hint-color);
  font-size: 14px;
}

.text-link {
  color: var(--tg-theme-link-color);
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

/* Lists */
ul, ol {
  margin-left: 20px;
  margin-bottom: 16px;
  line-height: 1.8;
}

li {
  margin-bottom: 8px;
}

/* Cards/Sections - kept for onboarding screens */
.card {
  background: var(--tg-theme-card);
  border: 1px solid var(--tg-theme-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
}

/* Status Messages - kept for onboarding screens */
.status-success {
  color: #34c759;
}

.status-error {
  color: var(--tg-theme-destructive-text-color);
  background: rgba(255, 59, 48, 0.1);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.status-info {
  color: var(--tg-theme-link-color);
  background: rgba(0, 181, 136, 0.1);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}

/* Spacing Utilities - kept for onboarding screens */
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

/* Flex Utilities - kept for onboarding screens */
.flex-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Screen Container - kept for onboarding screens */
.screen {
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--tg-theme-bg-color);
}

/* Shimmer loading overlay */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(200, 200, 200, 0.1) 25%,
    rgba(200, 200, 200, 0.3) 50%,
    rgba(200, 200, 200, 0.1) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: inherit;
  pointer-events: none;
  z-index: 10;
}
