/* --- 1. CORE VARIABLES --- */
:root {
  --sr-text-dark: #1e293b;
  --sr-text-gray: #64748b;
  --sr-border: #e2e8f0;
  --sr-bg: #fff;
  /* Uses dynamic vars: --sr-widget-accent, --sr-star-color */
}

.sr-widget-container {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  max-width: 1100px;
  margin: 40px auto;
  color: var(--sr-text-dark);
}
.sr-widget-container * {
  box-sizing: border-box;
}

/* --- 2. HEADER SECTION --- */
.sr-header-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 40px;
  flex-wrap: wrap;
  gap: 20px;
}

/* Stats Card */
.sr-stats-card {
  flex: 1;
  min-width: 300px;
  border: 1px solid var(--sr-border);
  border-radius: 12px;
  padding: 25px;
  display: flex;
  gap: 40px;
  align-items: center;
  background: #fff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

/* Left Score Column */
.sr-score-col {
  text-align: center;
  min-width: 120px;
}
.sr-big-score {
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  display: block;
  margin-bottom: 5px;
  color: var(--sr-text-dark);
}
.sr-badge {
  background: #dcfce7;
  color: #166534;
  font-size: 11px;
  font-weight: 700;
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sr-sub-text {
  display: block;
  font-size: 13px;
  color: var(--sr-text-gray);
  margin-top: 8px;
  font-weight: 500;
}

/* Right Bars Column */
.sr-bars-col {
  flex: 1;
}
.sr-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--sr-text-gray);
  font-weight: 500;
}
.sr-star-lbl {
  width: 45px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sr-star-lbl i {
  font-size: 11px;
  color: #cbd5e1;
}
.sr-track {
  flex: 1;
  height: 8px;
  background: #f1f5f9;
  border-radius: 10px;
  overflow: hidden;
}
.sr-fill {
  height: 100%;
  background: var(--sr-widget-accent);
  border-radius: 10px;
}
.sr-count-lbl {
  width: 25px;
  text-align: right;
}

/* Header Actions */
.sr-btn-primary {
  background: var(--sr-widget-accent) !important;
  color: #fff !important;
  border: none !important;
  padding: 12px 28px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.sr-btn-primary:hover {
  opacity: 0.9 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* --- 3. REVIEWS GRID --- */
.sr-reviews-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.sr-card {
  border: 1px solid var(--sr-border);
  border-radius: 12px;
  padding: 24px;
  background: #fff;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.sr-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

/* Card Header */
.sr-card-top {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}
.sr-avatar {
  width: 42px;
  height: 42px;
  background: #f1f5f9;
  color: var(--sr-text-gray);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  border: 1px solid var(--sr-border);
}
.sr-user-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  align-items: flex-start;
}
.sr-author-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--sr-text-dark);
}

/* Card Body */
.sr-card-body {
  flex: 1;
  margin-bottom: 20px;
}
.sr-card-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--sr-text-dark);
}
.sr-card-text {
  font-size: 15px;
  line-height: 1.6;
  color: #475569;
  margin-bottom: 12px;
}
.sr-mini-gallery {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.sr-mini-gallery img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--sr-border);
  cursor: pointer;
  transition: opacity 0.2s;
}
.sr-mini-gallery img:hover {
  opacity: 0.8;
}

/* Card Footer */
.sr-card-foot {
  border-top: 1px solid #f1f5f9;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sr-link-btn {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  color: var(--sr-text-gray) !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  cursor: pointer !important;
  transition: color 0.2s;
}
.sr-link-btn:hover {
  color: var(--sr-widget-accent) !important;
  text-decoration: underline;
}
.sr-date-lbl {
  font-size: 12px;
  color: #94a3b8;
}

/* --- 4. STARS COMPONENT (FIXED) --- */
/* Switched to FontAwesome to prevent box issues */
.sr-stars-static {
  display: inline-block;
  position: relative;
  font-size: 18px;
  color: #e2e8f0;
  line-height: 1;
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  letter-spacing: 2px;
}
/* Background (Empty Stars) */
.sr-stars-static::before {
  content: "\f005\f005\f005\f005\f005";
}
/* Foreground (Filled Stars) */
.sr-stars-static::after {
  content: "\f005\f005\f005\f005\f005";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--sr-star-color);
  overflow: hidden;
  width: calc(var(--v) * 20%);
  white-space: nowrap;
}
.sr-small {
  font-size: 14px;
  letter-spacing: 1px;
}

/* --- 5. IMPROVED MODALS --- */
.sr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px); /* Modern blur effect */
  padding: 20px;
}
.sr-modal-box {
  background: #fff;
  width: 100%;
  max-width: 550px;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: srModalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes srModalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.sr-modal-header {
  padding: 20px 30px;
  border-bottom: 1px solid var(--sr-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
}
.sr-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--sr-text-dark);
}
.sr-close-btn {
  font-size: 24px !important;
  cursor: pointer !important;
  color: #94a3b8 !important;
  transition: color 0.2s;
  line-height: 1;
}
.sr-close-btn:hover {
  color: #ef4444 !important;
}

.sr-modal-content {
  padding: 30px;
  overflow-y: auto;
  background: #f8fafc;
}

/* Modern Form Inputs */
.sr-field-group {
  margin-bottom: 20px;
}
.sr-field-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #334155;
}
.sr-field-group input[type="text"],
.sr-field-group input[type="email"],
.sr-field-group textarea {
  width: 100%;
  padding: 12px 16px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  font-size: 15px;
  transition:
    border 0.2s,
    box-shadow 0.2s !important;
  background: #fff !important;
}
.sr-field-group input:focus,
.sr-field-group textarea:focus {
  border-color: var(--sr-widget-accent) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px
    color-mix(in srgb, var(--sr-widget-accent) 20%, transparent) !important;
}

/* Interactive Star Rating (Write Review) */
.sr-write-stars {
  display: flex;
  align-items: center;
  gap: 15px;
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--sr-border);
  justify-content: center;
}
.sr-star-input-group {
  display: flex;
  flex-direction: row-reverse;
  gap: 6px;
}
.sr-star-input-group input {
  display: none;
}
.sr-star-input-group label {
  font-size: 28px;
  color: #cbd5e1;
  cursor: pointer;
  transition: transform 0.1s;
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin: 0 !important;
}
.sr-star-input-group label::before {
  content: "\f005";
}

/* Hover & Checked States */
.sr-star-input-group label:hover,
.sr-star-input-group label:hover ~ label,
.sr-star-input-group input:checked ~ label {
  color: var(--sr-star-color);
}
.sr-star-input-group label:hover {
  transform: scale(1.2);
}

.sr-rating-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--sr-widget-accent);
  min-width: 80px;
  text-align: left;
}

/* Photo Dropzone */
.sr-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 25px;
  text-align: center;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.sr-dropzone:hover {
  border-color: var(--sr-widget-accent);
  background: #f0f9ff;
}
.sr-dropzone i {
  font-size: 24px;
  color: var(--sr-widget-accent);
  margin-bottom: 8px;
  display: block;
}
.sr-dropzone span {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}
.sr-dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Photo Previews */
#sr-photo-previews {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}
.sr-thumb-wrap {
  position: relative;
  width: 60px;
  height: 60px;
}
.sr-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

/* Lightbox */
.sr-lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 100000;
  align-items: center;
  justify-content: center;
}
.sr-lightbox-overlay img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}
.sr-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #fff;
  font-size: 40px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.sr-lightbox-close:hover {
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .sr-header-section {
    flex-direction: column;
  }
  .sr-stats-card {
    width: 100%;
    padding: 20px;
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }
  .sr-bars-col {
    width: 100%;
  }
  .sr-modal-box {
    width: 95%;
    height: auto;
    max-height: 95vh;
  }
}

/* Load More Button Styles */
.sr-load-more-wrap {
  text-align: center;
  margin-top: 40px;
  margin-bottom: 20px;
}
.sr-btn-secondary {
  background: #fff !important;
  border: 1px solid var(--sr-border) !important;
  color: var(--sr-text-dark, #1e293b) !important;
  padding: 12px 32px !important;
  border-radius: 50px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}
.sr-btn-secondary:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
  color: var(--sr-widget-accent) !important;
}
.sr-btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Inline Shortcode Fixes */
.sr-inline-rating {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  line-height: 1;
}
.sr-inline-score,
.sr-inline-count {
  font-size: 16px;
  line-height: 1;
  color: var(--sr-text-dark);
}
.sr-inline-score {
  font-weight: 700;
}
.sr-inline-count {
  font-weight: 400;
  color: var(--sr-text-gray);
}
.sr-inline-rating .sr-stars-static {
  font-size: 16px;
  margin-bottom: 2px;
}

/* ===================================================================
   CARD REPLY PREVIEW  (sr_show_reply_on_card toggle)
   =================================================================== */

.sr-card-reply {
    background: #f8fafc;
    border-left: 3px solid var(--sr-widget-accent, #2563eb);
    padding: 10px 13px;
    margin: 12px 0 0;
    border-radius: 0 6px 6px 0;
}

.sr-card-reply-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    color: var(--sr-widget-accent, #2563eb);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}

.sr-card-reply-label i {
    font-size: 10px;
    opacity: 0.85;
}

.sr-card-reply-text {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
    font-style: italic;
}
