/* =========================================
   COFFEE REPUBLIC — REVIEWS PAGE
   ========================================= */

/* Force hidden attribute — prevents CSS from accidentally showing hidden elements */
[hidden] { display: none !important; }

/* ── Page Hero (shared pattern) ────────────────────────────────────────────── */

.page-hero {
  padding-block: clamp(60px, 9vw, 120px);
  text-align: center;
}

.page-hero-inner {
  max-width: 760px;
  margin-inline: auto;
}

.page-hero h1 {
  margin-block: 18px 20px;
}

.page-hero-description {
  max-width: 58ch;
  margin-inline: auto;
  font-size: 1.05rem;
  line-height: 1.8;
  opacity: 0.75;
  color: var(--color-cream);
}

/* ── Reviews Grid ─────────────────────────────────────────────────────────── */

.reviews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: clamp(16px, 2.5vw, 28px);
  margin-top: clamp(32px, 5vw, 56px);
}

/* ── Review Card ──────────────────────────────────────────────────────────── */

.review-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px 28px 24px;
  border-radius: var(--radius-medium);
  background: #fff;
  box-shadow: 0 2px 16px rgba(24, 11, 13, 0.06);
  animation: card-appear 0.4s ease both;
  transition:
    transform var(--transition-smooth),
    box-shadow var(--transition-smooth);
}

@keyframes card-appear {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.review-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(24, 11, 13, 0.1);
}

.review-stars {
  display: flex;
  gap: 3px;
}

.review-star {
  font-size: 1.1rem;
  color: #d4a017;
  line-height: 1;
}

.review-star.is-empty {
  color: rgba(24, 11, 13, 0.18);
}

.review-content {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.85;
  color: var(--color-espresso);
  opacity: 0.85;
  /* Limit long reviews to 6 lines */
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.review-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid rgba(24, 11, 13, 0.08);
}

.review-author {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-espresso);
}

.review-date {
  font-size: 0.72rem;
  opacity: 0.5;
}

.review-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-espresso);
  margin-bottom: 2px;
}

.review-visit-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  background: rgba(24,11,13,0.06);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-espresso);
  opacity: 0.7;
}

/* ── Skeleton loading ─────────────────────────────────────────────────────── */

.review-skeleton {
  height: 200px;
  border-radius: var(--radius-medium);
  background: linear-gradient(
    90deg,
    rgba(24, 11, 13, 0.06) 25%,
    rgba(24, 11, 13, 0.10) 50%,
    rgba(24, 11, 13, 0.06) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Empty state ──────────────────────────────────────────────────────────── */

.reviews-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  gap: 14px;
}

.reviews-empty-icon {
  font-size: 3rem;
  opacity: 0.3;
}

.reviews-empty h3 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.reviews-empty p {
  opacity: 0.65;
  max-width: 42ch;
  margin-inline: auto;
}

/* ── Write Review Section ─────────────────────────────────────────────────── */

.write-review-section {
  /* surface-dark handles background */
}

.write-review-inner {
  max-width: 640px;
  margin-inline: auto;
}

/* ── Auth Gate ────────────────────────────────────────────────────────────── */

.auth-gate {
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 4vw, 40px);
}

.auth-gate-copy h2 {
  margin-block: 14px 12px;
}

/* Auth tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  border-radius: var(--radius-small);
  overflow: hidden;
  border: 1.5px solid rgba(255, 244, 240, 0.2);
  width: fit-content;
}

.auth-tab {
  padding: 11px 28px;
  border: none;
  background: transparent;
  color: var(--color-cream);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.6;
  transition:
    background var(--transition-smooth),
    opacity var(--transition-fast);
}

.auth-tab.is-active {
  background: var(--color-pink);
  color: var(--color-espresso);
  opacity: 1;
}

.auth-tab:hover:not(.is-active) {
  opacity: 1;
  background: rgba(255, 244, 240, 0.08);
}

/* Auth panels */
.auth-panel {
  display: flex;
  flex-direction: column;
}

.auth-panel[hidden] {
  display: none;
}

/* ── Shared Form Styles ───────────────────────────────────────────────────── */

.auth-form,
.review-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.form-group label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-cream);
  opacity: 0.85;
}

.form-group input,
.form-group textarea {
  padding: 14px 16px;
  border: 1.5px solid rgba(255, 244, 240, 0.2);
  border-radius: var(--radius-small);
  background: rgba(255, 244, 240, 0.07);
  color: var(--color-cream);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.6;
  transition: border-color var(--transition-fast);
  resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(255, 244, 240, 0.38);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-pink);
}

.form-group input:user-invalid,
.form-group textarea:user-invalid {
  border-color: #e94f4f;
}

.char-counter {
  align-self: flex-end;
  font-size: 0.7rem;
  opacity: 0.5;
  color: var(--color-cream);
}

.auth-submit,
.review-submit-btn {
  align-self: flex-start;
  min-width: 200px;
}

.form-error {
  padding: 12px 16px;
  border-radius: var(--radius-small);
  background: rgba(233, 79, 79, 0.18);
  border: 1px solid rgba(233, 79, 79, 0.4);
  color: #ffb3b3;
  font-size: 0.82rem;
  line-height: 1.6;
}

.form-success {
  padding: 12px 16px;
  border-radius: var(--radius-small);
  background: rgba(79, 189, 79, 0.18);
  border: 1px solid rgba(79, 189, 79, 0.4);
  color: #b3ffb3;
  font-size: 0.82rem;
  line-height: 1.6;
}

/* ── Logged-in user bar ───────────────────────────────────────────────────── */

.review-user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: var(--radius-small);
  background: rgba(255, 244, 240, 0.07);
  border: 1px solid rgba(255, 244, 240, 0.15);
  font-size: 0.82rem;
  color: var(--color-cream);
  gap: 12px;
}

.logout-btn {
  padding: 6px 14px;
  border: 1px solid rgba(255, 244, 240, 0.3);
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--color-cream);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);
  flex-shrink: 0;
}

.logout-btn:hover {
  background: rgba(255, 244, 240, 0.1);
  border-color: rgba(255, 244, 240, 0.5);
}

/* ── Review form panel ────────────────────────────────────────────────────── */

.review-form-panel {
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 4vw, 36px);
}

.review-form-panel[hidden] {
  display: none;
}

/* ── Star rating ──────────────────────────────────────────────────────────── */

.rating-fieldset {
  border: none;
  padding: 0;
}

.rating-fieldset legend {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-cream);
  opacity: 0.85;
  margin-bottom: 12px;
}

.star-rating {
  display: flex;
  gap: 6px;
}

.star-btn {
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(255, 244, 240, 0.25);
  cursor: pointer;
  font-size: 2.2rem;
  line-height: 1;
  transition:
    color var(--transition-fast),
    transform var(--transition-fast);
}

.star-btn:hover,
.star-btn.is-active {
  color: #d4a017;
  transform: scale(1.15);
}

/* ── Visit Type selector ──────────────────────────────────────────────────── */

.visit-type-fieldset {
  border: none;
  padding: 0;
}

.visit-type-fieldset legend {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-cream);
  opacity: 0.85;
  margin-bottom: 14px;
}

.visit-type-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.visit-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px;
  border: 1.5px solid rgba(255, 244, 240, 0.18);
  border-radius: var(--radius-medium);
  background: rgba(255, 244, 240, 0.05);
  color: var(--color-cream);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  transition:
    background var(--transition-smooth),
    border-color var(--transition-smooth),
    color var(--transition-smooth);
}

.visit-type-btn:hover {
  border-color: rgba(255, 244, 240, 0.4);
  background: rgba(255, 244, 240, 0.1);
}

.visit-type-btn.is-active {
  border-color: var(--color-pink);
  background: rgba(233, 79, 134, 0.15);
  color: var(--color-pink);
}

.visit-type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.visit-type-icon svg {
  width: 36px;
  height: 36px;
  stroke: currentColor;
}

/* ── Two-column form row ──────────────────────────────────────────────────── */

.form-row-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Label with SVG icon ──────────────────────────────────────────────────── */

.form-group label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-cream);
  opacity: 0.85;
}

.form-label-icon {
  display: inline-flex;
  align-items: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.form-label-icon svg {
  width: 16px;
  height: 16px;
  stroke: var(--color-pink);
}

/* ── Thank You modal overlay ──────────────────────────────────────────────── */

.thankyou-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 11, 13, 0.6);
  backdrop-filter: blur(4px);
  animation: overlay-in 0.25s ease;
}

.thankyou-modal-overlay[hidden] {
  display: none;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Thank You card ───────────────────────────────────────────────────────── */

.thankyou-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 32px 40px;
  gap: 18px;
  background: #fff;
  border-radius: var(--radius-large);
  box-shadow: 0 24px 60px rgba(24, 11, 13, 0.25);
  max-width: 360px;
  width: 100%;
  animation: card-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes card-pop {
  from { opacity: 0; transform: scale(0.8) translateY(20px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

.thankyou-card[hidden] {
  display: none;
}

/* Pulsing concentric rings + heart */
.thankyou-heart {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thankyou-heart::before,
.thankyou-heart::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  animation: heart-pulse 2s ease-out infinite;
}

.thankyou-heart::before {
  width: 100px;
  height: 100px;
  background: rgba(233, 79, 134, 0.12);
  animation-delay: 0s;
}

.thankyou-heart::after {
  width: 72px;
  height: 72px;
  background: rgba(233, 79, 134, 0.18);
  animation-delay: 0.3s;
}

@keyframes heart-pulse {
  0%   { transform: scale(0.9); opacity: 1; }
  70%  { transform: scale(1.1); opacity: 0.4; }
  100% { transform: scale(0.9); opacity: 1; }
}

.thankyou-heart-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-pink);
  font-size: 1.6rem;
  color: #fff;
  line-height: 1;
}

.thankyou-title {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 600;
  color: var(--color-espresso);
  letter-spacing: -0.02em;
}

.thankyou-text {
  font-size: 0.92rem;
  color: var(--color-espresso);
  opacity: 0.65;
  max-width: 28ch;
  line-height: 1.6;
}

.thankyou-btn {
  min-width: 180px;
  background: var(--color-espresso);
  color: var(--color-cream);
  border-color: var(--color-espresso);
}

.thankyou-btn:hover {
  background: var(--color-pink);
  border-color: var(--color-pink);
  color: var(--color-espresso);
}

@media (max-width: 480px) {
  .form-row-two {
    grid-template-columns: 1fr;
  }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .auth-tabs {
    width: 100%;
  }

  .auth-tab {
    flex: 1;
    text-align: center;
  }

  .auth-submit,
  .review-submit-btn {
    width: 100%;
    align-self: stretch;
  }

  .reviews-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .review-skeleton,
  .review-card {
    animation: none;
  }

  .review-card:hover,
  .star-btn:hover,
  .star-btn.is-active {
    transform: none;
  }
}
