/**
 * Upgrade Page Styles
 * 
 * Apple-esque design with subtle gradients, clear hierarchy, and elegant aesthetics.
 * Mobile-first, responsive design.
 */

/* Page background with subtle gradient */
body {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  min-height: 100vh;
}

/* Page container */
.upgrade-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
}

/* Professional User Section - Compact Banner */
#pro-user-section {
  margin-bottom: 2rem;
}

.pro-user-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.pro-user-header {
  flex: 1;
}

.pro-user-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.35rem 0;
  color: white;
}

.pro-user-header h2 i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.pro-user-header p {
  font-size: 0.95rem;
  opacity: 0.95;
  margin: 0;
  line-height: 1.4;
}

#manage-subscription-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  color: #667eea;
  border: none;
  padding: 0.625rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  flex-shrink: 0;
}

#manage-subscription-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

#manage-subscription-btn i {
  width: 16px;
  height: 16px;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .pro-user-card {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  
  .pro-user-header h2 {
    justify-content: center;
  }
  
  #manage-subscription-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Top bar with logo and back link */
.upgrade-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.upgrade-top-logo {
  max-height: 40px;
  height: auto;
  width: auto;
  object-fit: contain;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: #1a1a1a;
}

.back-link i {
  width: 18px;
  height: 18px;
}

/* Header */
.upgrade-header {
  text-align: center;
  margin-bottom: 2rem;
}

.upgrade-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: #1a1a1a;
  letter-spacing: -1px;
  line-height: 1.2;
}

.upgrade-header p {
  font-size: 1.15rem;
  color: #6b7280;
  font-weight: 400;
}

/* Billing toggle - aligned above Professional card (right side) */
.billing-toggle-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
  /* Position above the right card only */
  width: 50%;
  margin-left: auto;
}

.billing-toggle {
  position: relative;
  display: inline-flex;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 4px;
  border: 1px solid #e5e7eb;
}

.billing-toggle input[type="radio"] {
  display: none;
}

.billing-option {
  padding: 0.75rem 1.75rem;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  font-size: 0.95rem;
  color: #6b7280;
  z-index: 1;
}

.billing-toggle input[type="radio"]:checked + .billing-option {
  color: white;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.savings-badge {
  display: inline-block;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 0.35rem 0.875rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
  margin-left: 0.5rem;
}

/* Plans grid */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.plan-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 2.5rem;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* Subtle gradient accent bar on top of each card */
.plan-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.plan-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  border-color: #d1d5db;
}

.plan-card:hover::before {
  opacity: 1;
}

.plan-card.current {
  border-color: #667eea;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.12);
}

.plan-card.current::before {
  opacity: 1;
}

.current-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: var(--accent-blue);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.plan-card.featured {
  border-color: var(--accent-blue);
  box-shadow: 0 4px 20px rgba(0, 123, 255, 0.15);
}

.plan-name {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #1a1a1a;
  letter-spacing: -0.5px;
}

.plan-tagline {
  color: #6b7280;
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
  font-weight: 400;
}

.plan-price {
  font-size: 3rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
  letter-spacing: -1.5px;
}

.plan-price .currency {
  font-size: 1.75rem;
  font-weight: 600;
  opacity: 0.8;
}

.plan-price .period {
  font-size: 1.125rem;
  font-weight: 400;
  color: #6b7280;
}

.plan-billing-note {
  font-size: 0.875rem;
  color: #9ca3af;
  margin-bottom: 2rem;
  font-weight: 400;
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
}

.plan-features li {
  padding: 0.875rem 0;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  color: #374151;
  font-size: 0.95rem;
  line-height: 1.6;
  border-bottom: 1px solid #f3f4f6;
}

.plan-features li:last-child {
  border-bottom: none;
}

.plan-features .icon {
  color: #10b981;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.plan-features li.disabled {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.plan-features li.disabled .icon {
  color: var(--text-tertiary);
}

/* Disabled feature style (with X icon) */
.plan-features li.feature-disabled {
  opacity: 0.6;
}

.plan-features li.feature-disabled .icon-disabled {
  color: #9ca3af;
}

.plan-features li.feature-disabled .text-muted {
  color: #9ca3af;
}

/* Feature highlight for special features */
.plan-features li.feature-highlight {
  flex-wrap: wrap;
  align-items: flex-start;
}

.plan-features li.feature-highlight > .icon {
  margin-top: 2px;
}

/* Metrics sublist under advanced features */
.metrics-sublist {
  width: 100%;
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
}

.metrics-sublist li {
  padding: 0.25rem 0.75rem;
  border: none !important;
  font-size: 0.85rem;
  color: #6b7280;
  background: #f3f4f6;
  border-radius: 6px;
  display: inline-block;
}

.metrics-sublist li::before {
  content: "•";
  color: #10b981;
  font-weight: bold;
  margin-right: 0.35rem;
}

.current-plan-badge {
  display: inline-block;
  background: var(--accent-blue);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  text-align: center;
  width: 100%;
}

.upgrade-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 1.125rem 2rem;
  border-radius: 12px;
  font-size: 1.0625rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.upgrade-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(102, 126, 234, 0.4);
}

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

.upgrade-button:disabled {
  background: #9ca3af;
  color: #f3f4f6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Email form */
.email-form {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.email-input {
  padding: 0.875rem 1.25rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: white;
  color: #1a1a1a;
  transition: all 0.2s ease;
}

.email-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.email-input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.email-error {
  color: var(--accent-red);
  font-size: 0.85rem;
  margin-top: -0.5rem;
}

/* Signed-in user email display */
.signed-in-email {
  margin-bottom: 0.5rem;
}

.email-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border: 1px solid #6ee7b7;
  border-radius: 10px;
  color: #065f46;
  font-size: 0.95rem;
}

.email-badge i {
  width: 18px;
  height: 18px;
  color: #059669;
}

/* Sign-in prompt for non-authenticated users */
.sign-in-prompt {
  text-align: center;
  margin-bottom: 0.5rem;
}

.sign-in-message {
  color: #6b7280;
  font-size: 0.95rem;
  margin: 0;
}

/* Promo code section */
.promo-code-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.promo-code-input {
  padding: 0.75rem 1rem;
  border: 2px dashed var(--border-color);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: 'Courier New', monospace;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color 0.2s;
}

.promo-code-input:focus {
  outline: none;
  border-color: var(--accent-green);
  border-style: solid;
}

.promo-code-input::placeholder {
  font-family: inherit;
}

.promo-hint {
  font-size: 0.875rem;
  color: #9ca3af;
  font-style: italic;
  text-align: center;
  margin-top: 0.5rem;
}

/* FAQ section */
.faq-section {
  margin-top: 2rem;
  padding: 2rem 0;
}

.faq-section h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  text-align: center;
  color: #1a1a1a;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.faq-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.faq-item:hover {
  border-color: #d1d5db;
}

.faq-question {
  font-weight: 600;
  font-size: 1.1rem;
  color: #1a1a1a;
  letter-spacing: -0.3px;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  user-select: none;
  transition: background 0.15s ease;
}

.faq-question:hover {
  background: #f9fafb;
}

.faq-question-number {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.faq-question-text {
  flex: 1;
}

.faq-question-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: #9ca3af;
  transition: transform 0.2s ease;
}

.faq-item.open .faq-question-icon {
  transform: rotate(180deg);
}

.faq-answer {
  color: #6b7280;
  line-height: 1.7;
  font-size: 1.05rem;
  padding: 0 1.5rem 1.25rem 4rem;
  display: none;
}

.faq-item.open .faq-answer {
  display: block;
}

.faq-answer p {
  margin: 0 0 0.75rem;
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

/* Success page */
.success-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 4rem 1rem;
  text-align: center;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: var(--accent-green);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  font-size: 3rem;
}

.success-container h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.success-container p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.success-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 300px;
  margin: 0 auto;
}

.primary-button {
  background: var(--accent-blue);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s;
}

.primary-button:hover {
  background: var(--accent-blue-hover);
  transform: translateY(-1px);
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
  to { transform: rotate(360deg); }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .plans-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .upgrade-header h1 {
    font-size: 1.75rem;
  }

  .plan-price {
    font-size: 2rem;
  }

  .billing-toggle-container {
    flex-direction: column;
    align-items: stretch;
  }

  .billing-toggle {
    width: 100%;
  }
}

/* Learn More links */
.learn-more-link {
  font-size: 0.8rem;
  color: #667eea;
  text-decoration: none;
  margin-left: auto;
  padding-left: 0.75rem;
  white-space: nowrap;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.learn-more-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Feature Modal */
.feature-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.feature-modal.open {
  opacity: 1;
  visibility: visible;
}

.feature-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.feature-modal-container {
  position: relative;
  background: white;
  border-radius: 16px;
  max-width: 560px;
  width: calc(100% - 2rem);
  max-height: calc(100vh - 4rem);
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.feature-modal.open .feature-modal-container {
  transform: translateY(0);
}

.feature-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border: none;
  background: #f3f4f6;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 10;
}

.feature-modal-close:hover {
  background: #e5e7eb;
}

.feature-modal-close i {
  width: 20px;
  height: 20px;
  color: #6b7280;
}

.feature-modal-header {
  padding: 2rem 2rem 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.feature-modal-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  margin: 0;
  padding-right: 2rem;
  letter-spacing: -0.5px;
}

.feature-modal-content {
  padding: 1.5rem 2rem 2rem;
  overflow-y: auto;
  max-height: calc(100vh - 12rem);
  color: #374151;
  font-size: 0.95rem;
  line-height: 1.7;
}

.feature-modal-content p {
  margin: 0 0 1rem;
}

.feature-modal-content p:last-child {
  margin-bottom: 0;
}

.feature-modal-content strong {
  color: #1a1a1a;
  font-weight: 600;
}

.feature-modal-content ul,
.feature-modal-content ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}

.feature-modal-content li {
  margin-bottom: 0.5rem;
}

.feature-modal-content em {
  color: #6b7280;
  font-style: italic;
}

.feature-modal-content code {
  background: #f3f4f6;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.875rem;
}

/* Dark theme support */
[data-theme="dark"] {
  --text-primary: #e4e6eb;
  --text-secondary: #b0b3b8;
  --text-tertiary: #8a8d91;
  --bg-primary: #18191a;
  --bg-secondary: #242526;
  --bg-tertiary: #3a3b3c;
  --border-color: #3e4042;
  --accent-blue: #0084ff;
  --accent-blue-hover: #0073e6;
  --accent-green: #31a24c;
  --accent-red: #f02849;
}

[data-theme="dark"] .feature-modal-container {
  background: #242526;
}

[data-theme="dark"] .feature-modal-close {
  background: #3a3b3c;
}

[data-theme="dark"] .feature-modal-close:hover {
  background: #4a4b4c;
}

[data-theme="dark"] .feature-modal-close i {
  color: #b0b3b8;
}

[data-theme="dark"] .feature-modal-content {
  color: #b0b3b8;
}

[data-theme="dark"] .feature-modal-content strong {
  color: #e4e6eb;
}

[data-theme="dark"] .feature-modal-content em {
  color: #8a8d91;
}

[data-theme="dark"] .feature-modal-content code {
  background: #3a3b3c;
  color: #e4e6eb;
}

[data-theme="dark"] .faq-item {
  background: #242526;
  border-color: #3e4042;
}

[data-theme="dark"] .faq-item:hover {
  border-color: #4a4b4c;
}

[data-theme="dark"] .faq-question {
  color: #e4e6eb;
}

[data-theme="dark"] .faq-question:hover {
  background: #3a3b3c;
}

[data-theme="dark"] .faq-answer {
  color: #b0b3b8;
}

/* Upgrade page footer */
.upgrade-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 0;
  margin-top: 2rem;
  font-size: 0.85rem;
  color: #64748b;
}

.upgrade-footer-separator {
  opacity: 0.5;
}

.upgrade-footer a {
  color: #64748b;
  text-decoration: none;
  transition: color 0.15s ease;
}

.upgrade-footer a:hover {
  color: #3b82f6;
}

[data-theme="dark"] .upgrade-footer {
  color: #94a3b8;
}

[data-theme="dark"] .upgrade-footer a {
  color: #94a3b8;
}

[data-theme="dark"] .upgrade-footer a:hover {
  color: #60a5fa;
}

