/* SkinAdvisor HQ - Neutral, Soft Skincare Aesthetic */

:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg-page: #F7F5F0;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F0EDE6;
  --border-color: #E4DFD5;
  --border-focus: #344E41;
  --text-main: #232220;
  --text-muted: #6B6862;
  --text-light: #949088;
  --primary: #344E41;
  --primary-hover: #26382F;
  --primary-light: #EDF1EE;
  --bubble-user: #344E41;
  --bubble-user-text: #FFFFFF;
  --bubble-advisor: #FFFFFF;
  --bubble-advisor-border: #E8E4DC;
  --stock-in-bg: #EAF3EC;
  --stock-in-text: #215F36;
  --stock-out-bg: #FBEBE8;
  --stock-out-text: #8E3A2E;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 12px rgba(35, 34, 32, 0.06);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Advisor App Shell */
.advisor-body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background-color: var(--bg-page);
}

.advisor-app {
  width: 100%;
  max-width: 840px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-surface);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.03);
  position: relative;
}

/* Header */
.advisor-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.badge-advisor {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background-color: var(--primary-light);
  color: var(--primary);
  margin-bottom: 4px;
}

.header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.brand-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-store-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background-color: var(--bg-surface);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-store-link:hover {
  background-color: var(--bg-subtle);
  border-color: var(--text-light);
}

/* Chat Feed */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.messages-feed {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: fadeIn 0.25s ease-out;
}

.user-row {
  flex-direction: row-reverse;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.advisor-avatar {
  background-color: var(--primary);
  color: #FFFFFF;
}

.message-bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14.5px;
  line-height: 1.55;
  word-break: break-word;
}

.advisor-bubble {
  background-color: var(--bubble-advisor);
  border: 1px solid var(--bubble-advisor-border);
  color: var(--text-main);
  border-top-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.advisor-bubble p + p {
  margin-top: 8px;
}

.advisor-bubble ul, .advisor-bubble ol {
  margin: 8px 0 8px 20px;
}

.advisor-bubble strong {
  font-weight: 600;
  color: var(--text-main);
}

.user-bubble {
  background-color: var(--bubble-user);
  color: var(--bubble-user-text);
  border-top-right-radius: 4px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 0;
  animation: fadeIn 0.2s ease-in;
}

.typing-bubble {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  display: flex;
  gap: 5px;
  align-items: center;
}

.dot {
  width: 7px;
  height: 7px;
  background: var(--text-light);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
.dot:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Product Cards Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
  width: 100%;
}

.product-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.product-image-wrap {
  width: 100%;
  height: 150px;
  background-color: var(--bg-subtle);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.product-placeholder-img {
  color: var(--text-light);
  font-size: 12px;
  font-weight: 500;
}

.product-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}

.product-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.badge-in-stock {
  background: var(--stock-in-bg);
  color: var(--stock-in-text);
}

.badge-out-stock {
  background: var(--stock-out-bg);
  color: var(--stock-out-text);
}

.product-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.btn-view-product {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  text-decoration: none;
  transition: all 0.2s ease;
  min-height: 36px;
}

.btn-view-product:hover {
  background: var(--primary);
  color: #FFFFFF;
}

/* Chat Controls */
.chat-controls {
  padding: 14px 20px;
  background: #FFFFFF;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.starter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.3;
}

.chip-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.input-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 6px 8px 6px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-form:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(52, 78, 65, 0.12);
  background: #FFFFFF;
}

#messageInput {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-main);
  max-height: 120px;
  padding: 6px 0;
}

#messageInput::placeholder {
  color: var(--text-light);
}

.send-btn {
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-full);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.1s ease;
}

.send-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: scale(1.04);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.char-count {
  font-size: 11px;
  color: var(--text-light);
  text-align: right;
  margin-top: -4px;
  padding-right: 4px;
}

/* Footer */
.advisor-footer {
  padding: 12px 20px 16px;
  background: #FFFFFF;
  border-top: 1px solid var(--bg-subtle);
  text-align: center;
}

.disclaimer-text {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.disclaimer-text a {
  color: var(--text-muted);
  text-decoration: underline;
}

/* Landing Page Styles */
.landing-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: var(--bg-page);
}

.landing-container {
  max-width: 580px;
  width: 100%;
}

.landing-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.landing-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  margin-bottom: 16px;
}

.landing-headline {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 12px;
}

.landing-sub {
  font-size: 14.5px;
  color: var(--text-muted);
  margin-bottom: 26px;
  line-height: 1.5;
}

.landing-cta-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.btn-primary {
  display: inline-block;
  background: var(--primary);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: background 0.2s ease;
  width: 100%;
  max-width: 320px;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  display: inline-block;
  color: var(--text-muted);
  font-size: 13.5px;
  text-decoration: none;
  padding: 6px 12px;
  transition: color 0.2s ease;
}

.btn-secondary:hover {
  color: var(--text-main);
  text-decoration: underline;
}

.landing-footer {
  margin-top: 28px;
  font-size: 11.5px;
  color: var(--text-light);
  border-top: 1px solid var(--bg-subtle);
  padding-top: 14px;
}

/* Mobile Responsiveness (down to 375px) */
@media (max-width: 600px) {
  .advisor-app {
    box-shadow: none;
  }
  .advisor-header {
    padding: 12px 16px;
  }
  .header-title {
    font-size: 14.5px;
  }
  .chat-container {
    padding: 14px;
    gap: 12px;
  }
  .message-bubble {
    max-width: 90%;
    font-size: 14px;
  }
  .products-grid {
    grid-template-columns: 1fr;
  }
  .chat-controls {
    padding: 10px 14px;
  }
  .starter-chips {
    gap: 6px;
  }
  .chip-btn {
    font-size: 12px;
    padding: 5px 10px;
  }
}
