/**
 * Trial Enforcement Styles
 * Comprehensive styling for trial limits and upgrade prompts
 */

/* Trial blocking styles */
.trial-blocked .analyze-btn,
.trial-blocked [data-action="analyze"],
.trial-blocked .xai-analyze-btn,
.trial-blocked #process-btn,
.trial-blocked .bulk-analyze-btn {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  background-color: #ccc !important;
  border-color: #ccc !important;
  color: #666 !important;
}

.trial-disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  pointer-events: none;
  filter: grayscale(50%);
}

/* Context menu disabled state */
.context-menu-item.trial-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #f5f5f5;
  color: #999 !important;
}

.context-menu-item.trial-disabled:hover {
  background-color: #f5f5f5 !important;
  color: #999 !important;
}

/* Trial upgrade prompts */
.trial-upgrade-prompt {
  margin: 20px 0;
  padding: 0;
  animation: slideInDown 0.5s ease-out;
  /* Make it fit with gallery cards */
  height: auto;
}

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

.upgrade-prompt-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px 16px; /* Reduced padding to match gallery cards */
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  /* Match gallery card total height (~260px) */
  height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.upgrade-prompt-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.upgrade-prompt-card h3 {
  margin: 0 0 8px 0; /* Reduced margin */
  font-size: 18px; /* Reduced font size */
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.upgrade-prompt-card p {
  margin: 0 0 16px 0; /* Reduced margin */
  font-size: 14px; /* Reduced font size */
  opacity: 0.9;
  line-height: 1.4; /* Tighter line height */
}

.upgrade-btn {
  background: #ffffff;
  color: #667eea;
  border: none;
  padding: 10px 24px; /* Reduced padding */
  border-radius: 20px; /* Slightly smaller border radius */
  font-weight: bold;
  font-size: 14px; /* Reduced font size */
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.upgrade-btn:hover {
  background: #f8f9ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

/* Banner-style upgrade prompt for dashboard */
.dashboard-upgrade-banner {
  margin: 0 0 30px 0 !important;
  animation: slideInDown 0.5s ease-out;
}

.upgrade-prompt-card.banner-style {
  height: auto !important;
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  padding: 20px 30px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(255, 107, 53, 0.3);
  margin-bottom: 0;
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  text-align: left;
}

.banner-icon {
  font-size: 3rem;
  line-height: 1;
  min-width: 60px;
}

.banner-text {
  flex: 1;
}

.banner-text h3 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: bold;
  color: white;
}

.banner-text p {
  margin: 0;
  font-size: 16px;
  opacity: 0.95;
  color: white;
}

.banner-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 140px;
}

.upgrade-btn.primary {
  background: white;
  color: #ff6b35;
  font-weight: bold;
  font-size: 16px;
  padding: 14px 32px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.upgrade-btn.secondary {
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,0.8);
  font-weight: bold;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upgrade-btn.primary:hover {
  background: #f8f9ff;
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(0,0,0,0.25);
  color: #e55a2b;
}

.upgrade-btn.secondary:hover {
  background: rgba(255,255,255,0.15);
  border-color: white;
}

/* Responsive design for banner */
@media (max-width: 768px) {
  .banner-content {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }
  
  .banner-actions {
    flex-direction: row;
    justify-content: center;
    min-width: auto;
  }
  
  .banner-text h3 {
    font-size: 20px;
  }
  
  .banner-text p {
    font-size: 14px;
  }
  
  .banner-icon {
    font-size: 2.5rem;
    min-width: auto;
  }
}

/* Upgrade modal styles */
.upgrade-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.upgrade-modal {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.upgrade-modal-header {
  padding: 25px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 16px 16px 0 0;
}

.upgrade-modal-header h2 {
  margin: 0;
  font-size: 28px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.close-modal {
  background: rgba(255,255,255,0.2);
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: white;
  padding: 5px;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.close-modal:hover {
  background: rgba(255,255,255,0.3);
}

.upgrade-modal-content {
  padding: 25px;
}

.upgrade-message {
  text-align: center;
  font-size: 18px;
  color: #666;
  margin-bottom: 30px;
  line-height: 1.6;
  font-weight: 500;
}

.plans-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.plan-card {
  border: 2px solid #e1e5e9;
  border-radius: 12px;
  padding: 25px;
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
  background: white;
}

.plan-card:hover {
  border-color: #667eea;
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.plan-card.featured {
  border-color: #667eea;
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.plan-card.featured:hover {
  transform: scale(1.02) translateY(-5px);
}

.plan-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.plan-header h3 {
  font-size: 24px;
  margin: 0 0 10px 0;
  color: #333;
  font-weight: 600;
}

.price {
  font-size: 36px;
  font-weight: bold;
  color: #667eea;
  margin-bottom: 20px;
}

.price span {
  font-size: 16px;
  color: #666;
  font-weight: normal;
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 25px 0;
}

.plan-features li {
  padding: 8px 0;
  color: #555;
  font-size: 16px;
  text-align: left;
  position: relative;
  padding-left: 0;
}

.plan-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
}

.select-plan-btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.platform-plan .select-plan-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.platform-plan .select-plan-btn:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Image processing blocked overlay */
.trial-blocked .gallery-card::after {
  content: '🔒 Upgrade Required';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 10px 15px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.trial-blocked .gallery-card:hover::after {
  opacity: 1;
}

/* Blocked button pulse animation */
.trial-disabled {
  animation: blockedPulse 2s infinite;
}

@keyframes blockedPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.3; }
}

/* Loading states */
.upgrade-btn.loading {
  position: relative;
  color: transparent;
}

.upgrade-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid #667eea;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
  .upgrade-modal {
    width: 95%;
    margin: 20px;
  }
  
  .plans-container {
    grid-template-columns: 1fr;
  }
  
  .plan-card.featured {
    transform: none;
  }
  
  .plan-card.featured:hover {
    transform: translateY(-5px);
  }
  
  .upgrade-modal-header h2 {
    font-size: 24px;
  }
  
  .price {
    font-size: 28px;
  }
  
  .plan-features li {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .upgrade-modal-content {
    padding: 15px;
  }
  
  .upgrade-modal-header {
    padding: 15px;
  }
  
  .plan-card {
    padding: 20px;
  }
  
  .upgrade-prompt-card {
    padding: 16px; /* Consistent with desktop version */
    height: 260px; /* Maintain same height */
  }
  
  .upgrade-prompt-card h3 {
    font-size: 16px; /* Slightly smaller for mobile */
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .upgrade-modal {
    background: #1e1e1e;
    color: #fff;
  }
  
  .plan-card {
    background: #2d2d2d;
    border-color: #444;
    color: #fff;
  }
  
  .plan-features li {
    color: #ccc;
  }
  
  .upgrade-message {
    color: #ccc;
  }
}

/* Focus states for accessibility */
.upgrade-btn:focus,
.select-plan-btn:focus,
.close-modal:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .upgrade-modal-overlay,
  .trial-upgrade-prompt {
    display: none !important;
  }
}
