/* Typing awareness indicator bubble for advisor */
.chat-typing-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #222;
  border: 1.5px solid #e3a535;
  border-radius: 18px 18px 18px 6px;
  padding: 14px 18px;
  font-size: 17px;
  min-width: 48px;
  min-height: 28px;
  align-self: flex-start;
  margin-bottom: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.chat-typing-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
}

.chat-typing-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 2px;
  background: #e3a535;
  border-radius: 50%;
  opacity: 0.7;
  animation: chat-typing-bounce 1.2s infinite both;
}
.chat-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.chat-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes chat-typing-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.7);
    opacity: 0.7;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}
/* Loading spinner for chat status */
.chat-loading-spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid #e3a535;
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: chat-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-left: 10px;
}

@keyframes chat-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
/* —— 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;
}

/* hero section */
.hero-section {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
}

.hero-image {
  width: 100%;
  max-width: 850px;
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  object-fit: cover;
}

/* 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;
}

.search-section select {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  border: 2px solid #000;
  border-radius: 8px;
  cursor: pointer;
  background-color: white;
  font-weight: 500;
}

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

/* chat section */

/* Chatbox with increased height */
.chatbox {
  margin: 32px 0;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 20px 16px 16px 16px;
  min-height: 620px;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

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

/* Chat window with more height and scroll */
.chat-window {
  padding: 18px 8px 18px 8px;
  font-size: 18px;
  line-height: 1.5;
  height: 620px;
  overflow-y: auto;
  background: #fafafa;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Message bubbles */
.chat-message {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 17px;
  word-break: break-word;
  margin-bottom: 0;
  display: inline-block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* User message bubble (right) */
.chat-message.user {
  background: var(--loreal-gold, #e3a535);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  border-bottom-left-radius: 18px;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}

/* Advisor message bubble (left) */
.chat-message.assistant {
  background: #fff;
  color: #222;
  border: 1.5px solid #e3a535;
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 18px;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}

/* 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;
  position: relative; /* for overlay positioning */
}

.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;
}

/* L'Oréal brand colors */
:root {
  --loreal-red: #ff003b;
  --loreal-gold: #e3a535;
}

/* Highlight selected product card with brand color */
.product-card.selected {
  border: 2px solid var(--loreal-red);
  background: #ffe6ec;
}

/* Style for remove button in selected products list */
.selected-product-remove {
  background: none;
  border: none;
  color: #d32f2f;
  font-size: 18px;
  cursor: pointer;
  margin-left: 8px;
  vertical-align: middle;
}

.selected-product-remove:hover {
  color: #b71c1c;
}

/* 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;
}

/* Description toggle button */
.product-desc-toggle {
  background: var(--loreal-gold);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.2s;
}

.product-desc-toggle:hover,
.product-desc-toggle:focus {
  background: var(--loreal-red);
  outline: none;
}

/* Product description overlay */
.product-desc-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.98);
  color: #222;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  font-size: 15px;
  z-index: 2;
  text-align: left;
  line-height: 1.6;
  transition: opacity 0.2s;
}

/* RTL support: set direction and flip layout for RTL languages */
html[dir="rtl"],
body[dir="rtl"] {
  direction: rtl;
}

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

body[dir="rtl"] .search-section,
body[dir="rtl"] .products-grid,
body[dir="rtl"] #selectedProductsList {
  flex-direction: row-reverse;
}

body[dir="rtl"] .product-card {
  flex-direction: row-reverse;
}

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

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

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

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

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

/* Ensure overlay and buttons look correct in RTL */
body[dir="rtl"] .product-desc-overlay {
  text-align: right;
}
