/* ========================================
   Payment Modal - Embedded Stripe Checkout
   ======================================== */

.payment-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.payment-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease-out;
}

.payment-modal-content {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
  z-index: 1;
}

.payment-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e5e5;
  background: #fafafa;
}

.payment-modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.payment-modal-title i {
  color: #50ca59;
  font-size: 24px;
}

.payment-modal-close {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  color: #666;
  font-size: 24px;
  transition: all 0.2s ease;
  outline: none;
  flex-shrink: 0;
  position: relative;
  visibility: visible;
  opacity: 1;
  margin-left: auto;
}

.payment-modal-close i {
  font-size: inherit;
  line-height: 1;
  display: block;
  visibility: visible;
  opacity: 1;
  color: inherit;
}

.payment-modal-close:hover {
  background: #e5e5e5;
  color: #333;
}

.payment-modal-body {
  padding: 24px;
  max-height: calc(90vh - 80px);
  overflow-y: auto;
}

/* Stripe checkout container (legacy) */
#stripe-checkout-container {
  min-height: 400px;
}

/* Subscription Summary */
.subscription-summary {
  background: transparent;
  border-radius: 0;
  padding: 0 0 20px 0;
  margin-bottom: 20px;
  border: none;
  border-bottom: 1px solid #e5e5e5;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}

.summary-item:not(:last-child) {
  border-bottom: 1px solid #e5e5e5;
}

.summary-label {
  font-size: 15px;
  color: #666;
  font-weight: 500;
}

.summary-value {
  font-size: 15px;
  color: #333;
  font-weight: 600;
}

.summary-total {
  margin-top: 0;
  padding-top: 10px;
  border-top: none !important;
}

.summary-total .summary-label {
  font-size: 17px;
  color: #333;
  font-weight: 600;
}

.summary-total .summary-value {
  font-size: 20px;
  color: #50ca59;
  font-weight: 700;
}

body.dark .subscription-summary {
  background: transparent;
  border-bottom-color: #404040;
}

body.dark .summary-item:not(:last-child) {
  border-bottom-color: #404040;
}

body.dark .summary-label {
  color: #b0b0b0;
}

body.dark .summary-value {
  color: #d4d4d4;
}

body.dark .summary-total .summary-label {
  color: #d4d4d4;
}

body.dark .summary-total .summary-value {
  color: #50ca59;
}

/* Card Element Form */
#card-payment-form {
  max-width: 100%;
}

#card-payment-form .form-group {
  margin-bottom: 20px;
}

#card-payment-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
  color: #333;
}

body.dark #card-payment-form label {
  color: #d4d4d4;
}

/* Card Element Container */
.card-element-container {
  padding: 12px 16px;
  border: 1px solid #d1d1d1;
  border-radius: 6px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-element-container:hover {
  border-color: #50ca59;
}

.card-element-container:focus-within {
  border-color: #50ca59;
  box-shadow: 0 0 0 3px rgba(80, 202, 89, 0.1);
}

body.dark .card-element-container {
  background: #333;
  border-color: #555;
}

body.dark .card-element-container:hover {
  border-color: #50ca59;
}

body.dark .card-element-container:focus-within {
  border-color: #50ca59;
  box-shadow: 0 0 0 3px rgba(80, 202, 89, 0.2);
}

/* Submit Button */
.payment-submit-btn {
  width: 100%;
  padding: 14px 24px;
  background: #50ca59;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.payment-submit-btn:hover:not(:disabled) {
  background: #45b54e;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(80, 202, 89, 0.3);
}

.payment-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.payment-submit-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

body.dark .payment-submit-btn:disabled {
  background: #555;
}

.submit-spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Error message */
.payment-modal-error {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 6px;
  color: #c33;
  font-size: 14px;
}

/* Success message */
.payment-modal-success {
  text-align: center;
  padding: 40px 20px;
}

.payment-modal-success i {
  font-size: 64px;
  color: #50ca59;
  margin-bottom: 16px;
}

.payment-modal-success h3 {
  margin: 0 0 8px;
  font-size: 24px;
  color: #333;
}

.payment-modal-success p {
  margin: 0;
  color: #666;
  font-size: 16px;
}

/* Dark mode support */
body.dark .payment-modal-content {
  background: #2a2a2a;
  color: #d4d4d4;
}

body.dark .payment-modal-header {
  background: #1e1e1e;
  border-bottom-color: #404040;
}

body.dark .payment-modal-title {
  color: #d4d4d4;
}

body.dark .payment-modal-close {
  color: #b0b0b0;
  visibility: visible;
  opacity: 1;
}

body.dark .payment-modal-close:hover {
  background: #404040;
  color: #d4d4d4;
}

body.dark .payment-modal-error {
  background: #3a1f1f;
  border-color: #5a2f2f;
  color: #ff8888;
}

body.dark .payment-modal-success h3 {
  color: #d4d4d4;
}

body.dark .payment-modal-success p {
  color: #b0b0b0;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-10px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(10px);
  }
}

/* Mobile responsiveness */
@media screen and (max-width: 768px) {
  .payment-modal {
    padding: 0;
    align-items: flex-end;
  }

  .payment-modal-content {
    max-width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 95vh;
  }

  .payment-modal-header {
    padding: 16px 20px;
  }

  .payment-modal-title {
    font-size: 18px;
  }

  .payment-modal-body {
    padding: 20px;
  }
}

/* Footer Section - Global Styles */
.footer-section {
  background: #fff;
  border-top: 1px solid #e5e5e5;
}

body.dark .footer-section {
  background: #1a1a1a;
  border-top-color: #333;
}

body.dark .footer-section a {
  color: #888;
}

body.dark .footer-section a:hover {
  color: #50ca59;
}
