/* ============================================
   TELEGRAM AUTH MODAL - Изолированные стили
   Префикс: tg-auth- | v1.0
============================================ */

.tg-auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), visibility 0.3s;
  pointer-events: none;
}

.tg-auth-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.tg-auth-box {
  background: rgba(12, 12, 14, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 140, 66, 0.2);
  border-radius: 24px;
  padding: 32px 28px;
  max-width: 380px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 140, 66, 0.1);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  z-index: 9999;
}

.tg-auth-overlay.show .tg-auth-box {
    transform: translateY(0) scale(1);
}

.tg-auth-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 140, 66, 0.1);
}

.tg-auth-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #f0f0f0;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.tg-auth-icon {
  font-size: 26px;
  display: inline-block;
  transform: translateY(-2px);
}

.tg-auth-close-btn {
  background: transparent;
  border: none;
  color: #888;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.tg-auth-close-btn:hover {
  background: rgba(255, 140, 66, 0.15);
  color: #FF8C42;
}

.tg-auth-close-btn:active {
  transform: scale(0.9);
}

.tg-auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 12px;
}

.tg-auth-tab {
  flex: 1;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: #aaa;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.tg-auth-tab.active {
  background: linear-gradient(135deg, #FF8C42 0%, #FFB347 100%);
  color: #111;
  box-shadow: 0 4px 12px rgba(255, 140, 66, 0.2);
}

.tg-auth-content {
  display: none;
}

.tg-auth-content.active {
  display: block;
  animation: tgAuthFadeIn 0.4s ease;
}

@keyframes tgAuthFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tg-auth-section {
  margin-bottom: 20px;
}

.tg-auth-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #ccc;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tg-auth-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #333;
  border-radius: 10px;
  color: #f0f0f0;
  font-size: 16px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  letter-spacing: 2px;
  text-align: center;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

.tg-auth-input:focus {
  outline: none;
  border-color: rgba(255, 140, 66, 0.5);
  background: #111;
  box-shadow: 0 0 12px rgba(255, 140, 66, 0.2);
}

.tg-auth-input::placeholder {
  color: #666;
  letter-spacing: 2px;
}

.tg-auth-code-input {
  letter-spacing: 8px;
  font-size: 18px;
  font-weight: 700;
}

.tg-auth-steps {
  background: rgba(255, 140, 66, 0.05);
  border-left: 3px solid #FF8C42;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}

.tg-auth-step {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.5;
  color: #bbb;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tg-auth-step:last-child {
  margin-bottom: 0;
}

.tg-auth-step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #FF8C42 0%, #FFB347 100%);
  color: #111;
  border-radius: 50%;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.tg-auth-step-content {
  flex: 1;
}

.tg-auth-step-title {
  font-weight: 700;
  color: #f0f0f0;
  margin-bottom: 4px;
  display: block;
}

.tg-auth-button {
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 46px;
  -webkit-tap-highlight-color: transparent;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  box-sizing: border-box;
}

.tg-auth-button-primary {
  background: linear-gradient(135deg, #FF8C42 0%, #FFB347 100%);
  color: #111;
  box-shadow: 0 6px 20px rgba(255, 140, 66, 0.3);
}

.tg-auth-button-primary:hover {
    filter: brightness(1.1);
}

.tg-auth-button-primary:active {
  transform: scale(0.96);
  box-shadow: 0 3px 10px rgba(255, 140, 66, 0.2);
}

.tg-auth-button-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  filter: none;
  box-shadow: none;
}

.tg-auth-button-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #FF8C42;
  border: 1px solid rgba(255, 140, 66, 0.2);
}

.tg-auth-button-secondary:hover {
  background: rgba(255, 140, 66, 0.1);
}

.tg-auth-button-secondary:active {
  background: rgba(255, 140, 66, 0.15);
  transform: scale(0.96);
}

.tg-auth-divider {
  text-align: center;
  margin: 16px 0;
  font-size: 13px;
  color: #555;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
}

.tg-auth-tg-button {
  width: 100%;
  padding: 12px 20px;
  background: #0088cc;
  color: white;
  border: none;
  border-radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  min-height: 46px;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  box-sizing: border-box;
}

.tg-auth-tg-button:hover {
  filter: brightness(1.1);
}

.tg-auth-tg-button:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.tg-auth-hint {
  background: rgba(255, 140, 66, 0.05);
  border-left: 3px solid #FF8C42;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #bbb;
  margin-bottom: 24px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tg-auth-hint strong {
  color: #FF8C42;
  font-weight: 700;
}

.tg-auth-success {
  text-align: center;
  padding: 20px 0;
}

.tg-auth-success-icon {
  font-size: 56px;
  margin-bottom: 16px;
  display: block;
  animation: tgAuthSuccessPulse 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes tgAuthSuccessPulse {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.tg-auth-success-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #f0f0f0;
  margin: 0 0 10px 0;
}

.tg-auth-success-text {
  font-size: 14px;
  color: #aaa;
  line-height: 1.6;
  margin: 0 0 16px 0;
}

.tg-auth-success-nick {
  background: rgba(255, 140, 66, 0.1);
  border: 1px solid rgba(255, 140, 66, 0.2);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  color: #FF8C42;
  margin-bottom: 20px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  word-break: break-all;
  display: inline-block;
}

.tg-auth-error {
  background: rgba(255, 68, 68, 0.1);
  border-left: 3px solid #ff4444;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: #ff9999;
  margin-top: -10px;
  margin-bottom: 16px;
  display: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
}

.tg-auth-error.show {
  display: block;
  animation: tgAuthShake 0.4s ease;
}

@keyframes tgAuthShake {
  0%, 100% { transform: translateX(0); }
  10%, 50%, 90% { transform: translateX(-6px); }
  30%, 70% { transform: translateX(6px); }
}

.tg-auth-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tgAuthSpin 0.8s linear infinite;
  margin-right: 8px;
}

.tg-auth-button-primary .tg-auth-spinner {
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-top-color: #000;
}


@keyframes tgAuthSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .tg-auth-box {
    padding: 24px 20px;
    border-radius: 20px;
    max-width: calc(100% - 20px);
    width: calc(100% - 20px);
  }

  .tg-auth-title {
    font-size: 20px;
  }

  .tg-auth-icon {
    font-size: 24px;
  }

  .tg-auth-button {
    font-size: 14px;
    padding: 12px 16px;
    min-height: 44px;
  }

  .tg-auth-input {
    font-size: 15px;
    padding: 10px 14px;
  }

  .tg-auth-code-input {
    letter-spacing: 5px;
    font-size: 16px;
  }
}
