/* Upgrade Modal Styles */
.upgrade-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.upgrade-modal-overlay.active {
  display: block;
  opacity: 1;
}

.upgrade-modal {
  position: fixed;
  top: 47%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  border-radius: 16px;
  width: 850px;
  height: 690px;
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Dark theme background */
:root[data-theme="dark"] .upgrade-modal {
  background: #040404;
  border: 1px solid #1f1f1f;
}

:root[data-theme="dark"] .upgrade-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(0, 123, 255, 0.06) 0%, transparent 40%),
    radial-gradient(ellipse at 80% 70%, rgba(138, 43, 226, 0.05) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 90%, rgba(255, 140, 0, 0.03) 0%, transparent 35%);
  pointer-events: none;
  z-index: 0;
}

:root[data-theme="dark"] .upgrade-modal-header,
:root[data-theme="dark"] .upgrade-modal-body {
  position: relative;
  z-index: 1;
}

/* Light theme background */
:root[data-theme="light"] .upgrade-modal {
  background: #fff;
}

.upgrade-modal.active {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.upgrade-modal-header {
  position: sticky;
  top: 0;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
  border-radius: 16px 16px 0 0;
  position: relative;
}

/* Dark theme header */
:root[data-theme="dark"] .upgrade-modal-header {
  background: #04040400;
}

/* Light theme header */
:root[data-theme="light"] .upgrade-modal-header {
  background: #fff;
}

.upgrade-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background-color 0.2s ease;
  position: absolute;
  top: 12px;
  right: 20px;
}

.upgrade-modal-close:hover {
  background-color: var(--hover-bg);
}

.upgrade-modal-close .close-icon {
  font-size: 24px;
}

:root[data-theme="dark"] .upgrade-modal-close .close-icon {
  color: #fff;
}

:root[data-theme="light"] .upgrade-modal-close .close-icon {
  color: #1c58e5;
}

.upgrade-modal-body {
  padding: 0 24px 0px;
  height: calc(100% - 100px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Upgrade Content */
.upgrade-content {
  text-align: center;
}

.upgrade-modal-header .upgrade-title {
  font-size: 24px;
  font-weight: 700;
  margin-top: 16px;
  color: var(--text-primary);
}

:root[data-theme="light"] .upgrade-modal-header .upgrade-title {
  color: #000;
}

.upgrade-modal-header .upgrade-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 4px 0 16px 0;
}

.upgrade-title {
  font-size: 24px;
  font-weight: 700;
  margin-top: 0;
  color: var(--text-primary);
  margin-bottom: 6px;
}

:root[data-theme="light"] .upgrade-title {
  color: #000;
}

.upgrade-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Billing Toggle */
.billing-toggle-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
}

.billing-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
  transition: background .18s cubic-bezier(.2,.9,.2,1), box-shadow .18s;
  cursor: pointer;
}

:root[data-theme="light"] .billing-toggle {
  background: rgba(0,0,0,0.12);
}

.billing-toggle.active {
  background: linear-gradient(90deg, #0a84ff, #007aff);
}

.billing-toggle-slider {
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.28);
  transition: transform .18s cubic-bezier(.2,.9,.2,1);
}

.billing-toggle.active .billing-toggle-slider {
  transform: translateY(-50%) translateX(18px);
}

.billing-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.billing-label.active {
  color: var(--text-primary);
  font-weight: 600;
}

/* Pricing Plans */
.pricing-plans {
  display: grid;
  grid-template-columns: 340px 340px;
  gap: 24px;
  max-width: 800px;
  margin: 40px auto;
  justify-content: center;
}

.pricing-card {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
  position: relative;
}

.pricing-card:hover {
  border-color: var(--primary-blue);
  transform: translateY(-4px);
  /* Reduced bottom shadow to match top glow more closely */
  box-shadow: 0 8px 16px rgba(0, 123, 255, 0.1),
              0 0 20px rgba(0, 123, 255, 0.1),
              0 -8px 16px rgba(0, 123, 255, 0.1);
}

.pricing-card.featured {
  border: 1px solid #0a378b45 !important;
  background: linear-gradient(135deg, rgba(0, 123, 255, 0.05) 0%, rgba(0, 123, 255, 0.02) 100%);
  min-height: 480px;
  min-width: 390px;
  margin-top: -25px;
}

.pricing-badge {
  position: absolute;
  top: -12px;
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  padding: 4px 16px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.plan-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.plan-name-icon {
  font-size: 20px;
  color: #3b82f6;
}

.plan-description {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* Hide plan descriptions everywhere except on mobile to keep modal compact */
.plan-description {
  display: none;
}

.plan-price {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1;
}

.plan-price .currency {
  font-size: 22px;
  vertical-align: super;
}

.plan-price-period {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 26px 0;
  width: 100%;
}

.plan-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 14px;
  color: var(--text-primary);
}

.plan-feature-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.plan-feature-icon.included {
  color: #10b981;
}

.plan-feature-icon.excluded {
  color: #ef4444;
}

/* Unlock Pro Button with Animated Gradient */
.unlock-button {
  width: 100%;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: visible;
}

.unlock-button.primary {
  background: var(--primary-blue);
  color: white;
}

.unlock-button.primary:hover {
  background: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 123, 255, 0.3);
}

.unlock-button.secondary {
  background: var(--hover-bg);
  color: var(--text-primary);
}

:root[data-theme="dark"] .unlock-button.secondary {
  border: 1px solid #272727
}

:root[data-theme="light"] .unlock-button.secondary {
  border: 1px solid #d3d3d3
}

.unlock-button.secondary:hover {
  background: var(--border-color);
  transform: translateY(-2px);
}

/* Animated Gradient Effect for Featured Button */
.unlock-button.gradient {
  background: linear-gradient(135deg, #1e1e24 10%, #050505 60%);
  color: white;
  position: relative;
  z-index: 1;
  animation: gradient-shift 5s ease-in-out infinite;
  background-size: 200% 200%;
}

.unlock-button.gradient::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  width: calc(100% + 6px);
  height: calc(100% + 6px);
  background: radial-gradient(circle at 0 0, hsl(27deg 93% 60% / 0.4), transparent),
    radial-gradient(circle at 100% 0, rgba(0, 166, 255, 0.4), transparent),
    radial-gradient(circle at 0 100%, rgba(255, 0, 86, 0.4), transparent),
    radial-gradient(circle at 100% 100%, rgba(101, 0, 255, 0.4), transparent);
  z-index: -2;
  border-radius: 8px;
  filter: blur(12px);
  animation: blur-animation 3s ease-in-out alternate infinite;
}

.unlock-button.gradient::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  background: radial-gradient(circle at 0 0, hsl(27deg 93% 60%), transparent),
    radial-gradient(circle at 100% 0, #00a6ff, transparent),
    radial-gradient(circle at 0 100%, #ff0056, transparent),
    radial-gradient(circle at 100% 100%, #6500ff, transparent);
  z-index: -1;
  border-radius: 8px;
}

@keyframes blur-animation {
  to {
    filter: blur(16px);
    transform: scale(1.03);
  }
}

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .upgrade-modal {
    width: 100%;
    height: 100%;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
  }

  .upgrade-modal.active {
    transform: none;
  }

  .upgrade-modal-header {
    border-radius: 0;
  }

  .upgrade-modal-body {
    padding: 0px 16px 20px;
    height: calc(100% - 160px);
    overflow-y: auto;
    overflow-x: hidden;
  }

  .upgrade-title {
    font-size: 24px;
  }

  .upgrade-subtitle {
    font-size: 13px;
  }

  .pricing-plans {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  /* На мобилках Pro план сверху */
  .pricing-card.pro-card {
    order: -1;
  }
  
  .pricing-card.trial-card {
    order: 1;
  }

  .plan-price {
    font-size: 36px;
  }

  .pricing-card.featured {
    min-width: 320px;
    margin-top: 19px;
  }
}

/* Dark Theme Overrides */
:root[data-theme="dark"] {
  --upgrade-modal-bg: #1a1a1a;
}

/* Light Theme Overrides */
:root[data-theme="light"] {
  --upgrade-modal-bg: #ffffff;
}

/* Tablet-specific: compact modal for laptops */
@media (min-width: 769px) and (max-width: 1400px) {
  .upgrade-modal {
    width: 600px;
    height: auto;
    max-height: 95vh;
    top: 48%;
    transform: translate(-50%, -48%);
  }

  .upgrade-modal-body {
    padding: 8px 20px 24px; /* a bit more vertical breathing room */
    height: auto;
    overflow: visible;
  }

  .upgrade-modal-header {
    padding-top: 10px;
  }

  .upgrade-modal-header .upgrade-title {
    font-size: 16px;
    margin-top: 12px;
  }

  .upgrade-modal-header .upgrade-subtitle {
    font-size: 12px;
    margin: 4px 0 12px 0;
  }

  .billing-toggle-container {
    margin-bottom: 12px;
  }

  .pricing-plans {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 20px auto;
    max-width: 100%;
  }

  .pricing-card {
    padding: 16px 14px;
    align-items: flex-start;
  }

  .pricing-card.featured {
    min-height: auto;
    min-width: auto;
    margin-top: -15px;
  }
  .pricing-card.featured {
    min-height: auto;
    min-width: auto;
    margin-top: -15px;
  }

  /* On medium screens, hide less important Free plan features to simplify UI */
  .pricing-plans .pricing-card:first-child .plan-features .plan-feature:nth-child(4),
  .pricing-plans .pricing-card:first-child .plan-features .plan-feature:nth-child(5) {
    display: none;
  }

  /* Set Free plan feature font-size to 12px on medium screens */
  .pricing-plans .pricing-card:first-child .plan-feature {
    font-size: 12px;
  }

  /* Hide specific Pro plan features (API access, Email notifications, Export, Portfolio) */
  .pricing-plans .pricing-card.featured .plan-features .plan-feature:nth-child(6),
  .pricing-plans .pricing-card.featured .plan-features .plan-feature:nth-child(7),
  .pricing-plans .pricing-card.featured .plan-features .plan-feature:nth-child(8),
  .pricing-plans .pricing-card.featured .plan-features .plan-feature:nth-child(9) {
    display: none;
  }

  /* Pro plan feature font-size to 12px on medium screens */
  .pricing-card.featured .plan-feature {
    font-size: 12px;
  }

  .plan-name {
    font-size: 14px;
    margin-top: 25px;
  }

  /* Center the badge on medium screens */
  .pricing-badge {
    left: 50%;
    transform: translateX(-50%);
  }

  .plan-description {
    font-size: 11px;
    margin-bottom: 8px;
  }

  .plan-price {
    font-size: 28px;
    text-align: center;
  }

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

  .plan-price-period {
    font-size: 11px;
    margin-bottom: 20px;
    text-align: center;
  }

  .plan-features {
    margin-bottom: 22px;
  }

  .plan-feature {
    padding: 3px 0;
    font-size: 11px;
  }

  .plan-feature-icon {
    font-size: 14px;
  }

  .unlock-button {
    padding: 10px 20px;
    font-size: 13px;
  }
}
