* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #424658;
  --surface: #363949;
  --text: #E0CDB2;
  --accent: #87CEEB;
  --highlight: #F4E4C1;
  --shadow: rgba(0, 0, 0, 0.35);
  --dark-gray: #333;
  --very-dark: #222;
  --yellow: #ffc107;
  --gradient-surface: #36394a;
  --accent-dark: #5a9fb5;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 10px 10px 10px;
}

.page {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.chat-container {
  width: 100%;
  max-width: 700px;
  height: 90vh;
  max-height: 800px;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 20px 60px var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: visible;
  margin: 0 auto;
}

.chat-header {
  background: linear-gradient(135deg, var(--bg) 0%, var(--gradient-surface) 100%);
  color: var(--text);
  padding: 10px 20px 10px 20px;
  text-align: center;
  border-bottom: 1px solid rgba(240, 228, 193, 0.2);
}

.hero {
  margin: 0;
}

.hero h1 {
  font-size: 1.8rem;
  margin: -6px 0 4px;
  color: var(--text);
}

.hero h1 a {
  color: var(--text);
  font-size: 0.5em;
  margin-left: 30px;
  text-decoration: none;
}

.hero h1 a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.subtitle {
  margin: 0;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text);
  opacity: 0.95;
  line-height: 1.4;
}

.products-section {
  margin-top: 20px;
  text-align: center;
}

.products-label {
  font-size: 0.9rem;
  color: var(--highlight);
  font-weight: 600;
  letter-spacing: 0.01em;
  display: block;
  margin-bottom: 10px;
}

.product-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px 15px;
  max-width: 100%;
  justify-items: center;
}

.product-text {
  color: var(--text);
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  text-align: center;
}

@media (max-width: 900px) {
  .product-list {
    grid-template-columns: repeat(4, 1fr);
  }
  .product-text {
    font-size: 0.85rem;
  }
}

@media (max-width: 600px) {
  .product-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px 12px;
  }
  .product-text {
    font-size: 0.8rem;
  }
}

@media (max-width: 380px) {
  .product-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 10px;
  }
  .product-text {
    font-size: 0.75rem;
  }
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Firefox scrollbar styling */
  scrollbar-width: auto;
  scrollbar-color: var(--highlight) var(--surface);
}

/* WebKit browsers (Chrome, Safari, Edge, Brave) */
.chat-messages::-webkit-scrollbar {
  width: 20px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 20px;
  margin: 2px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--highlight);
  border-radius: 20px;
  border: 3px solid var(--surface);
  background-clip: padding-box;
}

.message {
  display: flex;
  animation: slideIn 0.3s ease;
}

.message.typing-indicator .message-content {
  opacity: 0.7;
  font-style: italic;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.bot {
  justify-content: flex-start;
}

.message.user {
  justify-content: flex-end;
}

.message-content {
  max-width: 70%;
  padding: 8px 8px;
  border-radius: 18px;
  line-height: 1.25;
  word-wrap: break-word;
  font-size: 13px;
}

.message-timestamp {
  font-size: 0.7rem;
  opacity: 0.6;
  margin-top: 2px;
  padding: 0 8px;
  text-align: right;
}

.user .message-content {
  background: var(--highlight);
  color: var(--dark-gray);
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.bot .message-content {
  background: var(--surface);
  color: var(--text);
  border: 1px solid rgba(240, 228, 193, 0.2);
  border-bottom-left-radius: 4px;
}

.message-content strong {
  color: var(--highlight);
  font-weight: 600;
}

.qa-question {
  margin-bottom: 8px;
}

.product-card {
  background: var(--surface);
  border: 1px solid rgba(240, 228, 193, 0.2);
  border-radius: 12px;
  padding: 14px;
  margin: 8px 0;
  font-size: 0.9rem;
  box-shadow: 0 4px 10px var(--shadow);
}

.product-name {
  font-weight: 700;
  color: var(--highlight);
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.product-price {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  margin: 6px 0;
}

.product-specs {
  font-size: 0.85rem;
  color: var(--text);
  margin: 8px 0;
  line-height: 1.4;
  opacity: 0.9;
}

.product-features {
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 6px;
  opacity: 0.9;
}

.product-rating {
  color: var(--yellow);
  font-weight: 600;
  margin-top: 6px;
}

.faq-item {
  background: rgba(54, 57, 73, 0.4);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 12px 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.faq-item strong {
  color: var(--highlight);
  display: inline;
  margin-bottom: 4px;
  font-weight: 600;
}

.chat-input-area {
  display: flex;
  padding: 15px;
  background: var(--surface);
  border-top: 1px solid rgba(240, 228, 193, 0.2);
  gap: 10px;
}

.input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  flex: 1;
  padding: 10px 45px 10px 15px;
  border: 2px solid rgba(240, 228, 193, 0.3);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.3s;
  width: 100%;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--accent);
}

.char-counter {
  position: absolute;
  right: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #666;
  user-select: none;
  transition: color 0.2s;
}

.chat-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 100px;
  padding: 4px 12px;
  background: var(--surface);
  border-top: 1px solid rgba(240, 228, 193, 0.15);
}

.action-btn {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: var(--very-dark);
  border: none;
  border-radius: 20px;
  height: 28px;
  padding: 0 14px;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  font-weight: 600;
}

.action-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(135, 206, 235, 0.4);
}

.action-btn:active {
  transform: scale(0.95);
}

#userInput {
  flex: 1;
  height: 35px;
  border: 2px solid rgba(240, 228, 193, 0.3);
  border-radius: 8px;
  padding: 10px 45px 10px 15px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}

#userInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(135, 206, 235, 0.2);
}

#userInput::placeholder {
  color: var(--text);
  opacity: 0.6;
}

#sendBtn {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: var(--very-dark);
  border: none;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  font-weight: 600;
}

#sendBtn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(135, 206, 235, 0.4);
}

#sendBtn:active {
  transform: scale(0.95);
}

.footer {
  margin: 15px auto 0;
  width: 100%;
  max-width: 700px;
  padding: 2px 4px;
  background-color: rgba(54, 57, 73, 0.65);
  border: 2px solid var(--accent);
  border-radius: 16px;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  color: var(--text);
  line-height: 1.2;
  box-shadow: 0 4px 10px var(--shadow);
  font-size: 0.7rem;
  text-align: center;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.clear-confirmation {
  background-color: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 3px 10px;
  margin-top: 6px;
  text-align: center;
  color: var(--text);
  box-shadow: 0 4px 12px var(--shadow);
  animation: slideDown 0.25s ease-out;
}

.clear-confirmation.hidden {
  display: none;
}

.clear-confirmation p {
  margin: 0 0 8px 0;
  font-size: 12px;
}

.confirmation-buttons {
  display: flex;
  gap: 24px;
  justify-content: center;
}

.confirm-btn,
.cancel-btn {
  height: 28px;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.confirm-btn {
  background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
  color: white;
}

.confirm-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.confirm-btn:active {
  transform: scale(0.95);
}

.cancel-btn {
  background-color: var(--dark-gray);
  color: var(--text);
}

.cancel-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(100, 100, 100, 0.4);
}

.cancel-btn:active {
  transform: scale(0.95);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.export-options {
  background-color: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 3px 10px;
  margin-top: 6px;
  text-align: center;
  color: var(--text);
  box-shadow: 0 4px 12px var(--shadow);
  animation: slideDown 0.25s ease-out;
}

.export-options.hidden {
  display: none;
}

.export-options p {
  margin: 0 0 8px 0;
  font-size: 12px;
}

.export-buttons {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.export-format-btn {
  height: 28px;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #222222;
  transition: transform 0.2s, box-shadow 0.2s;
}

.export-format-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(90, 159, 181, 0.4);
}

.export-format-btn:active {
  transform: scale(0.95);
}

.footer a:hover {
  text-decoration: underline;
  color: var(--highlight);
}

.footer p {
  margin: 6px 0;
}

.footer-title {
  text-align: center;
  font-weight: 600;
}

@media (max-width: 600px) {
  .chat-container {
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

  .message-content {
    max-width: 85%;
    font-size: 0.9rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.8rem;
  }

  #userInput {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .footer {
    font-size: 0.7rem;
    padding:  3px 4px;
  }
}
