/* ============================================
   Zaitun Mehendi - Reviews Page Styles
   Beautiful Review System with Image Upload
   Mobile-First, Islamic Themed
   Updated: 2 reviews per row on mobile
   ============================================ */

/* Import base variables */
@import url('./global.css');

/* ===== Reviews Header ===== */
.reviews-header {
  padding: 40px 0 30px;
  text-align: center;
  position: relative;
  background: linear-gradient(135deg, var(--cream-50) 0%, var(--cream-200) 100%);
  border-radius: 0 0 50px 50px;
  margin-bottom: 30px;
  overflow: hidden;
}

.islamic-pattern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(circle at 20% 30%, var(--pattern-gold) 2px, transparent 2px);
  background-size: 50px 50px;
  opacity: 0.1;
  pointer-events: none;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.page-title {
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  color: var(--olive-900);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.title-decoration {
  font-size: 1.5rem;
  color: var(--gold-500);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.page-subtitle {
  font-size: 1rem;
  color: var(--ink-600);
  margin-bottom: 20px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Summary Section ===== */
.summary-section {
  margin-bottom: 30px;
}

.summary-card {
  background: white;
  border-radius: 30px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gold-200);
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.rating-overview {
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, var(--cream-50), var(--cream-100));
  border-radius: 20px;
}

.big-rating {
  font-size: 3rem;
  font-weight: 800;
  color: var(--olive-900);
  line-height: 1;
  margin-bottom: 8px;
}

.big-rating .out-of {
  font-size: 1.2rem;
  color: var(--ink-500);
  font-weight: 400;
}

.rating-stars {
  font-size: 1.3rem;
  color: #FFD700;
  margin-bottom: 8px;
  letter-spacing: 4px;
}

.total-reviews {
  color: var(--ink-600);
  font-size: 0.95rem;
}

.total-reviews span {
  font-weight: 700;
  color: var(--olive-700);
}

.rating-breakdown {
  padding: 8px 0;
}

.rating-bar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.rating-label {
  min-width: 45px;
  font-size: 0.9rem;
  color: var(--ink-700);
  font-weight: 500;
}

.rating-bar-container {
  flex: 1;
  height: 8px;
  background: var(--cream-200);
  border-radius: 10px;
  overflow: hidden;
}

.rating-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-500), var(--olive-600));
  border-radius: 10px;
  transition: width 0.5s ease;
}

.rating-count {
  min-width: 30px;
  font-size: 0.85rem;
  color: var(--ink-600);
  text-align: right;
}

.review-cta {
  text-align: center;
}

/* ===== Filter Section ===== */
.filter-section {
  margin-bottom: 24px;
}

.filter-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar {
  display: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid rgba(47, 79, 47, 0.2);
  border-radius: 50px;
  background: white;
  color: var(--ink-700);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pill i {
  color: var(--olive-600);
  font-size: 0.85rem;
}

.pill .count {
  background: var(--cream-200);
  color: var(--olive-700);
  padding: 2px 6px;
  border-radius: 50px;
  font-size: 0.7rem;
  margin-left: 4px;
}

.pill:hover {
  background: var(--cream-200);
  border-color: var(--gold-400);
  transform: translateY(-2px);
}

.pill.active {
  background: var(--olive-700);
  color: white;
  border-color: var(--olive-700);
}

.pill.active i {
  color: var(--gold-300);
}

.pill.active .count {
  background: var(--gold-500);
  color: var(--olive-900);
}

.sort-wrapper {
  min-width: 160px;
}

.sort-select {
  width: 100%;
  padding: 10px 32px 10px 16px;
  border: 1px solid var(--ink-200);
  border-radius: 50px;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%232F4F2F" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
}

.sort-select:focus {
  outline: none;
  border-color: var(--gold-500);
}

/* ===== Reviews Grid ===== */
.reviews-section {
  min-height: 300px;
  margin-bottom: 40px;
}

.reviews-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

/* Review Card */
.review-card {
  background: white;
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(212, 175, 55, 0.1);
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.review-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  border-color: var(--gold-300);
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.reviewer-info {
  display: flex;
  gap: 10px;
  align-items: center;
}

.reviewer-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold-300);
}

.reviewer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reviewer-details {
  display: flex;
  flex-direction: column;
}

.reviewer-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-900);
  margin: 0;
  line-height: 1.3;
}

.review-date {
  font-size: 0.7rem;
  color: var(--ink-500);
}

.verified-badge {
  font-size: 0.7rem;
  color: var(--olive-700);
  background: var(--cream-200);
  padding: 3px 8px;
  border-radius: 50px;
  white-space: nowrap;
}

.verified-badge i {
  color: var(--gold-500);
  margin-right: 3px;
}

.review-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.stars-display {
  color: #FFD700;
  font-size: 1rem;
  letter-spacing: 2px;
}

.rating-number {
  font-size: 0.8rem;
  color: var(--ink-600);
  font-weight: 500;
}

.review-comment {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink-800);
  margin-bottom: 12px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.review-image {
  margin-bottom: 12px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
}

.review-img-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.review-img-thumb:hover {
  transform: scale(1.05);
}

.review-product {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--cream-100);
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  color: var(--olive-700);
  margin-bottom: 10px;
}

.review-actions {
  display: flex;
  gap: 15px;
  margin-top: 8px;
  border-top: 1px solid var(--cream-300);
  padding-top: 10px;
}

.review-action {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-600);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.review-action i {
  font-size: 1rem;
}

.review-action:hover {
  color: var(--olive-700);
  transform: scale(1.05);
}

/* ===== Before/After Section ===== */
.before-after-section {
  padding: 30px 0;
  background: var(--cream-50);
  border-radius: 40px;
  margin-bottom: 30px;
}

.section-header {
  text-align: center;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.6rem;
  color: var(--olive-900);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.title-icon {
  font-size: 1.3rem;
  color: var(--gold-500);
}

.section-subtitle {
  color: var(--ink-600);
  font-size: 0.95rem;
}

.ba-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 0 16px;
}

.ba-item {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.ba-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}

.ba-image {
  position: relative;
  aspect-ratio: 4/5;
}

.ba-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ba-label {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  color: var(--olive-800);
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--gold-300);
}

/* ===== Instagram Reviews ===== */
.instagram-reviews {
  padding: 30px 0;
}

.instagram-reviews-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* ===== Modal Styles ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none;
}

.modal.open {
  display: block;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  background: white;
  border-radius: 24px;
  box-shadow: var(--shadow-2xl);
  animation: slideUp 0.4s ease;
}

.modal-container.modal-large {
  max-width: 700px;
}

.modal-container.modal-small {
  max-width: 500px;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--cream-300);
  background: white;
  position: sticky;
  top: 0;
  z-index: 2;
}

.modal-title {
  font-size: 1.2rem;
  color: var(--olive-800);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--cream-200);
  border-radius: 50%;
  color: var(--ink-600);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--error);
  color: white;
  transform: rotate(90deg);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--cream-300);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: white;
  position: sticky;
  bottom: 0;
}

/* ===== Review Form ===== */
.review-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-800);
}

.required {
  color: var(--error);
}

.rating-input {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.stars-input {
  display: flex;
  gap: 5px;
  font-size: 1.5rem;
  color: #FFD700;
  cursor: pointer;
}

.stars-input i {
  transition: all 0.2s ease;
}

.stars-input i:hover {
  transform: scale(1.2);
}

.rating-text {
  font-size: 0.9rem;
  color: var(--ink-600);
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--ink-200);
  border-radius: 12px;
  font-family: var(--font-primary);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--ink-200);
  border-radius: 12px;
  font-family: var(--font-primary);
  font-size: 0.95rem;
  resize: vertical;
  min-height: 100px;
  transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.form-text {
  font-size: 0.8rem;
  color: var(--ink-500);
}

/* Upload Area */
.upload-area {
  border: 2px dashed var(--gold-300);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  background: var(--cream-50);
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-area:hover {
  border-color: var(--gold-500);
  background: var(--cream-100);
}

.upload-content i {
  font-size: 2.5rem;
  color: var(--olive-600);
  margin-bottom: 10px;
}

.upload-content p {
  font-size: 1rem;
  color: var(--ink-700);
  margin-bottom: 5px;
}

.upload-content small {
  font-size: 0.8rem;
  color: var(--ink-500);
}

/* Image Preview */
.image-preview {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 10px;
}

.image-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 12px;
}

.remove-image {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-image:hover {
  background: var(--error);
  transform: scale(1.1);
}

/* Upload Progress */
.upload-progress {
  margin-top: 10px;
  padding: 15px;
  background: var(--cream-100);
  border-radius: 12px;
  text-align: center;
}

.progress-bar {
  height: 6px;
  background: linear-gradient(90deg, var(--gold-500), var(--olive-600));
  border-radius: 3px;
  margin-bottom: 8px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--ink-600);
}

/* Consent Group */
.consent-group {
  margin-top: 10px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--ink-700);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* ===== Crop Modal ===== */
.crop-container {
  max-height: 400px;
  overflow: hidden;
}

.crop-container img {
  max-width: 100%;
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  display: none;
}

.lightbox.open {
  display: block;
}

.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  animation: fadeIn 0.3s ease;
}

.lightbox-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  max-width: 900px;
  background: white;
  border-radius: 20px;
  overflow: hidden;
}

.lightbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--cream-300);
  background: white;
}

.lightbox-title {
  font-size: 1rem;
  color: var(--olive-800);
  margin: 0;
}

.lightbox-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--cream-200);
  border-radius: 50%;
  color: var(--ink-600);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lightbox-close:hover {
  background: var(--error);
  color: white;
}

.lightbox-body {
  padding: 16px;
  text-align: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

/* ===== WhatsApp Float ===== */
.whatsapp-float {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
  transition: all 0.3s ease;
  z-index: 100;
  text-decoration: none;
}

.whatsapp-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

/* ===== Loading & Empty States ===== */
.loading-state,
.empty-state {
  text-align: center;
  padding: 40px 20px;
  background: white;
  border-radius: 24px;
  box-shadow: var(--shadow-md);
}

.loading-state .loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--cream-300);
  border-top-color: var(--gold-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state i {
  font-size: 3rem;
  color: var(--ink-300);
  margin-bottom: 15px;
}

.empty-state h3 {
  color: var(--ink-700);
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.empty-state p {
  color: var(--ink-500);
  margin-bottom: 20px;
  font-size: 0.95rem;
}

/* ===== Load More Button ===== */
.load-more-container {
  text-align: center;
  margin-top: 20px;
}

.btn-large {
  padding: 12px 28px;
  font-size: 1rem;
}

/* ===== Toast Container ===== */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: white;
  border-radius: 50px;
  padding: 12px 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInLeft 0.3s ease;
  max-width: 350px;
  border-left: 4px solid;
}

.toast-success {
  border-left-color: var(--success);
}

.toast-error {
  border-left-color: var(--error);
}

.toast-info {
  border-left-color: var(--info);
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== Responsive Design ===== */
@media (min-width: 640px) {
  .summary-card {
    grid-template-columns: 1fr 1.5fr auto;
    align-items: center;
  }
  
  .rating-overview {
    text-align: left;
  }
  
  .filter-wrapper {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .reviews-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .ba-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .instagram-reviews-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .reviews-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .reviews-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .instagram-reviews-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .page-title {
    font-size: 2.2rem;
  }
}

@media (min-width: 1280px) {
  .reviews-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Mobile Optimizations */
@media (max-width: 480px) {
  .review-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .verified-badge {
    align-self: flex-start;
  }
  
  .review-actions {
    justify-content: space-around;
  }
  
  .modal-container {
    width: 98%;
    max-height: 95vh;
  }
  
  .rating-input {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .stars-input {
    font-size: 1.3rem;
  }
}

/* ===== Print Styles ===== */
@media print {
  .filter-section,
  .review-cta,
  .review-actions,
  .load-more-container,
  .whatsapp-float,
  .modal {
    display: none;
  }
  
  .review-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ===== Animations ===== */
.animate-fade-up {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeUp 0.6s ease forwards;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hidden {
  display: none !important;
}

/* Avatar Initials Styles */
.reviewer-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background-color: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reviewer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  background-color: #6366f1; /* Fallback color */
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .reviewer-avatar {
    background-color: #374151;
  }
}