/* GradeIt Reviews Widget - Loox-style Design */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Montserrat:wght@400;500;600;700&family=Roboto:wght@400;500;700&family=Open+Sans:wght@400;600;700&family=Lato:wght@400;700&family=Raleway:wght@400;600;700&family=Inter:wght@400;500;600;700&family=Nunito:wght@400;600;700&family=Playfair+Display:wght@400;600;700&family=Merriweather:wght@400;700&family=Source+Sans+Pro:wght@400;600;700&display=swap');

/* ============================================
   Shadow DOM Reset - Ensures clean slate
   ============================================ */
:host {
  all: initial;
  display: block;
  contain: content;
}

#shadow-container {
  all: initial;
  display: block;
  box-sizing: border-box;
}

#shadow-container *,
#shadow-container *::before,
#shadow-container *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ============================================
   BLOCK 1: Reviews Badge (Compact Summary)
   ============================================ */

.gradeit-reviews-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  /* font-family set via inline style by widget.js */
  font-size: 14px;
  line-height: 0;
}

.gradeit-reviews-badge .stars {
  display: flex;
  gap: 2px;
  color: var(--star-color, #ebbf20);
}

.gradeit-reviews-badge .stars .star-icon {
  fill: currentColor;
}

.gradeit-reviews-badge .text {
  color: var(--text-color, inherit);
  cursor: pointer;
}

/* ============================================
   BLOCK 2: Full Reviews Widget
   ============================================ */

.gradeit-reviews-widget {
  --gradeit-border-radius: 0px;
  --gradeit-button-border-radius: 0px;
  --gradeit-star-size: 16px;
  --gradeit-header-star-size: 16px;
  --gradeit-star-color: #ebbf20;
  --gradeit-font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Light Theme Variables (Default) */
  --gradeit-text-primary: #000000;
  --gradeit-text-secondary: #666666;
  --gradeit-card-bg: #ffffff;
  --gradeit-border-color: #e5e5e5;
  --gradeit-button-bg: #ffffff;
  --gradeit-button-text: #000000;
  --gradeit-button-border: #000000;
  --gradeit-button-hover-bg: #000000;
  --gradeit-button-hover-text: #ffffff;
  --gradeit-verified-color: #000000;

  font-family: var(--gradeit-font-family);
  width: 100%;
  max-width: 100%;
  margin: 40px 0;
  padding: 0 20px;
  border-radius: var(--gradeit-border-radius);
  box-sizing: border-box;
  color: var(--gradeit-text-primary);
}

/* Dark Theme Overrides */
.gradeit-reviews-widget.gradeit-theme-dark {
  --gradeit-text-primary: #ffffff;
  --gradeit-text-secondary: #a1a1aa;
  --gradeit-card-bg: #111111;
  --gradeit-border-color: #333333;
  --gradeit-button-bg: #111111;
  --gradeit-button-text: #ffffff;
  --gradeit-button-border: #ffffff;
  --gradeit-button-hover-bg: #ffffff;
  --gradeit-button-hover-text: #000000;
  --gradeit-verified-color: #ffffff;
}

/* Header Section */
.gradeit-reviews-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 0px;
  width: 100%;
}

.gradeit-reviews-summary {
  display: flex;
  align-items: end;
  gap: 12px;
}

.gradeit-reviews-summary .stars {
  display: flex;
  gap: 3px;
  color: var(--gradeit-star-color, #ebbf20);
}

.gradeit-reviews-summary .stars .star-icon {
  width: var(--gradeit-header-star-size, 16px);
  height: var(--gradeit-header-star-size, 16px);
  fill: currentColor;
}

.gradeit-reviews-summary .count {
  font-size: 18px;
  font-weight: 400;
  color: var(--gradeit-text-primary);
  cursor: pointer;
  line-height: 1;
}

.gradeit-write-review-btn {
  padding: 10px 24px;
  background: var(--gradeit-button-bg);
  border: 1px solid var(--gradeit-button-border);
  border-radius: var(--gradeit-button-border-radius, 0px);
  font-size: 14px;
  font-weight: 500;
  color: var(--gradeit-button-text);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.gradeit-write-review-btn:hover {
  background: var(--gradeit-button-hover-bg);
  color: var(--gradeit-button-hover-text);
}

/* Grid Layout - columns created dynamically via JS */
.gradeit-reviews-grid {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
  position: relative;
}

.gradeit-column {
  flex: 1;
  min-width: 0;
}

/* Review Card */
.gradeit-review-card {
  background: var(--gradeit-card-bg);
  border: 1px solid var(--gradeit-border-color);
  border-radius: var(--gradeit-border-radius, 0px);
  overflow: hidden;
  transition: box-shadow 0.2s;
  cursor: pointer;
  width: 100%;
}

/* Hover effect - only applied when enableHoverEffect is true */
.gradeit-reviews-widget.hover-enabled .gradeit-review-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gradeit-review-photo {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--gradeit-border-radius, 0px) var(--gradeit-border-radius, 0px) 0 0;
}

.gradeit-review-content {
  padding: 16px;
}

.gradeit-review-author {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gradeit-text-primary);
}

.gradeit-review-author-name {
  font-weight: 600;
  color: var(--gradeit-text-primary);
  white-space: nowrap;
}

.gradeit-verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--gradeit-verified-color);
  font-weight: 400;
}

.gradeit-verified-badge svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.gradeit-review-stars {
  display: flex;
  gap: 2px;
  margin-bottom: 10px;
  color: var(--gradeit-star-color, #ebbf20);
}

.gradeit-review-stars .star-icon {
  width: var(--gradeit-star-size, 16px);
  height: var(--gradeit-star-size, 16px);
  fill: currentColor;
}

.gradeit-review-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--gradeit-text-primary);
}

/* Load More Button */
.gradeit-load-more {
  display: block;
  margin: 0 auto;
  padding: 14px 40px;
  background: var(--gradeit-button-bg);
  border: 1px solid var(--gradeit-button-border);
  border-radius: var(--gradeit-button-border-radius, 0px);
  font-size: 15px;
  font-weight: 500;
  color: var(--gradeit-button-text);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.gradeit-load-more:hover {
  background: var(--gradeit-button-hover-bg);
  color: var(--gradeit-button-hover-text);
}

.gradeit-load-more:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal styles are injected separately outside Shadow DOM for proper overlay */

/* Loading State */
.gradeit-loading {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 16px;
}

/* Error State */
.gradeit-error {
  text-align: center;
  padding: 40px;
  color: #e53e3e;
  font-size: 16px;
}

/* No Reviews Overlay - positioned over ghost cards */
.gradeit-no-reviews-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
  padding: 30px 40px;
  border-radius: 8px;
}

.gradeit-no-reviews-overlay p {
  margin: 0;
}

/* Ghost cards - invisible but maintain layout */
.gradeit-ghost-card {
  opacity: 0;
  pointer-events: none;
  border-color: transparent;
}

.gradeit-ghost-card * {
  visibility: hidden;
}

/* Responsive */

@media (max-width: 768px) {
  .gradeit-reviews-header {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
  
  .gradeit-reviews-summary {
    width: 100%;
  }
  
  .gradeit-write-review-btn {
    width: 100%;
    padding: 12px 24px;
    font-size: 14px;
  }

  .gradeit-modal-content {
    max-width: 100%;
    margin: 0;
  }
  
  .gradeit-reviews-widget {
    padding: 0 10px;
  }
  
  .gradeit-no-reviews-overlay {
    padding: 20px 30px;
  }
}

@media (max-width: 480px) {
  .gradeit-reviews-widget {
    padding: 0 5px;
  }
}
