/* ===== SECTION-BASED PAYWALL STYLES ===== */
/* For pages with per-section paywalling (learn-advanced, learn-pro) */

/* Locked section styling */
.section-locked[data-requires-sub="true"] {
  position: relative;
  overflow: hidden;
  max-height: 340px;
  transition: max-height 0.5s ease-out, filter 0.3s ease-out;
}
.section-locked[data-requires-sub="true"] > * {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
  transition: filter 0.3s ease-out;
}
.section-locked[data-requires-sub="true"] > .section-pw-overlay {
  filter: none;
  pointer-events: auto;
  user-select: auto;
}

/* Unlocked (by section-paywall.js) */
.section-locked.unlocked,
.section-locked:not([data-requires-sub="true"]) {
  max-height: 10000px;
  overflow: visible;
  filter: none;
  pointer-events: auto;
  user-select: auto;
}
.section-locked.unlocked > *,
.section-locked:not([data-requires-sub="true"]) > * {
  filter: none;
  pointer-events: auto;
  user-select: auto;
}

/* Overlay injected by section-paywall.js */
.section-pw-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(8,12,20,0.1) 0%, rgba(8,12,20,0.6) 30%, var(--bg) 70%);
  text-align: center;
  padding: 24px;
  pointer-events: auto;
  animation: pwOverlayFadeIn 0.4s ease-out both;
}
@keyframes pwOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
body.light .section-pw-overlay {
  background: linear-gradient(180deg, rgba(248,250,252,0.1) 0%, rgba(248,250,252,0.6) 30%, var(--bg) 70%);
}
.section-pw-icon { font-size: 32px; margin-bottom: 10px; opacity: 0.9; }
.section-pw-title { font-size: 17px; font-weight: 700; color: var(--text-l); margin-bottom: 8px; }
.section-pw-desc { font-size: 14px; color: var(--text); margin-bottom: 14px; max-width: 380px; line-height: 1.6; }
.section-pw-prices { font-size: 14px; color: var(--text-m); margin-bottom: 16px; }
.section-pw-prices span { font-weight: 700; color: #f7931a; }
.section-pw-sep { margin: 0 8px; color: var(--text-m); font-weight: 400; }
.section-pw-btn {
  display: inline-block;
  padding: 14px 36px;
  background: linear-gradient(135deg, #f7931a, #e8850f);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, color 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out;
  box-shadow: 0 2px 8px rgba(247, 147, 26, 0.25);
}
.section-pw-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(247, 147, 26, 0.4);
  color: #fff;
  text-decoration: none;
}
.section-pw-btn:active {
  transform: scale(0.97);
}

/* Paywall message boxes */
.paywall-msg {
  background: rgba(247, 147, 26, 0.08);
  border: 1px solid rgba(247, 147, 26, 0.3);
  border-radius: 8px;
  padding: 16px;
  margin: 24px 0;
  font-size: 14px;
  color: var(--text);
  transition: opacity 0.2s ease-out, background 0.2s ease-out;
}

.paywall-msg.success {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.paywall-msg.error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* Subscription badge on pages */
.subscriber-badge {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 32px;
  font-size: 14px;
  color: #86efac;
  display: flex;
  align-items: center;
  gap: 10px;
}

.subscriber-badge::before {
  content: "🔒";
  font-size: 16px;
}

/* Paywall overlay (full-page) */
#paywall-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

#paywall-overlay.active {
  display: flex;
  opacity: 1;
}

/* Paywall panel */
.paywall-panel {
  background: var(--bg-s);
  border: 1px solid var(--brd);
  border-radius: 12px;
  padding: 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: panelSlideUp 0.3s ease-out both;
}

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

.paywall-panel h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-l);
  margin-bottom: 8px;
  margin-top: 0;
}

.paywall-panel p {
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.paywall-panel p:last-of-type {
  margin-bottom: 0;
}

/* Form sections */
.pw-form-group {
  margin-bottom: 16px;
}

.pw-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-l);
  margin-bottom: 6px;
}

.pw-form-group input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--brd);
  border-radius: 6px;
  color: var(--text-l);
  font-size: 14px;
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.pw-form-group input:focus {
  outline: none;
  border-color: #f7931a;
  box-shadow: 0 0 0 3px rgba(247, 147, 26, 0.1);
}

.pw-form-group input::placeholder {
  color: var(--text-m);
}

/* Buttons */
.pw-btn, .pw-plan {
  padding: 14px 36px;
  background: linear-gradient(135deg, #f7931a, #e8850f);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, color 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out;
  width: 100%;
  text-align: center;
  box-shadow: 0 2px 8px rgba(247, 147, 26, 0.25);
}

.pw-btn:hover, .pw-plan:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(247, 147, 26, 0.4);
  color: #fff;
}

.pw-btn:active, .pw-plan:active {
  transform: scale(0.97);
}

.pw-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.pw-btn.secondary {
  background: var(--bg);
  color: var(--text-l);
  border: 1px solid var(--brd-h);
  box-shadow: none;
}

.pw-btn.secondary:hover {
  background: rgba(247, 147, 26, 0.1);
  border-color: #f7931a;
  color: #f7931a;
  transform: translateY(-2px);
  text-decoration: none;
}

/* Messages */
.pw-msg {
  font-size: 13px;
  margin: 16px 0 0;
  text-align: center;
  transition: opacity 0.2s ease-out, color 0.15s ease-out;
}

.pw-msg.error {
  color: #fca5a5;
}

.pw-msg.success {
  color: #86efac;
}

.pw-msg.warning {
  color: #fbbf24;
}

/* Plan cards */
.pw-plans-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}

.pw-plan {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  min-height: 120px;
}

.pw-plan-name {
  font-size: 14px;
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

.pw-plan-price {
  font-size: 18px;
  font-weight: 700;
  color: #f7931a;
  display: block;
}

.pw-plan-period {
  font-size: 12px;
  color: var(--text-m);
  display: block;
}

/* Links */
.pw-link {
  color: #f7931a;
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s ease-out, background 0.15s ease-out;
}

.pw-link:hover {
  color: #e8850f;
  text-decoration: underline;
}

/* Timer */
#pw-timer {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 12px;
  color: #f7931a;
  font-weight: 600;
  background: rgba(247, 147, 26, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  display: none;
}

/* Divider */
.pw-divider {
  height: 1px;
  background: var(--brd);
  margin: 16px 0;
}

/* Responsive */
@media (max-width: 768px) {
  .paywall-panel {
    max-width: 90%;
    padding: 28px;
  }

  .pw-plans-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .section-pw-desc {
    max-width: 280px;
    font-size: 13px;
  }

  .section-pw-btn {
    padding: 10px 24px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .paywall-panel {
    padding: 24px;
    max-width: 100%;
    margin: 16px;
  }

  .paywall-panel h2 {
    font-size: 20px;
  }

  .paywall-panel p {
    font-size: 13px;
  }

  .pw-plans-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .pw-plan {
    min-height: 100px;
    padding: 16px 12px;
  }

  .pw-plan-name {
    font-size: 13px;
  }

  .pw-plan-price {
    font-size: 16px;
  }

  .pw-btn, .pw-plan {
    padding: 9px 14px;
    font-size: 12px;
  }
}
