/**
 * 💰 Marketplace Modal Styles
 * Donation tiers, custom donations, PayPal integration
 */

/* ===== Marketplace Modal ===== */
.marketplace-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 10003;
  display: none;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  padding: 20px;
}

.marketplace-modal.open {
  display: flex;
}

.marketplace-container {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 20px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

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

/* ===== Header ===== */
.marketplace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px 30px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.marketplace-header h2 {
  color: white;
  margin: 0;
  font-size: 1.8em;
  background: linear-gradient(135deg, #f093fb, #f5576c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.close-marketplace-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.close-marketplace-btn:hover {
  background: rgba(255, 87, 108, 0.3);
  transform: scale(1.05);
}

/* ===== Content ===== */
.marketplace-content {
  padding: 30px;
}

/* ===== Intro Section ===== */
.marketplace-intro {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
  background: rgba(240, 147, 251, 0.1);
  border-radius: 12px;
  border: 2px solid rgba(240, 147, 251, 0.3);
}

.intro-text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1em;
  line-height: 1.6;
  margin: 0;
}

.intro-text strong {
  color: #f5576c;
  font-weight: bold;
}

/* ===== Donation Tiers ===== */
.donation-tiers-section {
  margin-bottom: 40px;
}

.donation-tiers-section h3 {
  color: white;
  font-size: 1.5em;
  margin-bottom: 20px;
  text-align: center;
}

.donation-tiers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

/* ===== Tier Card ===== */
.tier-card {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tier-card:hover {
  transform: translateY(-5px);
  border-color: rgba(240, 147, 251, 0.5);
  box-shadow: 0 10px 30px rgba(240, 147, 251, 0.3);
}

.tier-card.featured {
  border-color: #f5576c;
  background: linear-gradient(135deg, rgba(240, 147, 251, 0.2), rgba(245, 87, 108, 0.2));
}

.tier-card.featured::before {
  content: "⭐ POPULAR";
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.7em;
  font-weight: bold;
}

.tier-card.selected {
  border-color: #f5576c;
  background: linear-gradient(135deg, rgba(240, 147, 251, 0.3), rgba(245, 87, 108, 0.3));
  box-shadow: 0 0 30px rgba(245, 87, 108, 0.4);
}

.tier-badge {
  font-size: 3em;
  margin-bottom: 10px;
  text-align: center;
}

.tier-name {
  color: white;
  font-size: 1.5em;
  font-weight: bold;
  margin-bottom: 10px;
  text-align: center;
}

.tier-price {
  color: #f5576c;
  font-size: 2em;
  font-weight: bold;
  text-align: center;
  margin-bottom: 5px;
}

.tier-billing {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9em;
  text-align: center;
  margin-bottom: 15px;
}

.tier-description {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95em;
  line-height: 1.5;
  margin-bottom: 15px;
  text-align: center;
}

.tier-benefits {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tier-benefits li {
  color: rgba(255, 255, 255, 0.9);
  padding: 6px 0;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tier-benefits li::before {
  content: "✓";
  color: #f5576c;
  font-weight: bold;
  font-size: 1.2em;
}

/* ===== Custom Donation ===== */
.custom-donation-section {
  margin-bottom: 30px;
  padding: 25px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.custom-donation-section h3 {
  color: white;
  font-size: 1.3em;
  margin-bottom: 15px;
  text-align: center;
}

.custom-donation-input {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
}

.input-group {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.currency-symbol {
  position: absolute;
  left: 15px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.2em;
  font-weight: bold;
  pointer-events: none;
}

#customDonationAmount {
  width: 100%;
  padding: 12px 15px 12px 35px;
  font-size: 1.2em;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: white;
  transition: all 0.3s ease;
}

#customDonationAmount:focus {
  outline: none;
  border-color: #f5576c;
  box-shadow: 0 0 15px rgba(245, 87, 108, 0.3);
}

.apply-donation-btn {
  padding: 12px 30px;
  font-size: 1.1em;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3);
}

.apply-donation-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 87, 108, 0.5);
}

.apply-donation-btn:active {
  transform: translateY(0);
}

.apply-donation-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 768px) {
  .apply-donation-btn {
    width: 100%;
    padding: 15px;
  }
}

.billing-type-select {
  padding: 12px 15px;
  font-size: 1em;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: white;
  cursor: pointer;
  min-width: 150px;
  transition: all 0.3s ease;
}

.billing-type-select:focus {
  outline: none;
  border-color: #f5576c;
}

.billing-type-select option {
  background: #1a1a2e;
  color: white;
}

.auto-tier-display {
  padding: 12px;
  background: rgba(240, 147, 251, 0.1);
  border-radius: 8px;
  border: 2px solid rgba(240, 147, 251, 0.3);
  color: white;
  text-align: center;
  margin-bottom: 10px;
  display: none;
}

.auto-tier-display.active {
  display: block;
}

.auto-tier-display strong {
  color: #f5576c;
}

.custom-donation-note {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
}

/* ===== Donor Message ===== */
.donor-message-section {
  margin-bottom: 30px;
}

.donor-message-section label {
  display: block;
  color: white;
  margin-bottom: 10px;
  font-weight: bold;
}

#donorMessage {
  width: 100%;
  padding: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: white;
  font-family: inherit;
  font-size: 1em;
  resize: vertical;
  transition: all 0.3s ease;
}

#donorMessage:focus {
  outline: none;
  border-color: #f5576c;
  box-shadow: 0 0 15px rgba(245, 87, 108, 0.3);
}

.char-counter {
  display: block;
  text-align: right;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 5px;
  font-size: 0.9em;
}

/* ===== PayPal Button ===== */
.paypal-button-container {
  margin-bottom: 30px;
  min-height: 50px;
}

/* ===== Status Messages ===== */
.marketplace-status {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
  font-weight: bold;
}

.marketplace-status.success {
  background: rgba(76, 175, 80, 0.2);
  border: 2px solid rgba(76, 175, 80, 0.5);
  color: #4caf50;
}

.marketplace-status.error {
  background: rgba(244, 67, 54, 0.2);
  border: 2px solid rgba(244, 67, 54, 0.5);
  color: #f44336;
}

.marketplace-status.info {
  background: rgba(33, 150, 243, 0.2);
  border: 2px solid rgba(33, 150, 243, 0.5);
  color: #2196f3;
}

/* ===== Contributions Summary ===== */
.my-contributions-section {
  padding: 25px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.my-contributions-section h3 {
  color: white;
  font-size: 1.3em;
  margin-bottom: 15px;
}

.contributions-summary {
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 15px;
}

.contribution-stat {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.contribution-stat:last-child {
  border-bottom: none;
}

.stat-label {
  color: rgba(255, 255, 255, 0.7);
}

.stat-value {
  color: #f5576c;
  font-weight: bold;
  font-size: 1.1em;
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: rgba(245, 87, 108, 0.2);
  border-color: #f5576c;
  transform: translateY(-2px);
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
  .marketplace-container {
    max-width: 100%;
    border-radius: 0;
  }

  .marketplace-header {
    padding: 20px;
  }

  .marketplace-header h2 {
    font-size: 1.4em;
  }

  .marketplace-content {
    padding: 20px;
  }

  .donation-tiers {
    grid-template-columns: 1fr;
  }

  .custom-donation-input {
    flex-direction: column;
  }

  .billing-type-select {
    width: 100%;
  }
}

/* ===== Scrollbar Styling ===== */
.marketplace-container::-webkit-scrollbar {
  width: 10px;
}

.marketplace-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.marketplace-container::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  border-radius: 10px;
}

.marketplace-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #f5576c, #f093fb);
}

/* ===== Toast Notifications ===== */
.marketplace-toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 1em;
  font-weight: 500;
  color: white;
  z-index: 10005;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  max-width: 400px;
  word-wrap: break-word;
}

.marketplace-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.95), rgba(56, 142, 60, 0.95));
  border: 2px solid rgba(76, 175, 80, 0.5);
}

.toast-error {
  background: linear-gradient(135deg, rgba(244, 67, 54, 0.95), rgba(211, 47, 47, 0.95));
  border: 2px solid rgba(244, 67, 54, 0.5);
}

.toast-warning {
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.95), rgba(245, 124, 0, 0.95));
  border: 2px solid rgba(255, 152, 0, 0.5);
}

.toast-info {
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.95), rgba(25, 118, 210, 0.95));
  border: 2px solid rgba(33, 150, 243, 0.5);
}

/* ===== Cart Summary ===== */
.cart-breakdown {
  margin-bottom: 15px;
}

.cart-item {
  color: rgba(255, 255, 255, 0.9);
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 1em;
}

.cart-item-note {
  color: rgba(76, 175, 80, 0.9);
  font-size: 0.9em;
  padding: 5px 0 8px 15px;
  font-style: italic;
}

.cart-glb-section {
  margin: 15px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cart-section-header {
  color: #f5576c;
  font-weight: bold;
  font-size: 1em;
  margin-bottom: 8px;
}

.cart-glb-item {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95em;
  padding: 5px 0 5px 10px;
}

.cart-total {
  color: white;
  font-size: 1.3em;
  font-weight: bold;
  padding: 15px 0;
  border-top: 2px solid rgba(240, 147, 251, 0.3);
  text-align: right;
}

/* ===== Toast Responsive ===== */
@media (max-width: 768px) {
  .marketplace-toast {
    bottom: 20px;
    right: 20px;
    left: 20px;
    max-width: none;
  }
}

/* ===== GLB Section ===== */
.glb-section {
  margin-bottom: 30px;
}

.glb-section h3 {
  color: white;
  font-size: 1.5em;
  margin-bottom: 15px;
  text-align: center;
}

.glb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.glb-card {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.glb-card:hover {
  transform: translateY(-3px);
  border-color: rgba(240, 147, 251, 0.5);
  box-shadow: 0 8px 20px rgba(240, 147, 251, 0.2);
}

.glb-card.selected {
  border-color: #f5576c;
  background: linear-gradient(135deg, rgba(240, 147, 251, 0.2), rgba(245, 87, 108, 0.2));
  box-shadow: 0 0 20px rgba(245, 87, 108, 0.3);
}

.glb-card.included {
  border-color: #4caf50;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(56, 142, 60, 0.2));
}

.glb-thumbnail {
  width: 100%;
  height: 120px;
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.glb-thumbnail canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  border-radius: 8px;
}

.glb-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.glb-placeholder {
  font-size: 3em;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.glb-name {
  color: white;
  font-size: 1em;
  font-weight: bold;
  margin-bottom: 8px;
}

.glb-price {
  color: #f5576c;
  font-size: 1.1em;
  font-weight: bold;
}

.glb-price .included-check {
  color: #4caf50;
}

.glb-price .extra-price {
  color: #ff9800;
}

/* ===== Cart Summary Section ===== */
.cart-summary-section {
  margin-bottom: 30px;
  padding: 25px;
  background: rgba(240, 147, 251, 0.05);
  border-radius: 12px;
  border: 2px solid rgba(240, 147, 251, 0.2);
}

.cart-summary-section h3 {
  color: white;
  font-size: 1.5em;
  margin-bottom: 15px;
  text-align: center;
}

/* ===== Responsive GLB Grid ===== */
@media (max-width: 768px) {
  .glb-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
  }

  .glb-thumbnail {
    height: 100px;
  }
}

/* ===== Cart Locked State ===== */
.subscription-card[style*="pointer-events: none"],
.glb-card[style*="pointer-events: none"] {
  cursor: not-allowed;
  user-select: none;
  transition: opacity 0.3s ease;
}

input:disabled,
button:disabled {
  cursor: not-allowed;
  transition: opacity 0.3s ease;
}
