/* ═══════════════════════════════════════════════════════════════
 *  CoffeeChoice Reviews v4.0
 *
 *  RULES:
 *  - !important ONLY on structural (display, appearance, box-sizing)
 *    and on star buttons (theme nuclear reset).
 *  - Visual (color, bg, font, padding, border, radius) — NEVER !important.
 *  - High specificity via "body .ccr-form-shell" to beat typical theme CSS.
 *  - Elementor widget controls always win (higher specificity or !important).
 * ═══════════════════════════════════════════════════════════════ */

/* ── 0. STRUCTURAL RESET ── */
.ccr-form-shell *, .ccr-form-shell *::before, .ccr-form-shell *::after,
.ccr-reviews-modern *, .ccr-reviews-modern *::before, .ccr-reviews-modern *::after {
  box-sizing: border-box !important;
  float: none !important;
}

/* Hide WP/theme injections */
.ccr-form-shell p.comment-form-cookies-consent,
.ccr-form-shell p.logged-in-as,
.ccr-form-shell .comment-notes,
.ccr-form-shell .comment-form-comment,
.ccr-form-shell .comment-form-author,
.ccr-form-shell .comment-form-email,
.ccr-form-shell .comment-form-url,
.ccr-form-shell .form-submit,
.ccr-form-shell #cancel-comment-reply-link { display: none !important; }


/* ══════════════════════════════════════════════
 *  FORM
 * ══════════════════════════════════════════════ */

body .ccr-form-shell { width: 100%; }

/* ── Title ── */
body .ccr-form-shell .ccr-form-title {
  font-size: 44px;
  line-height: 1.1;
  font-weight: 800;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  background: transparent;
}
@media (max-width:640px) { body .ccr-form-shell .ccr-form-title { font-size: 34px; } }

/* ── Description ── */
body .ccr-form-shell .ccr-form-desc {
  color: rgba(17,24,39,.55);
  font-size: 15px;
  line-height: 1.65;
  margin: 0 0 24px;
  max-width: 820px;
  padding: 0;
  border: 0;
  background: transparent;
}

/* ── Labels ── */
body .ccr-form-shell .ccr-label {
  display: block !important;
  font-weight: 600;
  font-size: 14px;
  color: #ff7a00;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  background: transparent;
  line-height: 1.4;
}
body .ccr-form-shell .ccr-label .ccr-req { color: #ff3b30; }

body .ccr-form-shell .ccr-rating-label {
  display: block !important;
  font-weight: 600;
  font-size: 15px;
  color: rgba(17,24,39,.75);
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: transparent;
  line-height: 1.4;
}

/* ── Text Inputs ── */
body .ccr-form-shell .ccr-input,
body .ccr-form-shell .ccr-textarea {
  width: 100% !important;
  display: block !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  box-shadow: none !important;
  border: 0;
  border-bottom: 1px solid rgba(17,24,39,.14);
  border-radius: 0;
  background: transparent;
  padding: 10px 2px 12px;
  font-size: 16px;
  font-family: inherit;
  color: inherit;
  line-height: 1.5;
  transition: border-color .2s;
  height: auto;
  min-height: auto;
  max-width: 100%;
  margin: 0;
  outline: none;
}
body .ccr-form-shell .ccr-input:focus,
body .ccr-form-shell .ccr-textarea:focus {
  border-bottom-color: rgba(17,24,39,.4);
  background: transparent;
  outline: none;
}
body .ccr-form-shell .ccr-textarea { min-height: 56px; resize: vertical; }

/* ── Field Groups ── */
body .ccr-form-shell .ccr-field { margin: 0 0 28px; padding: 0; border: 0; }

body .ccr-form-shell .ccr-grid-2 {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}
@media (max-width:640px) { body .ccr-form-shell .ccr-grid-2 { grid-template-columns: 1fr; } }

/* ── Criteria Grid ── */
body .ccr-form-shell .ccr-criteria-grid {
  display: grid !important;
  gap: 28px;
  grid-template-columns: repeat(3,1fr);
  margin: 24px 0 0;
  padding: 24px 0 0;
  border: 0;
}
@media (max-width:640px) { body .ccr-form-shell .ccr-criteria-grid { grid-template-columns: 1fr; } }

body .ccr-form-shell .ccr-single-rating { margin: 22px 0 0; padding: 0; border: 0; }

body .ccr-form-shell .ccr-rating-field {
  --ccr-star-size: 26px; --ccr-star-on: #f5a623; --ccr-star-off: #d9d9d9; --ccr-gap: 8px;
  margin: 0; padding: 0; border: 0;
}

/* ── Star Buttons (nuclear !important needed — themes destroy these) ── */
body .ccr-form-shell .ccr-rating-group {
  display: inline-flex !important;
  align-items: center !important;
  gap: var(--ccr-gap) !important;
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 8px !important;
}
body .ccr-form-shell .ccr-rating-group button.ccr-star,
body .ccr-form-shell .ccr-rating-group .ccr-star {
  appearance: none !important;
  -webkit-appearance: none !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer !important;
  line-height: 1 !important;
  font-size: var(--ccr-star-size) !important;
  color: var(--ccr-star-off) !important;
  border-radius: 0 !important;
  transition: color .15s !important;
  min-width: auto !important;
  min-height: auto !important;
  width: auto !important;
  height: auto !important;
  display: inline-block !important;
  outline: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  text-decoration: none !important;
}
body .ccr-form-shell .ccr-rating-group button.ccr-star:hover,
body .ccr-form-shell .ccr-rating-group button.ccr-star:focus,
body .ccr-form-shell .ccr-rating-group button.ccr-star:active {
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}
body .ccr-form-shell .ccr-rating-group .ccr-star.is-on,
body .ccr-form-shell .ccr-rating-group button.ccr-star.is-on {
  color: var(--ccr-star-on) !important;
}
body .ccr-form-shell .ccr-rating-live { min-width: 16px; font-weight: 600; opacity: .75; }

/* ── Upload ── */
body .ccr-form-shell .ccr-upload-section { margin: 24px 0 0; padding: 22px 0 0; border: 0; }
body .ccr-form-shell .ccr-upload-title {
  font-weight: 700; font-size: 15px; margin: 0 0 14px;
  padding: 0; border: 0; background: transparent; color: inherit;
}
body .ccr-form-shell .ccr-upload-row {
  display: flex !important; align-items: center; gap: 18px; flex-wrap: wrap;
  margin: 0; padding: 0; border: 0;
}
body .ccr-form-shell .ccr-upload-btn {
  display: inline-flex !important; align-items: center; gap: 10px;
  color: #ff7a00; font-weight: 700; font-size: 15px;
  cursor: pointer; background: transparent; border: 0; padding: 0; margin: 0;
}
body .ccr-form-shell .ccr-upload-btn svg { width: 20px; height: 20px; }
body .ccr-form-shell .ccr-upload-hint { color: rgba(17,24,39,.40); font-size: 13px; }
body .ccr-form-shell .ccr-photo-preview {
  display: flex !important; gap: 10px; flex-wrap: wrap; margin: 12px 0 0; padding: 0; border: 0;
}

/* ── Checkbox ── */
body .ccr-form-shell .ccr-checkbox {
  display: flex !important; gap: 12px; align-items: flex-start;
  color: rgba(17,24,39,.55); font-size: 14px; line-height: 1.45;
  margin: 24px 0 0; padding: 18px 0 0; border: 0; background: transparent;
}
body .ccr-form-shell .ccr-checkbox input[type="checkbox"] {
  width: 16px; height: 16px; margin: 2px 0 0; flex-shrink: 0;
}

/* ── Submit Button ── */
body .ccr-form-shell button.ccr-submit,
body .ccr-form-shell .ccr-submit {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  cursor: pointer !important;
  box-shadow: none !important;
  outline: none !important;
  /* Visual — NO !important */
  margin: 24px 0 0;
  padding: 18px 34px;
  border-radius: 999px;
  border: 0;
  background: #ff7a00;
  color: #fff;
  font-weight: 900;
  min-width: 300px;
  text-transform: none;
  text-decoration: none;
  letter-spacing: normal;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.4;
  transition: background .2s, transform .1s;
}
body .ccr-form-shell button.ccr-submit:hover,
body .ccr-form-shell .ccr-submit:hover { background: #e66d00; }
body .ccr-form-shell .ccr-submit:active { transform: scale(.98); }
body .ccr-form-shell .ccr-submit:disabled { opacity: .6; cursor: wait !important; }
@media (max-width:640px) { body .ccr-form-shell .ccr-submit { min-width: 0; width: 100%; } }

/* ── Error / Success ── */
body .ccr-form-shell .ccr-form-error {
  margin: 16px 0 0; padding: 12px 18px;
  background: #fef2f2; color: #991b1b;
  border: 1px solid #fecaca; border-radius: 10px;
  font-size: 14px; line-height: 1.5;
}
body .ccr-form-shell .ccr-form-success { padding: 40px 0; text-align: center; }
body .ccr-form-shell .ccr-form-success .ccr-form-title {
  font-size: 28px; margin: 0 0 10px; color: #059669;
}
body .ccr-form-shell .ccr-form-success .ccr-form-desc {
  font-size: 16px; color: rgba(17,24,39,.65); margin: 0;
}


/* ══════════════════════════════════════════════
 *  REVIEWS LIST
 * ══════════════════════════════════════════════ */

.ccr-reviews-modern { color: var(--ccr-text,#111827); }

.ccr-r-item {
  display: flex !important;
  gap: var(--ccr-item-gap,16px);
  padding: var(--ccr-item-py,28px) 0;
  border: 0;
  border-bottom: 1px solid var(--ccr-divider,rgba(17,24,39,.08));
  margin: 0; background: transparent;
}
.ccr-r-item:last-of-type { border-bottom: 0; padding-bottom: 0; }

.ccr-r-avatar {
  width: var(--ccr-avatar-size,52px); height: var(--ccr-avatar-size,52px);
  border-radius: 999px; background: var(--ccr-avatar-bg,#f2f2f2);
  color: var(--ccr-avatar-text,#111827); display: flex !important;
  align-items: center; justify-content: center; font-weight: 700;
  flex: 0 0 auto; user-select: none;
  font-size: calc(var(--ccr-avatar-size,52px)*.4);
  border: 0; padding: 0; margin: 0;
}
img.ccr-r-avatar {
  display: block !important; object-fit: cover;
  width: var(--ccr-avatar-size,52px); height: var(--ccr-avatar-size,52px);
  min-width: var(--ccr-avatar-size,52px); min-height: var(--ccr-avatar-size,52px);
  max-width: var(--ccr-avatar-size,52px); max-height: var(--ccr-avatar-size,52px);
  border-radius: 50%;
}
img.ccr-reply-avatar {
  width: 36px; height: 36px;
  min-width: 36px; min-height: 36px;
  max-width: 36px; max-height: 36px;
}
.ccr-r-body { flex: 1 1 auto; min-width: 0; }
.ccr-r-author { font-weight: 700; }
.ccr-r-date { color: var(--ccr-muted,rgba(17,24,39,.55)); }
.ccr-r-text { margin: 6px 0 0; }
.ccr-r-text p:last-child { margin-bottom: 0; }

.ccr-overall-row {
  display: flex !important; align-items: center;
  gap: var(--ccr-overall-gap,10px); margin: 10px 0 0; flex-wrap: wrap;
}
.ccr-overall-stars { display: inline-flex !important; gap: 3px; line-height: 1; }
.ccr-overall-star { font-size: var(--ccr-overall-star-size,16px); color: var(--ccr-star-off,#e5e7eb); }
.ccr-overall-star.is-on { color: var(--ccr-star-on,#ff7a00); }
.ccr-overall-star.is-half { color: var(--ccr-star-on,#ff7a00); opacity: .55; }
.ccr-overall-num { color: var(--ccr-star-on,#ff7a00); font-weight: 800; }

.ccr-r-pills { display: flex !important; gap: var(--ccr-pill-gap,12px); flex-wrap: wrap; margin: 14px 0 0; }
.ccr-pill {
  display: inline-flex !important; align-items: center; gap: 10px;
  padding: var(--ccr-pill-py,10px) var(--ccr-pill-px,16px);
  background: var(--ccr-pill-bg,#f7f7f7);
  border: 1px solid var(--ccr-pill-border,rgba(17,24,39,.06));
  border-radius: var(--ccr-pill-radius,999px);
  line-height: 1; white-space: nowrap; margin: 0;
}
.ccr-pill-star { color: var(--ccr-star-on,#ff7a00); font-size: 14px; }
.ccr-pill-num { color: var(--ccr-star-on,#ff7a00); font-weight: 800; }
.ccr-pill-label { color: var(--ccr-text,#111827); opacity: .9; }

.ccr-r-photos { display: flex !important; gap: 10px; flex-wrap: wrap; margin: 12px 0 0; }
.ccr-r-photo {
  width: var(--ccr-photo,120px); height: var(--ccr-photo,120px);
  object-fit: cover; border-radius: var(--ccr-photo-radius,20px);
  border: 1px solid rgba(0,0,0,.08); display: block;
  transition: opacity .2s; padding: 0; margin: 0;
}
.ccr-r-photo:hover { opacity: .85; }

/* ── Load More ── */
.ccr-load-more-wrap { margin: var(--ccr-between,18px) 0 0; }
body .ccr-load-more,
body button.ccr-load-more {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  cursor: pointer !important;
  padding: 14px 32px;
  border-radius: 999px;
  border: 2px solid rgba(17,24,39,.12);
  background: transparent;
  font-weight: 700;
  font-size: 15px;
  color: #111827;
  font-family: inherit;
  text-transform: none;
  text-decoration: none;
  letter-spacing: normal;
  line-height: 1.4;
  margin: 0;
  outline: none;
  transition: all .2s;
  box-shadow: none !important;
}
body .ccr-load-more:hover, body button.ccr-load-more:hover {
  background: rgba(17,24,39,.04); border-color: rgba(17,24,39,.2);
}
body .ccr-load-more:disabled, body button.ccr-load-more:disabled {
  opacity: .5; cursor: not-allowed !important;
}

.ccr-reviews-empty { padding: 40px 20px; text-align: center; opacity: .6; font-size: 15px; }

/* ── Author row ── */
.ccr-r-top { display: flex !important; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 0 0 6px; }

/* ── Actions row: votes left, reply right ── */
.ccr-r-actions {
  display: flex !important; flex-direction: row !important;
  align-items: center !important; justify-content: space-between !important;
  gap: 16px !important; margin: 12px 0 0 !important; padding: 0 !important;
  flex-wrap: nowrap !important; width: 100% !important;
}
.ccr-r-actions > * { flex-shrink: 0 !important; }
.ccr-vote-btn {
  display: inline !important;
  color: rgba(17,24,39,.3) !important;
  font-size: 13px !important; cursor: pointer; transition: color .15s;
  background: none !important; border: 0 !important; padding: 0 !important; margin: 0 2px !important;
  -webkit-appearance: none !important; appearance: none !important;
  line-height: 1 !important; box-shadow: none !important;
  white-space: nowrap !important; vertical-align: middle !important;
}
.ccr-vote-btn:hover { color: rgba(17,24,39,.6) !important; }
.ccr-vote-btn.is-active.ccr-vote-like,
.ccr-vote-btn.is-active.ccr-vote-like svg { color: #059669 !important; stroke: #059669 !important; }
.ccr-vote-btn.is-active.ccr-vote-dislike,
.ccr-vote-btn.is-active.ccr-vote-dislike svg { color: #dc2626 !important; stroke: #dc2626 !important; }
.ccr-vote-btn svg { width: 16px !important; height: 16px !important; vertical-align: middle !important; display: inline !important; }
.ccr-vote-count { font-weight: 600 !important; font-size: 12px !important; display: inline !important; vertical-align: middle !important; }
.ccr-reply-toggle {
  color: rgba(17,24,39,.4) !important;
  font-size: 13px !important; font-weight: 500 !important; cursor: pointer;
  background: none !important; border: 0 !important; padding: 0 !important; margin: 0 !important;
  margin-left: auto !important;
  -webkit-appearance: none !important; appearance: none !important;
  transition: color .15s; text-decoration: none !important;
  box-shadow: none !important; white-space: nowrap !important;
}
.ccr-reply-toggle:hover { color: rgba(17,24,39,.65) !important; }

/* ── Reply Form ── */
.ccr-reply-form {
  margin: 12px 0 0; padding: 16px;
  background: rgba(17,24,39,.02); border-radius: 12px;
  border: 1px solid rgba(17,24,39,.06);
}
.ccr-reply-fields-guest {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 10px;
}
@media (max-width:640px) { .ccr-reply-fields-guest { grid-template-columns: 1fr; } }
.ccr-reply-text { min-height: 60px; margin: 0 0 10px; font-size: 14px; }
.ccr-reply-actions { display: flex; gap: 10px; }
.ccr-reply-submit {
  display: inline-flex !important; align-items: center; justify-content: center;
  padding: 8px 20px; border-radius: 999px; border: 0;
  background: #ff7a00; color: #fff; font-weight: 700; font-size: 13px;
  cursor: pointer; transition: background .2s;
  -webkit-appearance: none !important; appearance: none !important;
}
.ccr-reply-submit:hover { background: #e66d00; }
.ccr-reply-cancel {
  display: inline-flex !important; align-items: center;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid rgba(17,24,39,.12); background: transparent;
  color: rgba(17,24,39,.6); font-size: 13px; cursor: pointer;
  -webkit-appearance: none !important; appearance: none !important;
}
.ccr-reply-cancel:hover { background: rgba(17,24,39,.04); }

/* ── Replies (nested) ── */
.ccr-replies {
  margin: 16px 0 0; padding: 0 0 0 24px;
  border-left: 2px solid rgba(17,24,39,.06);
}
.ccr-reply-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid rgba(17,24,39,.04);
}
.ccr-reply-item:last-child { border-bottom: 0; padding-bottom: 0; }
.ccr-reply-avatar {
  width: 36px; height: 36px; font-size: 14px;
}
@media (max-width:767px) {
  .ccr-replies { padding-left: 16px; }
  .ccr-reply-avatar { width: 30px; height: 30px; font-size: 12px; }
  img.ccr-reply-avatar { width: 30px; height: 30px; min-width: 30px; min-height: 30px; max-width: 30px; max-height: 30px; }
  .ccr-r-votes { gap: 8px; }
  .ccr-vote-btn svg { width: 14px; height: 14px; }
  .ccr-reply-toggle { font-size: 12px; }
  .ccr-r-top { gap: 8px; }
}

/* ── Rating Display (per-star coloring, no overlay) ── */
.ccr-rating { display: inline-flex; align-items: center; flex-wrap: nowrap; gap: 8px; white-space: nowrap; }
.ccr-rating-col { display: inline-flex; flex-direction: column; gap: 6px; white-space: nowrap; }
.ccr-rating-number { white-space: nowrap; }
.ccr-rating-count { white-space: nowrap; }
.ccr-icons-scale { display: inline-flex !important; align-items: center !important; gap: 3px; line-height: 1 !important; vertical-align: middle; }
.ccr-icon { display: inline-block !important; line-height: 1 !important; }
.ccr-icon-full { color: #f5a623; }
.ccr-icon-empty { color: #d9d9d9; }
.ccr-icon-partial {
  position: relative !important;
  display: inline-block !important;
  line-height: 1 !important;
}
.ccr-icon-bg {
  color: #d9d9d9;
  display: inline-block !important;
  line-height: 1 !important;
}
.ccr-icon-fg {
  color: #f5a623;
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  display: inline-block !important;
  line-height: 1 !important;
}
.ccr-single-icon { line-height: 1; }

/* Legacy classes (backward compat if cached HTML exists) */
.ccr-icon-wrap { position: relative; display: inline-flex; line-height: 1; }
.ccr-icon-layer { display: inline-flex; gap: 3px; line-height: 1; }
.ccr-icon-layer.ccr-empty { color: #d9d9d9; }
.ccr-icon-layer.ccr-filled { color: #f5a623; position: absolute; left: 0; top: 0; bottom: 0; overflow: hidden; white-space: nowrap; }


/* ══════════════════════════════════════════════
 *  RESPONSIVE
 * ══════════════════════════════════════════════ */

/* ── Tablet (≤1024px) ── */
@media (max-width: 1024px) {
  body .ccr-form-shell .ccr-criteria-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

/* ── Mobile (≤767px) ── */
@media (max-width: 767px) {
  /* Form */
  body .ccr-form-shell .ccr-form-title { font-size: 28px; }
  body .ccr-form-shell .ccr-form-desc { font-size: 14px; margin-bottom: 18px; }
  body .ccr-form-shell .ccr-grid-2 { grid-template-columns: 1fr; gap: 18px; }
  body .ccr-form-shell .ccr-criteria-grid { grid-template-columns: 1fr; gap: 18px; padding-top: 18px; margin-top: 18px; }
  body .ccr-form-shell .ccr-field { margin-bottom: 20px; }
  body .ccr-form-shell .ccr-upload-section { margin-top: 18px; padding-top: 18px; }
  body .ccr-form-shell .ccr-upload-row { gap: 12px; }
  body .ccr-form-shell .ccr-checkbox { margin-top: 18px; padding-top: 14px; font-size: 13px; }
  body .ccr-form-shell button.ccr-submit,
  body .ccr-form-shell .ccr-submit {
    min-width: 0;
    width: 100%;
    padding: 16px 24px;
    font-size: 15px;
  }

  /* Reviews list */
  .ccr-r-item { gap: 12px; padding-top: 20px; padding-bottom: 20px; }
  .ccr-r-avatar { width: 40px; height: 40px; font-size: 16px; }
  img.ccr-r-avatar:not(.ccr-reply-avatar) { width: 40px; height: 40px; min-width: 40px; min-height: 40px; max-width: 40px; max-height: 40px; }
  .ccr-r-top { gap: 8px; }
  .ccr-r-author { font-size: 15px; }
  .ccr-r-date { font-size: 13px; }
  .ccr-r-text { font-size: 14px; }
  .ccr-r-pills { gap: 8px; margin-top: 10px; }
  .ccr-pill { padding: 7px 12px; font-size: 13px; gap: 6px; }
  .ccr-r-photos { gap: 8px; margin-top: 10px; }
  .ccr-r-photo { width: 80px; height: 80px; border-radius: 12px; }
  .ccr-overall-row { margin-top: 8px; gap: 6px; }

  /* Load more */
  body .ccr-load-more,
  body button.ccr-load-more {
    width: 100%;
    padding: 12px 24px;
    font-size: 14px;
  }
}

/* ── Small Mobile (≤480px) ── */
@media (max-width: 480px) {
  body .ccr-form-shell .ccr-form-title { font-size: 24px; }
  body .ccr-form-shell .ccr-rating-field { --ccr-star-size: 22px; }
  .ccr-r-avatar { width: 36px; height: 36px; font-size: 14px; }
  img.ccr-r-avatar:not(.ccr-reply-avatar) { width: 36px; height: 36px; min-width: 36px; min-height: 36px; max-width: 36px; max-height: 36px; }
  .ccr-r-photo { width: 64px; height: 64px; border-radius: 10px; }
  .ccr-pill { padding: 6px 10px; font-size: 12px; }
}
