/**
 * Google Reviews — Front CSS
 * Mobile-first. Custom properties overridable per client theme.
 * Author: GBReviews | License: AFL-3.0
 */

/* ==========================================================================
   1. DESIGN TOKENS — override these in your theme to match client branding
   ========================================================================== */
:root {
  --gb-primary:        #4285F4;
  --gb-primary-dark:   #2b5cc8;
  --gb-star:           #FBBC04;
  --gb-star-empty:     #E0E0E0;
  --gb-card-bg:        #ffffff;
  --gb-card-radius:    16px;
  --gb-card-shadow:    0 4px 20px rgba(0, 0, 0, 0.08);
  --gb-card-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.14);
  --gb-text:           #3c4043;
  --gb-text-light:     #70757a;
  --gb-text-author:    #202124;
  --gb-bg-section:     #f8f9fa;
  --gb-border:         #e8eaed;
  --gb-avatar-bg:      #4285F4;
  --gb-avatar-text:    #ffffff;
  --gb-font:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --gb-transition:     0.25s ease;
  --gb-nav-size:       40px;
}

/* ==========================================================================
   2. WIDGET WRAPPER
   ========================================================================== */
.gb-reviews-widget {
  font-family: var(--gb-font);
  background: var(--gb-bg-section);
  padding: 40px 16px;
  box-sizing: border-box;
  overflow: hidden;
}

/* ==========================================================================
   3. HEADER — rating summary
   ========================================================================== */
.gb-reviews-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.gb-reviews-header__logo {
  flex-shrink: 0;
}

.gb-reviews-header__business {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gb-text-author);
  line-height: 1.2;
}

.gb-reviews-header__rating {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gb-rating-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gb-text-author);
  line-height: 1;
}

.gb-stars-display {
  display: flex;
  gap: 2px;
}

.gb-rating-count {
  font-size: 0.85rem;
  color: var(--gb-text-light);
}

/* ==========================================================================
   4. STARS
   ========================================================================== */
.gb-star {
  color: var(--gb-star-empty);
  font-style: normal;
  font-size: 1.1rem;
  line-height: 1;
}

.gb-star--filled {
  color: var(--gb-star);
}

/* ==========================================================================
   5. SWIPER OVERRIDES
   ========================================================================== */
.gb-swiper {
  padding-bottom: 48px !important;
  padding-left: 4px;
  padding-right: 4px;
}

.gb-swiper-prev,
.gb-swiper-next {
  color: var(--gb-primary);
  width: var(--gb-nav-size);
  height: var(--gb-nav-size);
  background: var(--gb-card-bg);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
  transition: background var(--gb-transition), color var(--gb-transition);
}

.gb-swiper-prev:after,
.gb-swiper-next:after {
  font-size: 16px;
}

.gb-swiper-prev:hover,
.gb-swiper-next:hover {
  background: var(--gb-primary);
  color: #fff;
}

.gb-swiper-pagination .swiper-pagination-bullet {
  background: var(--gb-primary);
  opacity: 0.4;
}

.gb-swiper-pagination .swiper-pagination-bullet-active {
  opacity: 1;
}

/* ==========================================================================
   6. REVIEW CARD
   ========================================================================== */
.gb-review-card {
  background: var(--gb-card-bg);
  border-radius: var(--gb-card-radius);
  box-shadow: var(--gb-card-shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  box-sizing: border-box;
  transition: box-shadow var(--gb-transition), transform var(--gb-transition);
  position: relative;
}

.gb-review-card:hover {
  box-shadow: var(--gb-card-shadow-hover);
  transform: translateY(-2px);
}

/* Author row */
.gb-review-card__author {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Avatar */
.gb-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.gb-avatar--initial {
  background: var(--gb-avatar-bg);
  color: var(--gb-avatar-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
}

.gb-review-card__author-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gb-review-card__author-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--gb-text-author);
}

.gb-review-card__date {
  font-size: 0.78rem;
  color: var(--gb-text-light);
}

/* Stars in card */
.gb-review-card__stars {
  display: flex;
  gap: 2px;
}

/* Review text */
.gb-review-card__text {
  flex: 1;
}

.gb-review-text-content {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--gb-text);
  margin: 0;
}

/* Read more button */
.gb-btn-readmore {
  background: none;
  border: none;
  color: var(--gb-primary);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  transition: color var(--gb-transition);
}

.gb-btn-readmore:hover {
  color: var(--gb-primary-dark);
}

/* Google icon watermark */
.gb-review-card__google-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  opacity: 0.5;
}

/* ==========================================================================
   7. FOOTER
   ========================================================================== */
.gb-reviews-footer {
  text-align: center;
  margin-top: 20px;
}

.gb-powered-by {
  font-size: 0.75rem;
  color: var(--gb-text-light);
  opacity: 0.7;
}

.gb-powered-by strong {
  color: var(--gb-text-light);
}

/* ==========================================================================
   8. RESPONSIVE BREAKPOINTS — Swiper handles slides via JS config
   ========================================================================== */
@media (max-width: 575px) {
  .gb-reviews-widget {
    padding: 28px 12px;
  }
  .gb-rating-number {
    font-size: 1.6rem;
  }
}

/* ==========================================================================
   9. ADMIN STYLES — used only in back-office, keep below for separation
   ========================================================================== */
.gb-admin-wrapper {
  padding: 20px 0;
}

.gb-tabs {
  border-bottom: 2px solid #dee2e6;
  margin-bottom: 0;
}

.gb-tabs .nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: #70757a;
  border-radius: 8px 8px 0 0;
  transition: color 0.2s;
}

.gb-tabs .nav-link.active,
.gb-tabs .nav-link:hover {
  color: #4285F4;
  background: #fff;
}

.gb-tab-content {
  background: #f8f9fa;
  padding-top: 24px;
}

.gb-card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  margin-bottom: 20px;
  overflow: hidden;
}

.gb-card-header {
  background: linear-gradient(135deg, #4285F4 0%, #2b5cc8 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.gb-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: #ffffff;
  background: transparent;
  border: none;
  box-shadow: none;
  font-family: inherit;
}

.gb-card-title .material-icons {
  font-size: 1.2rem;
  color: #ffffff;
}

.gb-btn-primary {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  transition: background 0.2s, color 0.2s;
}

.gb-btn-primary:hover {
  background: rgba(255,255,255,0.35);
  color: #fff;
}

/* Admin table */
.gb-table {
  margin: 0;
  font-size: 0.9rem;
}

.gb-table thead th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #70757a;
  border-bottom: 2px solid #dee2e6;
  padding: 12px 16px;
}

.gb-table tbody td {
  padding: 14px 16px;
  vertical-align: middle;
  border-color: #f0f0f0;
}

/* Badges */
.gb-badge-api {
  background: #e8f0fe;
  color: #4285F4;
  font-weight: 600;
  border-radius: 6px;
  font-size: 0.78rem;
}

.gb-badge-scraping {
  background: #fce8e6;
  color: #ea4335;
  font-weight: 600;
  border-radius: 6px;
  font-size: 0.78rem;
}

/* Status icons */
.gb-status-ok    { color: #34a853; display: flex; align-items: center; gap: 4px; font-size: 0.85rem; }
.gb-status-error { color: #ea4335; display: flex; align-items: center; gap: 4px; font-size: 0.85rem; cursor: help; }
.gb-status-pending { color: #70757a; display: flex; align-items: center; gap: 4px; font-size: 0.85rem; }

/* Action buttons */
.gb-actions { white-space: nowrap; }
.gb-actions .btn { margin-right: 4px; color: #70757a; border: 1px solid #dee2e6; }
.gb-btn-sync    { color: #4285F4 !important; }
.gb-btn-edit    { color: #fbbc04 !important; }
.gb-btn-reviews { color: #34a853 !important; }
.gb-btn-logs    { color: #70757a !important; }
.gb-btn-delete  { color: #ea4335 !important; }
.gb-actions .btn:hover { background: #f8f9fa; }

/* Rating display in table */
.gb-rating-avg { font-weight: 700; font-size: 1rem; color: #3c4043; }

/* Empty state */
.gb-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #70757a;
}

.gb-empty-icon {
  font-size: 48px !important;
  color: #dadce0;
  display: block;
  margin-bottom: 12px;
}

/* Info boxes */
.gb-info-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #e8f0fe;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.88rem;
  color: #3c4043;
}

.gb-info-box--cron { background: #f0f4ff; }
.gb-info-box code {
  display: block;
  word-break: break-all;
  background: rgba(255,255,255,0.8);
  border-radius: 4px;
  padding: 6px 8px;
  margin: 6px 0 4px;
  font-size: 0.82rem;
}

/* Form actions */
.gb-form-actions { padding: 16px 0; }

/* Engine selector */
.gb-engine-selector { display: flex; gap: 12px; flex-wrap: wrap; }
.gb-engine-option { cursor: pointer; flex: 1; min-width: 200px; }
.gb-engine-option input { display: none; }
.gb-engine-card {
  display: block;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  padding: 14px;
  transition: border-color 0.2s, background 0.2s;
}
.gb-engine-option input:checked ~ .gb-engine-card {
  border-color: #4285F4;
  background: #e8f0fe;
}
.gb-engine-card strong { display: block; margin-bottom: 4px; font-size: 0.92rem; }
.gb-engine-card small { color: #70757a; font-size: 0.82rem; }

/* Toggle switch */
.gb-switch-row { display: flex; align-items: center; gap: 12px; }
.gb-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.gb-switch input { display: none; }
.gb-switch-slider {
  position: absolute; inset: 0;
  background: #dadce0;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}
.gb-switch-slider:before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.gb-switch input:checked ~ .gb-switch-slider { background: #4285F4; }
.gb-switch input:checked ~ .gb-switch-slider:before { transform: translateX(20px); }

/* Reviews admin modal */
.gb-reviews-admin-list { display: flex; flex-direction: column; gap: 16px; }
.gb-review-admin-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e8eaed;
  transition: opacity 0.2s;
}
.gb-review-hidden { opacity: 0.45; }
.gb-review-admin-body { flex: 1; }
.gb-review-admin-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.gb-stars-sm { color: #FBBC04; letter-spacing: -1px; }
.gb-review-date { font-size: 0.8rem; color: #70757a; }
.gb-review-text { font-size: 0.88rem; color: #3c4043; margin: 0; }
.gb-avatar-img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.gb-avatar-initial {
  width: 40px; height: 40px; border-radius: 50%;
  background: #4285F4; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
}

/* Logs table */
.gb-logs-table td, .gb-logs-table th { font-size: 0.85rem; }
.gb-log-error { background: #fce8e6; }

/* Required field asterisk */
.gb-required { color: #ea4335; }

/* Loading spinner */
.gb-loading { text-align: center; padding: 40px; color: #4285F4; }
@keyframes rotate { to { transform: rotate(360deg); } }
.rotating { animation: rotate 1s linear infinite; display: inline-block; }
