/* Telegram Web App Styling */
:root {
  --accent-btn-color: #0088cc;
  --tme-logo-color: #000;
  --tgme-color: #000;
  --tgme-background: #fff;
  --tgme-background-secondary: #f1f1f1;
  --tgme-color-secondary: #707579;
  --tgme-color-secondary-strong: #000;
  --tgme-color-link: #0088cc;
  --tgme-color-link-hover: #0077b3;
  --tgme-color-button: #0088cc;
  --tgme-color-button-hover: #0077b3;
  --tgme-color-button-text: #fff;
  --tgme-color-button-secondary: #fff;
  --tgme-color-button-secondary-text: #0088cc;
  --tgme-color-button-secondary-border: #0088cc;
  --tgme-color-button-secondary-hover: #0088cc;
  --tgme-color-button-secondary-hover-text: #fff;
  --tgme-color-button-secondary-hover-border: #0088cc;
  --tgme-color-button-secondary-hover-background: #0088cc;
  --tgme-color-button-secondary-hover-background-hover: #0077b3;
  --tgme-color-button-secondary-hover-background-active: #006699;
  --tgme-color-button-secondary-hover-background-disabled: #ccc;
  --tgme-color-button-secondary-hover-background-disabled-text: #999;
  --tgme-color-button-secondary-hover-background-disabled-border: #ccc;
  --tgme-color-button-secondary-hover-background-disabled-hover: #ccc;
  --tgme-color-button-secondary-hover-background-disabled-active: #ccc;
  --tgme-color-button-secondary-hover-background-disabled-disabled: #ccc;
  --tgme-color-button-secondary-hover-background-disabled-disabled-text: #999;
  --tgme-color-button-secondary-hover-background-disabled-disabled-border: #ccc;
  --tgme-color-button-secondary-hover-background-disabled-disabled-hover: #ccc;
  --tgme-color-button-secondary-hover-background-disabled-disabled-active: #ccc;
  --tgme-color-button-secondary-hover-background-disabled-disabled-disabled: #ccc;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #f1f1f1;
  color: var(--tgme-color);
  line-height: 1.4;
  overflow-x: hidden;
  min-height: 100vh;
}

.no_transition * {
  transition: none !important;
}

/* Background */
.tgme_background_wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  background: linear-gradient(135deg, #6ba587 0%, #88b884 25%, #d5d88d 50%, #dbddbb 75%, #e8f5e8 100%);
}

.tgme_background {
  width: 100%;
  height: 100%;
}

.tgme_background_pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.3;
}

/* Header - Full width top bar */
.tgme_head_wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 1000;
  width: 100%;
}

.tgme_head {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.tgme_head_brand {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tgme_logo {
  height: 28px;
  width: auto;
}

/* Watch Video Section */
.watch-video-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.watch-video-text {
  font-size: 12px;
  color: var(--tgme-color-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
}

.watch-video-text:hover {
  color: var(--tgme-color-link);
}

.play-button {
  background: var(--accent-btn-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.play-button:hover {
  background: var(--tgme-color-button-hover);
  transform: scale(1.1);
}

.play-icon {
  width: 12px;
  height: 12px;
}

/* Video Modal */
.video-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.video-modal-content {
  position: relative;
  margin: 5% auto;
  width: 90%;
  max-width: 800px;
  height: 70%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

.close-button {
  position: absolute;
  top: 15px;
  right: 20px;
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.close-button:hover {
  background: rgba(0, 0, 0, 0.8);
}

.video-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.video-container iframe {
  border-radius: 12px;
  border: none;
  background: #000;
}

/* Fallback for iframe loading issues */
.video-container {
  width: 100%;
  height: 100%;
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-container iframe[src=""] {
  display: none;
}

.video-container iframe[src=""]::after {
  content: 'Loading video...';
  color: white;
  font-size: 16px;
}

/* Main Content - Positioned much higher as per image */
.tgme_page_wrap {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 20px;
  padding-top: 120px; /* Position card much higher */
}

.tgme_page {
  background: var(--tgme-background);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Profile Photo */
.tgme_page_photo {
  margin-bottom: 24px;
}

.tgme_page_photo_image {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.1);
  object-fit: cover;
}

/* Title and Username */
.tgme_page_title {
  font-size: 20px;
  font-weight: 700;
  color: var(--tgme-color-secondary-strong);
  margin-bottom: 4px;
  line-height: 1.3;
}

.tgme_page_extra {
  font-size: 16px;
  color: var(--tgme-color-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

/* Description */
.tgme_page_description {
  font-size: 14px;
  color: var(--tgme-color);
  line-height: 1.5;
  margin-bottom: 32px;
  font-weight: 400;
}

.tgme_page_description a {
  color: var(--tgme-color-link);
  text-decoration: none;
  font-weight: 500;
}

.tgme_page_description a:hover {
  color: var(--tgme-color-link-hover);
  text-decoration: underline;
}

/* Action Buttons */
.tgme_page_action {
  margin-bottom: 12px;
}

.tgme_action_button_new {
  display: inline-block;
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}

.tgme_action_button_new.shine {
  background: var(--tgme-color-button);
  color: var(--tgme-color-button-text);
  box-shadow: 0 2px 8px rgba(0, 136, 204, 0.3);
  position: relative;
  overflow: hidden;
}

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

@keyframes shine {
  0% {
    left: -100%;
  }
  20% {
    left: 100%;
  }
  100% {
    left: 100%;
  }
}

.tgme_action_button_new.shine:hover {
  background: var(--tgme-color-button-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 136, 204, 0.4);
}

.tgme_action_button_new.shine:hover::before {
  animation: none;
  left: 100%;
}

.tgme_action_button_new.tgme_action_web_button {
  background: transparent;
  color: var(--tgme-color-button-secondary-text);
  border: 2px solid var(--tgme-color-button-secondary-border);
}

.tgme_action_button_new.tgme_action_web_button:hover {
  background: var(--tgme-color-button-secondary-hover);
  color: var(--tgme-color-button-secondary-hover-text);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 136, 204, 0.15);
}

.tgme_action_button_label {
  display: block;
}

/* Additional Info */
.tgme_page_additional {
  margin-top: 24px;
  font-size: 13px;
  color: var(--tgme-color-secondary);
  line-height: 1.4;
}

.tgme_page_additional strong {
  color: var(--tgme-color-secondary-strong);
  font-weight: 600;
}

/* Monthly Users */
.monthly-users {
  font-size: 14px;
  color: var(--tgme-color-secondary);
  text-align: center;
  margin-bottom: 8px;
  font-weight: 400;
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
  .tgme_head {
    padding: 12px 16px;
  }
  
  .tgme_logo {
    height: 24px;
  }
  
  .tgme_page_wrap {
    padding: 0 16px;
    padding-top: 80px;
  }
  
  .tgme_page {
    padding: 24px 20px;
    margin: 0;
    max-width: 100%;
    border-radius: 12px;
  }
  
  .tgme_page_photo_image {
    width: 72px;
    height: 72px;
  }
  
  .tgme_page_title {
    font-size: 18px;
    margin-bottom: 3px;
  }
  
  .tgme_page_extra {
    font-size: 15px;
    margin-bottom: 5px;
  }
  
  .monthly-users {
    font-size: 13px;
    margin-bottom: 6px;
  }
  
  .tgme_page_description {
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.4;
  }
  
  .tgme_action_button_new {
    padding: 16px 20px;
    font-size: 16px;
    border-radius: 10px;
  }
  
  .tgme_page_additional {
    font-size: 12px;
    margin-top: 20px;
  }
  
  /* Mobile video modal */
  .video-modal-content {
    margin: 10% auto;
    width: 95%;
    height: 60%;
  }
  
  .close-button {
    top: 10px;
    right: 15px;
    width: 36px;
    height: 36px;
    font-size: 24px;
  }
  
  /* Mobile watch video section */
  .watch-video-section {
    gap: 6px;
    margin-bottom: 6px;
  }
  
  .watch-video-text {
    font-size: 11px;
  }
  
  .play-button {
    width: 20px;
    height: 20px;
  }
  
  .play-icon {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 480px) {
  .tgme_head {
    padding: 10px 12px;
  }
  
  .tgme_logo {
    height: 22px;
  }
  
  .tgme_page_wrap {
    padding: 0 12px;
    padding-top: 70px;
  }
  
  .tgme_page {
    padding: 20px 16px;
    border-radius: 10px;
  }
  
  .tgme_page_photo_image {
    width: 64px;
    height: 64px;
  }
  
  .tgme_page_title {
    font-size: 16px;
    margin-bottom: 2px;
  }
  
  .tgme_page_extra {
    font-size: 14px;
    margin-bottom: 4px;
  }
  
  .monthly-users {
    font-size: 12px;
    margin-bottom: 5px;
  }
  
  .tgme_page_description {
    font-size: 13px;
    margin-bottom: 20px;
  }
  
  .tgme_action_button_new {
    padding: 14px 18px;
    font-size: 15px;
    border-radius: 8px;
  }
  
  .tgme_page_additional {
    font-size: 11px;
    margin-top: 18px;
  }
  
  /* Mobile video modal */
  .video-modal-content {
    margin: 15% auto;
    width: 98%;
    height: 50%;
  }
  
  .close-button {
    top: 8px;
    right: 12px;
    width: 32px;
    height: 32px;
    font-size: 20px;
  }
  
  /* Small mobile watch video section */
  .watch-video-section {
    gap: 5px;
    margin-bottom: 5px;
  }
  
  .watch-video-text {
    font-size: 10px;
  }
  
  .play-button {
    width: 18px;
    height: 18px;
  }
  
  .play-icon {
    width: 9px;
    height: 9px;
  }
}

/* Extra small mobile devices */
@media (max-width: 360px) {
  .tgme_page_wrap {
    padding: 0 8px;
    padding-top: 60px;
  }
  
  .tgme_page {
    padding: 16px 12px;
  }
  
  .tgme_page_photo_image {
    width: 56px;
    height: 56px;
  }
  
  .tgme_page_title {
    font-size: 15px;
  }
  
  .tgme_page_extra {
    font-size: 13px;
  }
  
  .monthly-users {
    font-size: 11px;
  }
  
  .tgme_page_description {
    font-size: 12px;
  }
  
  .tgme_action_button_new {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  /* Extra small mobile watch video section */
  .watch-video-section {
    gap: 4px;
    margin-bottom: 4px;
  }
  
  .watch-video-text {
    font-size: 9px;
  }
  
  .play-button {
    width: 16px;
    height: 16px;
  }
  
  .play-icon {
    width: 8px;
    height: 8px;
  }
}

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
  .tgme_page_wrap {
    padding-top: 60px;
  }
  
  .tgme_page {
    padding: 16px 20px;
  }
  
  .tgme_page_photo_image {
    width: 56px;
    height: 56px;
  }
  
  .tgme_page_title {
    font-size: 16px;
    margin-bottom: 2px;
  }
  
  .tgme_page_extra {
    font-size: 13px;
    margin-bottom: 3px;
  }
  
  .monthly-users {
    font-size: 11px;
    margin-bottom: 4px;
  }
  
  .tgme_page_description {
    font-size: 12px;
    margin-bottom: 16px;
  }
  
  .tgme_action_button_new {
    padding: 12px 18px;
    font-size: 14px;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .play-button {
    min-width: 32px;
    min-height: 32px;
  }
  
  .tgme_action_button_new {
    min-height: 48px;
  }
  
  .close-button {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Mobile touch-friendly overrides */
@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
  .play-button {
    min-width: 24px;
    min-height: 24px;
  }
}

@media (max-width: 480px) and (hover: none) and (pointer: coarse) {
  .play-button {
    min-width: 20px;
    min-height: 20px;
  }
}

@media (max-width: 360px) and (hover: none) and (pointer: coarse) {
  .play-button {
    min-width: 18px;
    min-height: 18px;
  }
}

/* Dark Theme Support */
.theme_dark {
  --tgme-background: #1c1c1c;
  --tgme-background-secondary: #2a2a2a;
  --tgme-color: #fff;
  --tgme-color-secondary: #aaa;
  --tgme-color-secondary-strong: #fff;
  --tgme-color-link: #64baf0;
  --tgme-color-link-hover: #4a9fd8;
}

.theme_dark .tgme_head_wrap {
  background: rgba(28, 28, 28, 0.95);
}

.theme_dark .tgme_page {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Ensure Telegram logo text stays visible in dark mode */
.theme_dark .tgme_logo path[fill="var(--tme-logo-color)"] {
  fill: #fff !important;
}
