/* —— basic reset —— */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* —— body + fonts —— */
body {
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
  color: #333;
  display: flex;
  justify-content: center;
}

.page-wrapper {
  width: 90%;
  max-width: 900px;
}

/* header */
.site-header {
  text-align: center;
  padding-top: 50px;
  padding-bottom: 10px;
}

.logo {
  width: 250px;
  margin-bottom: 15px;
}

.site-title {
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 10px;
}

/* category filter */
.search-section {
  margin: 30px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.search-section input,
.search-section select,
.search-section button {
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid #ccc;
  border-radius: 8px;
  background-color: white;
}

.search-section input {
  flex: 1;
  min-width: 220px;
}

.search-section select {
  width: 220px;
  cursor: pointer;
}

.search-section button {
  cursor: pointer;
  background-color: #000;
  color: #fff;
  border: none;
}

.search-section button:hover {
  background-color: #444;
}

.search-section select:focus,
.search-section input:focus,
.search-section button:focus {
  outline: none;
  border-color: #666;
}

/* chat section */
.chatbox {
  margin: 40px 0;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 26px;
}

.chatbox h2 {
  font-size: 20px;
  margin-bottom: 20px;
}

.chat-window {
  padding: 20px;
  font-size: 18px;
  line-height: 1.5;
  height: 250px;
  overflow-y: auto;
  background: #fafafa;
  margin-bottom: 20px;
}

.chat-message {
  margin-bottom: 16px;
}

.chat-author {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: #666;
}

.chat-bubble {
  display: inline-block;
  max-width: 100%;
  padding: 16px;
  border-radius: 18px;
  line-height: 1.6;
  word-break: break-word;
}

.chat-message.user .chat-bubble {
  background: #f1f1f1;
  color: #111;
}

.chat-message.assistant .chat-bubble {
  background: #000;
  color: #fff;
}

/* placeholder message */
.placeholder-message {
  width: 100%;
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 18px;
}

/* input row */
.chat-form {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.chat-form input {
  flex: 1;
  padding: 12px;
  font-size: 18px;
  border: none;
  border-bottom: 2px solid #ccc;
  background: transparent;
}

.chat-form input:focus {
  outline: none;
  border-bottom-color: #000;
}

.chat-form button {
  font-size: 18px;
  background: #000;
  color: #fff;
  border: none;
  padding: 12px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s;
}

.chat-form button:hover {
  background: #666666;
}

.chat-form button:focus {
  outline: 2px solid #000;
  outline-offset: 2px;
}

/* visually hidden */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* footer */
.site-footer {
  margin: 60px 0 40px;
  text-align: center;
  font-size: 14px;
  color: #666;
}

.site-footer nav {
  margin-top: 12px;
}

.site-footer a {
  margin: 0 8px;
  color: #000;
  text-decoration: none;
}

.site-footer a:hover {
  color: #666666;
}

/* products grid */
.products-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 30px 0;
}

.product-card {
  flex: 0 1 calc(33.333% - 14px);
  border: 1px solid #ccc;
  padding: 15px;
  border-radius: 4px;
  display: flex;
  gap: 15px;
  min-height: 160px;
}

.product-card img {
  width: 110px;
  height: 110px;
  object-fit: contain;
  flex-shrink: 0;
}

.product-card .product-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 110px;
}

.product-card h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.product-card p {
  font-size: 14px;
  color: #666;
}

.details-btn {
  border: none;
  background: none;
  color: #000;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-top: 8px;
  text-align: left;
}

.product-description {
  display: none;
  font-size: 13px;
  color: #444;
  margin-top: 10px;
  line-height: 1.5;
}

.product-description.visible {
  display: block;
}

.product-selected-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  font-size: 12px;
  color: #333;
  font-weight: 700;
}

.product-card.selected {
  border-color: #000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
  background: #fff8eb;
}

.chat-window.empty::before {
  content: "Your routine summary and follow-up answers will appear here.";
  display: block;
  color: #666;
  font-size: 16px;
  text-align: center;
  padding: 60px 20px;
}

.selected-products-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.clear-btn {
  padding: 12px 16px;
  font-size: 14px;
  border: 2px solid #000;
  border-radius: 8px;
  background: #fff;
  color: #000;
  cursor: pointer;
}

.clear-btn:hover {
  background: #000;
  color: #fff;
}

.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #ccc;
  background: #f5f5f5;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 14px;
}

.selected-chip button {
  border: none;
  background: transparent;
  color: #900;
  cursor: pointer;
  font-size: 16px;
}

.product-card {
  flex: 0 1 calc(33.333% - 14px);
  border: 1px solid #ccc;
  padding: 15px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 260px;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.product-card:hover {
  transform: translateY(-2px);
}

.product-card img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  border-radius: 6px;
}

.product-card.selected .product-selected-label {
  color: #000;
}

body[dir="rtl"] {
  direction: rtl;
}

body[dir="rtl"] .search-section {
  direction: rtl;
}

body[dir="rtl"] .selected-products-header,
body[dir="rtl"] .chat-form {
  flex-direction: row-reverse;
}

body[dir="rtl"] .chat-form input {
  text-align: right;
}

body[dir="rtl"] .product-card {
  text-align: right;
}

body[dir="rtl"] .chat-message.user .chat-bubble {
  align-self: flex-start;
}

body[dir="rtl"] .chat-message.assistant .chat-bubble {
  align-self: flex-end;
}

/* selected products */
.selected-products {
  margin: 40px 0;
  padding: 20px;
  border: 2px solid #000;
  border-radius: 8px;
}

.selected-products h2 {
  font-size: 20px;
  margin-bottom: 20px;
}

#selectedProductsList {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.generate-btn {
  width: 100%;
  margin-top: 20px;
  padding: 16px;
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  background: #000;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s;
}

.generate-btn:hover {
  background: #666;
}

.generate-btn i {
  margin-right: 8px;
}
