/* Skool Clean Premium Design Tokens */
:root {
  --bg-page: #F8F7F5;
  --bg-card: #FFFFFF;
  --text-main: #202124;
  --text-muted: #909090;
  
  /* Skool Palette */
  --skool-blue: #2E6EF5;
  --skool-blue-hover: #1A56D4;
  --skool-yellow: #F8D481;
  --skool-yellow-hover: #F1D07C;
  --skool-red: #D3513E;
  --border-color: #E4E4E4;
  
  --font-heading: 'IBM Plex Sans', sans-serif;
  --font-body: 'Roboto', 'Inter', sans-serif;
  
  --radius-card: 10px;
  --radius-btn: 4px;
  --transition: all 0.2s ease-in-out;
}

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
  width: 100%;
}

/* Screen Reader Only Utility for SEO */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

a {
  color: var(--skool-blue);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  text-decoration: underline;
}

/* --- Navigation Bar --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  z-index: 200;
  display: flex;
  align-items: center;
}

.nav-container {
  width: 100%;
  max-width: 1085px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
}

.nav-logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 18px;
}

.nav-logo-link:hover {
  text-decoration: none;
}

.group-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: var(--border-color);
}

.group-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.btn-login {
  background-color: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-btn);
  height: 40px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition);
}

.btn-login:hover {
  color: var(--text-main);
  border-color: var(--text-main);
}

/* --- Main Layout --- */
.main-wrapper {
  padding-top: 64px; /* Offset navbar */
  min-height: 100vh;
}

.content-container {
  width: 100%;
  max-width: 1085px;
  margin: 0 auto;
  padding: 32px 16px;
  display: grid;
  grid-template-columns: 1fr 273px;
  gap: 32px;
  align-items: start;
}

/* Common Card Style */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 24px 18px 20px 18px;
}

/* --- Left Column: Main Info --- */
.left-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.main-title {
  font-family: var(--font-body);
  font-size: 23px;
  font-weight: bold;
  color: var(--text-main);
  margin-bottom: 12px;
}

/* Media Player & Gallery */
.media-viewer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.media-active-viewport {
  position: relative;
  width: 100%;
  margin: 0 auto;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  border-radius: 10px;
  overflow: hidden;
  background-color: #000000;
}

.media-player-frame,
.media-player-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  object-fit: cover;
}

.gallery-scroll {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
}

.gallery-scroll::-webkit-scrollbar {
  display: none; /* WebKit */
}

.gallery-thumbnails {
  display: flex;
  gap: 8px;
  padding: 4px 2px;
}

.thumbnail-btn {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Active Thumbnail Outline border styling matching Skool */
.thumbnail-btn.active::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 3px solid var(--text-main);
  border-radius: 10px;
  pointer-events: none;
}

.play-icon-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  border-radius: 10px;
}

/* Metadata row */
.group-meta-info {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 16px;
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-main);
}

.meta-owner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.owner-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.owner-name {
  color: var(--text-main);
}

.owner-name:hover {
  text-decoration: none;
}

.badges {
  margin-left: 2px;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 16px 0;
}

/* Rich Description Content styling */
.about-description-content {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-main);
}

.about-description-content p {
  margin-bottom: 12px;
}

.about-description-content h3 {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: bold;
  margin-top: 24px;
  margin-bottom: 12px;
}

.about-description-content ul {
  list-style: none;
  padding: 0;
  margin-bottom: 16px;
}

.about-description-content ul li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.highlight-box {
  margin-bottom: 4px !important;
}

.red-bold {
  color: var(--skool-red);
  font-weight: bold;
}

.footer-cta {
  font-size: 18px;
  margin-top: 24px;
  margin-bottom: 4px !important;
}

.footer-cta-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px !important;
}

.privacy-terms-row {
  margin-top: 16px;
  padding-left: 18px;
}

.privacy-link {
  font-size: 14px;
  color: var(--text-muted);
}

/* --- Right Column: Sidebar --- */
.sticky-sidebar {
  position: sticky;
  top: 96px; /* navbar (64px) + gap */
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-card {
  padding: 0;
  overflow: hidden;
}

.sidebar-cover {
  width: 100%;
  height: 144px;
  background-size: cover;
  background-position: center;
  background-color: var(--border-color);
}

.sidebar-body {
  padding: 16px;
}

.sidebar-group-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 4px;
}

.sidebar-group-url {
  font-size: 13px;
  font-weight: bold;
  color: var(--text-muted);
  margin-bottom: 12px;
  word-break: break-all;
}

.sidebar-group-desc {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-main);
  margin-bottom: 16px;
}

/* Stats panel */
.sidebar-stats {
  display: flex;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 0;
  margin-bottom: 16px;
}

.sidebar-stats > * {
  flex: 1 1 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px 0;
}

.stat-value {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-main);
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* CTA join button */
.btn-join-group {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  background-color: var(--skool-yellow);
  color: var(--text-main);
  border: none;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.32), 0px 2px 6px rgba(60, 64, 67, 0.15), 0px 1px 8px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
}

.btn-join-group:hover {
  background-color: var(--skool-yellow-hover);
}

.inline-join-btn {
  display: none;
}


/* --- Stripe Modal Overlay (Drawer / Centered Card) --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: flex-end; /* Mobile bottom drawer */
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 480px;
  background-color: #ffffff;
  color: #111827;
  border-top: 3px solid var(--skool-yellow);
  border-radius: 12px 12px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.2s cubic-bezier(0.32, 0.94, 0.6, 1);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

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

.checkout-product-preview {
  display: flex;
  align-items: center;
  gap: 12px;
}

.checkout-preview-box {
  width: 44px;
  height: 44px;
  background: #F8F7F5;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-emoji {
  font-size: 1.4rem;
}

.checkout-product-title {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  color: #111827;
}

.checkout-product-price {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.close-button {
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
}

.close-button:hover {
  color: #111827;
}

/* Stripe form components */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  color: #6b7280;
  font-size: 0.85rem;
  gap: 12px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3.5px solid #f3f4f6;
  border-radius: 50%;
  border-top-color: var(--skool-blue);
  animation: spin 0.8s linear infinite;
}

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

.price-line {
  display: flex;
  align-items: baseline;
  margin-bottom: 18px;
  margin-top: 4px;
}

.price-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #6b7280;
}

.price-dots {
  flex-grow: 1;
  border-bottom: 1.5px dotted #e5e7eb;
  margin: 0 8px;
  height: 4px;
}

.price-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
}

/* Purchase button styling matching Skool CTA */
.btn-purchase {
  width: 100%;
  background-color: var(--skool-yellow);
  color: var(--text-main);
  border: none;
  padding: 16px;
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: var(--transition);
  margin-top: 12px;
  box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.32), 0px 2px 6px rgba(60, 64, 67, 0.15);
}

.btn-purchase:hover:not(:disabled) {
  background-color: var(--skool-yellow-hover);
}

.btn-purchase:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* --- Full Screen Success Overlay --- */
.success-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.success-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.success-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  color: var(--text-main);
}

.success-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  max-width: 320px;
  margin-bottom: 32px;
  line-height: 1.45;
}

.btn-success-done {
  background-color: var(--text-main);
  color: #ffffff;
  border: none;
  padding: 16px 32px;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: var(--transition);
}

.btn-success-done:hover {
  opacity: 0.9;
}

/* Success Checkmark Animation */
.success-checkmark {
  width: 54px;
  height: 54px;
  margin-bottom: 24px;
}

.success-checkmark .check-icon {
  width: 54px;
  height: 54px;
  position: relative;
  border-radius: 50%;
  box-sizing: content-box;
  border: 3px solid var(--skool-blue);
}

.success-checkmark .check-icon::before, .success-checkmark .check-icon::after {
  content: '';
  height: 80px;
  position: absolute;
  background: #ffffff;
  transform: rotate(-45deg);
}

.success-checkmark .check-icon::before {
  top: 3px;
  left: -2px;
  width: 25px;
  transform-origin: 100% 50%;
  border-radius: 100px 0 0 100px;
}

.success-checkmark .check-icon::after {
  top: 0;
  left: 20px;
  width: 50px;
  transform-origin: 0 50%;
  border-radius: 0 100px 100px 0;
}

.success-checkmark .check-icon .icon-line {
  height: 4px;
  background-color: var(--skool-blue);
  display: block;
  border-radius: 2px;
  position: absolute;
  z-index: 10;
}

.success-checkmark .check-icon .icon-line.line-tip {
  top: 32px;
  left: 9px;
  width: 16px;
  transform: rotate(45deg);
  animation: icon-line-tip 0.6s;
}

.success-checkmark .check-icon .icon-line.line-long {
  top: 26px;
  right: 5px;
  width: 32px;
  transform: rotate(-45deg);
  animation: icon-line-long 0.6s;
}

.success-checkmark .check-icon .icon-circle {
  top: -3px;
  left: -3px;
  position: absolute;
  z-index: 10;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid rgba(46, 110, 245, 0.2);
  box-sizing: content-box;
}

.success-checkmark .check-icon .icon-fix {
  top: 6px;
  left: 18px;
  width: 5px;
  height: 65px;
  position: absolute;
  z-index: 1;
  background-color: #ffffff;
  transform: rotate(-45deg);
}

@keyframes icon-line-tip {
  0% { width: 0; left: 1px; top: 15px; }
  54% { width: 0; left: 1px; top: 15px; }
  70% { width: 34px; left: -6px; top: 25px; }
  84% { width: 12px; left: 12px; top: 34px; }
  100% { width: 16px; left: 9px; top: 32px; }
}

@keyframes icon-line-long {
  0% { width: 0; right: 30px; top: 35px; }
  65% { width: 0; right: 30px; top: 35px; }
  84% { width: 38px; right: 0px; top: 23px; }
  100% { width: 32px; right: 5px; top: 26px; }
}

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

/* Confetti particles */
.confetti {
  position: fixed;
  width: 6px;
  height: 6px;
  z-index: 400;
  opacity: 0.85;
  pointer-events: none;
}

/* --- Developer Settings panel --- */
.config-trigger {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 150;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  opacity: 0.2;
  font-size: 1.2rem;
  transition: var(--transition);
}

.config-trigger:hover {
  opacity: 0.8;
}

.config-panel {
  display: none;
  position: fixed;
  bottom: 50px;
  right: 16px;
  z-index: 150;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-card);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  font-size: 0.85rem;
}

.config-panel.open {
  display: block;
  animation: slideUpPanel 0.2s ease;
}

.config-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.config-row label {
  color: var(--text-muted);
}

@keyframes slideUpPanel {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Powered by Skool */
.powered-by-skool-container {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  width: 100%;
}

.powered-by-skool {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted) !important;
  font-size: 13px;
  font-weight: 500;
}

.powered-by-skool:hover {
  text-decoration: none !important;
  color: var(--text-main) !important;
}

.powered-by-skool svg {
  height: 12px;
  width: auto;
}

/* Navbar Back Button */
.nav-back-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-main);
  margin-right: 8px;
  border-radius: 50%;
  transition: var(--transition);
}

.nav-back-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Mobile Footer Links */
.mobile-footer {
  display: none;
}

/* --- Responsive Media Queries --- */
@media (max-width: 900px) {
  body {
    padding-bottom: 0;
    background-color: var(--bg-card); /* Match white background on mobile for edge-to-edge cards */
    width: 100%;
  }

  .navbar {
    height: 52px;
  }

  .main-wrapper {
    padding-top: 52px;
  }

  .content-container {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0;
    width: 100%;
    overflow: hidden;
  }

  .left-column {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  /* Hide right column completely on mobile */
  .right-column {
    display: none !important;
  }

  /* Make cards edge-to-edge on mobile with matching navbar padding */
  .card {
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 16px 13px 32px 13px;
    width: 100%;
    max-width: 100%;
  }

  .main-title {
    font-size: 20px;
    line-height: 30px;
    margin-bottom: 16px;
  }

  /* Navbar responsiveness on mobile to prevent horizontal overflow */
  .nav-container {
    padding: 0 12px;
  }

  .group-logo {
    width: 24px;
    height: 24px;
    border-radius: 5px;
  }

  .nav-logo-link {
    gap: 8px;
    font-size: 16px;
  }

  .group-name {
    max-width: 130px;
  }

  .btn-login {
    padding: 0 12px;
    height: 40px;
    font-size: 16px;
    font-weight: 700;
  }
  
  .nav-back-btn {
    display: flex;
    width: 40px;
    height: 40px;
    margin-right: 8px;
  }

  .nav-dropdown-trigger {
    display: none !important;
  }
  
  .media-active-viewport {
    width: 100%;
    max-width: 100%;
  }

  .gallery-scroll {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .thumbnail-btn {
    width: 60px;
    height: 60px;
  }

  .gallery-thumbnails {
    padding: 4px 0px;
    gap: 8px;
  }

  .group-meta-info {
    display: flex;
    flex-wrap: wrap;
    margin: 24px 0;
    gap: 16px 0;
  }

  .meta-item {
    flex: 0 0 50%;
    font-size: 14px;
    font-weight: 700;
    gap: 8px;
  }

  .meta-icon,
  .owner-avatar {
    width: 20px;
    height: 20px;
  }

  .inline-join-btn {
    display: flex;
    height: 40px;
    font-size: 14px;
    font-weight: 700;
    margin: 24px 0;
  }

  .section-divider {
    display: none;
  }

  /* Hide desktop privacy terms on mobile */
  .privacy-terms-row {
    display: none !important;
  }

  /* Mobile Footer */
  .mobile-footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 16px;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    width: 100%;
    margin-top: 24px;
  }

  .mobile-footer .powered-by-skool-container {
    margin-top: 0;
    width: auto;
  }

  .mobile-footer-links {
    display: flex;
    align-items: center;
  }

  .mobile-footer .privacy-link {
    font-size: 14px;
    color: var(--text-muted);
  }
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center; /* Center on desktop */
  }
  
  .modal-content {
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--skool-yellow);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  }
}
