/* styles/style.css */
:root {
  --star-size: 20px;
  --star-color-empty: #dcdcdc;
  --star-color-full: #f5e800;
}
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: #f9fafb;
}

/* === Grid of cards === */
.reviews-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  padding: 20px;
}

/* === Review Card === */
.review-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s;
}
.review-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* === Review Text & Button === */
.review-text {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}
.review-content p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.6;
  font-size: 16px;
  margin: 0;
}
.review-content.expanded p {
  -webkit-line-clamp: unset;
  line-clamp: unset;
  max-height: none;
}
.toggle-btn {
  display: none;
  align-self: flex-end;
  background: none;
  border: none;
  color: #2563eb;
  cursor: pointer;
  margin-top: 8px;
  font-size: 14px;
  padding: 0;
}

.toggle-btn.visible {
  display: inline-block;
}

/* === Footer: две строки === */
.review-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

/* -- Строка 1: аватар + имя + рейтинг -- */
.review-footer .line1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.review-footer .line2 {
  font-size: 12px;
}

.user-block {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 1;
  min-width: 0;
}
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}
.user-info {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}
.user-name {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.role {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.2;
  flex: 0 0 auto;
}
.rating {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* === Звёзды === */
.stars {
  display: flex;
  flex-wrap: nowrap;
}
.star {
  width: var(--star-size);
  height: var(--star-size);
  position: relative;
  display: inline-block;
}
.star svg {
  width: 100%;
  height: 100%;
}
.star-empty path {
  fill: var(--star-color-empty);
}
.star-full path {
  fill: var(--star-color-full);
}
.star-half path {
  fill: var(--star-color-empty);
}
.star-half::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 50%; height: 100%;
  background: var(--star-color-full);
  mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 .587l3.668 7.431 8.2 1.191-5.934 5.786 1.4 8.174L12 18.897 4.666 23.169l1.4-8.174L.132 9.209l8.2-1.191z"/></svg>') no-repeat center/contain;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 .587l3.668 7.431 8.2 1.191-5.934 5.786 1.4 8.174L12 18.897 4.666 23.169l1.4-8.174L.132 9.209l8.2-1.191z"/></svg>') no-repeat center/contain;
}

/* === Пагинация === */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 40px 0;
  flex-wrap: wrap;
}
.pagination a,
.pagination span {
  background: #f3f4f6;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: #1f2937;
  font-size: 14px;
}
.pagination a:hover {
  background: #e5e7eb;
}
.pagination .active {
  background: #2563eb;
  color: #ffffff;
  font-weight: bold;
}

.leave-review-container {
  padding: 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 100%;
  margin: 20px;
}

.leave-review-container .review-intro {
  font-size: 14px;
  line-height: 1.6;
  color: #1f2937;
}

.leave-review-container .review-intro p {
  margin: 8px 0 0;
}

.leave-review-container h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.leave-review-container .review-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.leave-review-container textarea.input_text {
  width: 100%;
  max-width: 100%;
  min-height: 100px;
  resize: vertical;
  padding: 10px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
  box-sizing: border-box;
}

.leave-review-container .review-error,
.review-success {
  background: #fdecea;
  border: 1px solid #f5c2c7;
  color: #b71c1c;
  padding: 10px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 16px;
}

.review-success {
  background: #e6ffed;
  border-color: #a0d9b4;
  color: #256029;
  margin: 20px;
}

.leave-review-container input[type="submit"] {
  align-self: flex-start;
  min-width: 150px;
  height: 40px;
  cursor: pointer;
  font-weight: normal;
  background-color: #8ecd55;
  font-size: 18px;
  color: #ffffff;
  border: none;
  padding: initial;
}

