/**
 * PRG Widgets Styles
 *
 * Styles for widget components including the Browse CTA widget.
 * Responsive design: sticky sidebar on desktop, inline block on mobile.
 *
 * @package ProductReviewGenerator
 * @since 3.9.0
 */

/* ==========================================================================
   Browse CTA Widget - Base Styles
   ========================================================================== */

.prg-browse-cta-widget {
  background: linear-gradient(180deg, #f9fafb 0%, #ffffff 100%);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
}

.prg-browse-cta-widget:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.prg-cta-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================================================
   Icon
   ========================================================================== */

.prg-cta-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-radius: 12px;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
  margin: 0 auto;
}

.prg-cta-icon svg {
  width: 24px;
  height: 24px;
}

/* ==========================================================================
   Content
   ========================================================================== */

.prg-cta-content {
  text-align: center;
}

.prg-cta-headline {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: #1f2937;
  margin: 0 0 8px 0;
}

.prg-cta-description {
  font-size: 14px;
  line-height: 1.6;
  color: #6b7280;
  margin: 0;
}

.prg-cta-description strong {
  color: #3b82f6;
  font-weight: 600;
}

/* ==========================================================================
   Actions
   ========================================================================== */

.prg-cta-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.prg-cta-primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 17px 8px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff !important;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
  line-height: 1;
  text-align: center;
}

.prg-cta-primary-btn:hover {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.35);
  transform: translateY(-1px);
}

.prg-cta-primary-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3);
}

.prg-cta-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.prg-cta-primary-btn:hover .prg-cta-arrow {
  transform: translateX(3px);
}

.prg-cta-secondary-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
}

/* ==========================================================================
   Responsive Styles - Desktop (Sticky Sidebar)
   ========================================================================== */

@media (min-width: 768px) {
  /* Auto mode: sticky on desktop */
  .prg-cta-auto.prg-browse-cta-widget {
    position: sticky;
    top: 32px;
    max-width: 350px;
  }

  /* Always sticky on sidebar mode */
  .prg-cta-sidebar.prg-browse-cta-widget {
    position: sticky;
    top: 32px;
    max-width: 350px;
  }

  /* Inline mode: full width, no sticky */
  .prg-cta-inline.prg-browse-cta-widget {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  /* Desktop: horizontal button layout when secondary button exists */
  .prg-cta-actions:has(.prg-cta-secondary-btn) {
    flex-direction: row;
    gap: 12px;
  }

  .prg-cta-actions:has(.prg-cta-secondary-btn) .prg-cta-primary-btn,
  .prg-cta-actions:has(.prg-cta-secondary-btn) .prg-cta-secondary-btn {
    flex: 1;
    min-width: 0;
  }
}

/* ==========================================================================
   Responsive Styles - Tablet
   ========================================================================== */

@media (min-width: 768px) and (max-width: 1024px) {
  .prg-browse-cta-widget {
    padding: 20px;
  }

  .prg-cta-headline {
    font-size: 17px;
  }

  .prg-cta-description {
    font-size: 13px;
  }

  .prg-cta-primary-btn {
    font-size: 14px;
    padding: 10px 20px;
  }
}

/* ==========================================================================
   Responsive Styles - Mobile
   ========================================================================== */

@media (max-width: 767px) {
  /* Auto mode: inline block on mobile */
  .prg-cta-auto.prg-browse-cta-widget {
    position: relative;
    max-width: 100%;
    margin: 32px 0;
    padding: 20px;
  }

  /* Sidebar mode: smaller sticky on mobile */
  .prg-cta-sidebar.prg-browse-cta-widget {
    position: sticky;
    top: 16px;
    padding: 16px;
  }

  /* Inline mode: full width */
  .prg-cta-inline.prg-browse-cta-widget {
    padding: 20px;
  }

  .prg-cta-headline {
    font-size: 16px;
  }

  .prg-cta-description {
    font-size: 13px;
  }

  .prg-cta-primary-btn {
    font-size: 14px;
    padding: 11px 20px;
  }

  /* Mobile: always stacked buttons */
  .prg-cta-actions {
    flex-direction: column;
    gap: 8px;
  }

  .prg-cta-secondary-btn {
    font-size: 13px;
    padding: 9px 18px;
  }
}

/* ==========================================================================
   Widget Area Specific Adjustments
   ========================================================================== */

/* When in widget area (sidebar), ensure proper spacing */
.widget.prg-browse-cta-widget-wrapper {
  margin-bottom: 24px;
}

.widget.prg-browse-cta-widget-wrapper .prg-browse-cta-widget {
  margin-bottom: 0;
}

/* ==========================================================================
   Animation & Loading States
   ========================================================================== */

.prg-browse-cta-widget[data-context] {
  animation: fadeInUp 0.4s ease;
}

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

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .prg-browse-cta-widget {
    display: none;
  }
}

/* ==========================================================================
   High Contrast Mode Support
   ========================================================================== */

@media (prefers-contrast: high) {
  .prg-browse-cta-widget {
    border: 2px solid #1f2937;
  }

  .prg-cta-primary-btn {
    border: 2px solid transparent;
  }

  .prg-cta-secondary-btn {
    border-width: 2px;
  }
}

/* ==========================================================================
   Reduced Motion Support
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .prg-browse-cta-widget,
  .prg-cta-primary-btn,
  .prg-cta-arrow {
    transition: none;
    animation: none;
  }

  .prg-cta-primary-btn:hover {
    transform: none;
  }

  .prg-cta-primary-btn:hover .prg-cta-arrow {
    transform: none;
  }
}

/* ==========================================================================
   Dark Mode Support (Optional - for themes that support dark mode)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
  .prg-browse-cta-widget {
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    border-color: #374151;
  }

  .prg-cta-headline {
    color: #f9fafb;
  }

  .prg-cta-description {
    color: #d1d5db;
  }

  .prg-cta-description strong {
    color: #60a5fa;
  }
}

/* ==========================================================================
   Browse CTA Review Widget - Compact Variant
   ========================================================================== */

/* Review widget wrapper - more compact design */
.prg-browse-cta-review-widget-wrapper .prg-browse-cta-widget {
  padding: 18px;
  margin-bottom: 20px;
}

.prg-browse-cta-review-widget-wrapper .prg-cta-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 0;
}

.prg-browse-cta-review-widget-wrapper .prg-cta-icon svg {
  width: 20px;
  height: 20px;
}

.prg-browse-cta-review-widget-wrapper .prg-cta-headline {
  font-size: 16px;
  margin-bottom: 6px;
}

.prg-browse-cta-review-widget-wrapper .prg-cta-description {
  font-size: 13px;
  line-height: 1.5;
}

.prg-browse-cta-review-widget-wrapper .prg-cta-primary-btn {
  font-size: 14px;
  padding: 11px 20px;
}

/* Always inline positioning for review widget */
.prg-browse-cta-review-widget-wrapper .prg-browse-cta-widget {
  position: relative !important;
  top: auto !important;
}

/* Mobile adjustments for review widget */
@media (max-width: 767px) {
  .prg-browse-cta-review-widget-wrapper .prg-browse-cta-widget {
    padding: 16px;
  }
  
  .prg-browse-cta-review-widget-wrapper .prg-cta-headline {
    font-size: 15px;
  }
  
  .prg-browse-cta-review-widget-wrapper .prg-cta-description {
    font-size: 12px;
  }
}
