@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* ─── Variables ──────────────────────────────────────────────────────── */
:root {
  --w-accent:      #c8b89a;
  --w-bg:          rgba(10, 10, 10, 0.94);
  --w-border:      rgba(255, 255, 255, 0.08);
  --w-header-bg:   #0c0c0c;
  --w-user-bg:     #1c1c1c;
  --w-bot-bg:      rgba(255, 255, 255, 0.055);
  --w-input-bg:    rgba(255, 255, 255, 0.04);
  --w-input-border:rgba(255, 255, 255, 0.11);
  --w-text:        #e8e8e8;
  --w-text-dim:    rgba(232, 232, 232, 0.45);
  --w-radius:      18px;
  --w-font:        'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --w-shadow:      0 32px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--w-border);
  --w-fab-size:    56px;
}

/* ─── Full-screen Chat Overlay ───────────────────────────────────────── */
#ai-stylist-widget {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: #080808;
  font-family: var(--w-font);
  color: var(--w-text);
  overflow: hidden;

  /* closed state */
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#ai-stylist-widget.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

/* Centered content column */
.widget-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Header ─────────────────────────────────────────────────────────── */
.widget-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(8, 8, 8, 0.95);
  border-bottom: 1px solid var(--w-border);
  flex-shrink: 0;
  user-select: none;
  backdrop-filter: blur(12px);
}

.widget-header-back {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--w-text-dim);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}

.widget-header-back:hover {
  background: rgba(255,255,255,0.07);
  border-color: var(--w-border);
  color: var(--w-text);
}

.widget-header-back svg { width: 18px; height: 18px; }

/* New Chat button — mirrors the back button, pushed to the right */
.widget-header-reset {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--w-text-dim);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
  margin-left: auto;
}

.widget-header-reset:hover {
  background: rgba(255,255,255,0.07);
  border-color: var(--w-border);
  color: var(--w-text);
}

.widget-header-reset svg { width: 16px; height: 16px; }

.widget-header-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2820 100%);
  border: 1px solid rgba(200,184,154,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.widget-header-logo svg {
  width: 14px;
  height: 14px;
}

.widget-header-text {
  flex: 1;
}

.widget-header-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffffff;
}

.widget-header-status {
  font-size: 11px;
  font-weight: 400;
  color: var(--w-text-dim);
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
  display: inline-block;
  animation: status-blink 2.5s ease-in-out infinite;
}

@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}


/* ─── Messages Area ──────────────────────────────────────────────────── */
.widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.widget-messages::-webkit-scrollbar { width: 4px; }
.widget-messages::-webkit-scrollbar-track { background: transparent; }
.widget-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

/* ─── Message Bubbles ────────────────────────────────────────────────── */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation-duration: 0.22s;
  animation-fill-mode: both;
  animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
}

.msg.bot  { align-self: flex-start; animation-name: msg-in-left; }
.msg.user { align-self: flex-end;   animation-name: msg-in-right; }

@keyframes msg-in-left {
  from { opacity: 0; transform: translateX(-10px) scale(0.97); }
  to   { opacity: 1; transform: translateX(0)     scale(1); }
}

@keyframes msg-in-right {
  from { opacity: 0; transform: translateX(10px) scale(0.97); }
  to   { opacity: 1; transform: translateX(0)    scale(1); }
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
}

.msg.bot  .msg-bubble {
  background: var(--w-bot-bg);
  border: 1px solid var(--w-border);
  border-bottom-left-radius: 4px;
  color: var(--w-text);
}

.msg.user .msg-bubble {
  background: var(--w-user-bg);
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom-right-radius: 4px;
  color: #ffffff;
}

.msg-time {
  font-size: 10px;
  color: var(--w-text-dim);
  margin-top: 4px;
  padding: 0 4px;
}

.msg.user .msg-time { text-align: right; }

/* ─── Typing Indicator ───────────────────────────────────────────────── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  background: var(--w-bot-bg);
  border: 1px solid var(--w-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  animation: msg-in-left 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--w-accent);
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.30s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0);     opacity: 0.4; }
  30%            { transform: translateY(-5px);  opacity: 1; }
}

/* ─── Progress Card (replaces typing dots during generation) ─────────── */
.progress-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  background: var(--w-bot-bg);
  border: 1px solid var(--w-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  min-width: 220px;
  animation: msg-in-left 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.progress-stage {
  font-size: 12px;
  font-weight: 500;
  color: var(--w-text-dim);
  letter-spacing: 0.02em;
}

.progress-bar {
  height: 2px;
  background: rgba(255,255,255,0.07);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 35%;
  background: var(--w-accent);
  border-radius: 2px;
  animation: progress-sweep 1.6s ease-in-out infinite;
}

@keyframes progress-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(380%); }
}

/* ─── Input Row ──────────────────────────────────────────────────────── */
.widget-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 14px 16px;
  border-top: 1px solid var(--w-border);
  background: rgba(8, 8, 8, 0.6);
  flex-shrink: 0;
}

.widget-input {
  flex: 1;
  background: var(--w-input-bg);
  border: 1px solid var(--w-input-border);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: var(--w-font);
  font-size: 13.5px;
  color: var(--w-text);
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.18s, background 0.18s;
  scrollbar-width: none;
}

.widget-input::-webkit-scrollbar { display: none; }

.widget-input::placeholder { color: var(--w-text-dim); }

.widget-input:focus {
  border-color: rgba(200, 184, 154, 0.4);
  background: rgba(255,255,255,0.055);
}

.widget-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--w-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s, opacity 0.15s;
  opacity: 0.9;
}

.widget-send:hover  { background: #d4c4aa; transform: scale(1.05); opacity: 1; }
.widget-send:active { transform: scale(0.95); }

.widget-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.widget-send svg {
  width: 16px;
  height: 16px;
  color: #0c0c0c;
}

/* ─── Scenario Selector ──────────────────────────────────────────────── */
.widget-scenarios {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  flex-shrink: 0;
}

.scenarios-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--w-text-dim);
  padding: 0 2px 4px;
}

.scenario-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--w-border);
  border-radius: 14px;
  cursor: pointer;
  font-family: var(--w-font);
  text-align: left;
  transition: background 0.18s, border-color 0.18s, transform 0.15s;
  color: var(--w-text);
}

.scenario-btn:hover {
  background: rgba(200,184,154,0.07);
  border-color: rgba(200,184,154,0.35);
  transform: translateY(-1px);
}

.scenario-btn:active { transform: translateY(0); }

.scenario-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(200,184,154,0.08);
  border: 1px solid rgba(200,184,154,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--w-accent);
}

.scenario-icon svg { width: 18px; height: 18px; }

.scenario-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.scenario-text strong {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}

.scenario-text small {
  font-size: 11.5px;
  color: var(--w-text-dim);
  line-height: 1.4;
}

/* ─── Side-by-side scenario buttons ─────────────────────────────────── */
.scenario-btns-row {
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
}

.scenario-btns-row .scenario-btn {
  flex: 1;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 8px;
  gap: 8px;
}

.scenario-btns-row .scenario-btn .scenario-icon {
  margin: 0;
}

.scenario-btns-row .scenario-btn .scenario-text {
  align-items: center;
}

.scenario-btns-row .scenario-btn small {
  font-size: 10px;
  line-height: 1.3;
}

/* ─── Style Choice Buttons ───────────────────────────────────────────── */
.msg-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.choice-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--w-border);
  border-radius: 12px;
  color: var(--w-text);
  font-family: var(--w-font);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.choice-btn:hover:not(:disabled) {
  background: rgba(200,184,154,0.09);
  border-color: rgba(200,184,154,0.4);
}

.choice-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.choice-btn-title {
  display: block;
  font-size: 13px;
}

.choice-btn-desc {
  display: block;
  font-size: 11.5px;
  color: var(--w-text-dim);
  margin-top: 3px;
  font-weight: 400;
}

/* ─── Photo Upload Button ─────────────────────────────────────────────── */
.widget-photo-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--w-input-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--w-text-dim);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.widget-photo-btn:hover {
  background: rgba(200,184,154,0.1);
  border-color: rgba(200,184,154,0.4);
  color: var(--w-accent);
}

.widget-photo-btn svg { width: 16px; height: 16px; }

/* ─── Image in message bubble ─────────────────────────────────────────── */
.msg-image-wrap {
  position: relative;
  width: 100%;
  max-width: 260px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.04);
}

.msg.user .msg-image-wrap { max-width: 200px; }

/* Download button — appears on hover over the image */
.img-download-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s, background 0.15s;
  font-family: var(--w-font);
  pointer-events: none;
}

.msg-image-wrap:hover .img-download-btn {
  opacity: 1;
  pointer-events: auto;
}

.img-download-btn:hover {
  background: rgba(0, 0, 0, 0.88);
}

.msg-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  object-fit: cover;
}

.msg-image-skeleton {
  width: 100%;
  height: 200px;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: 12px;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Product cards ──────────────────────────────────────────────────── */
.msg-products {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
  max-width: 300px;
}

.product-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.product-card:hover {
  background: rgba(200,184,154,0.07);
  border-color: rgba(200,184,154,0.25);
}

.product-img {
  width: 44px;
  height: 44px;
  border-radius: 7px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255,255,255,0.06);
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.product-name {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--w-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-price {
  font-size: 11px;
  color: var(--w-accent);
  font-weight: 600;
}

/* ─── Looks Gallery (5 outfit variants) ─────────────────────────────── */
.looks-gallery {
  display: flex;
  flex-direction: row;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 0 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  width: 100%;
  max-width: 700px;
}

.looks-gallery::-webkit-scrollbar { height: 4px; }
.looks-gallery::-webkit-scrollbar-track { background: transparent; }
.looks-gallery::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

.look-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  width: 168px;
  animation: msg-in-left 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.look-img-wrap {
  position: relative;
  width: 168px;
  height: 168px;          /* 1:1 square — matches generated image format */
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  flex-shrink: 0;
}

.look-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.look-img-wrap:hover .img-download-btn { opacity: 1; pointer-events: auto; }

.look-style {
  font-size: 11px;
  font-weight: 600;
  color: var(--w-text);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.look-choose-btn {
  width: 100%;
  padding: 7px 0;
  background: var(--w-accent);
  color: #0c0c0c;
  border: none;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}
.look-choose-btn:hover { background: #d4c4aa; transform: translateY(-1px); }

/* ─── Look Overlay ──────────────────────────────────────────────────── */
.look-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-end;
  animation: fade-in 0.2s ease;
}

.look-overlay-inner {
  width: 100%;
  max-height: 92vh;
  background: var(--w-bg);
  border-radius: 20px 20px 0 0;
  overflow-y: auto;
  padding: 16px 16px 36px;
  animation: slide-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.look-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.look-overlay-back {
  background: none;
  border: none;
  color: var(--w-accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.look-overlay-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--w-text);
  letter-spacing: 0.04em;
}

.look-overlay-img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 44vh;
  object-fit: contain;
  border-radius: 14px;
  margin: 0 auto 18px;
  background: rgba(255,255,255,0.03);
}

.look-overlay-section {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.look-overlay-products {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.look-overlay-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s;
  gap: 12px;
}
.look-overlay-item:hover { background: rgba(255,255,255,0.1); }

.look-overlay-product-img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
}

.look-overlay-item-name {
  font-size: 12px;
  color: var(--w-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.look-overlay-item-price {
  font-size: 12px;
  font-weight: 700;
  color: var(--w-accent);
  flex-shrink: 0;
}

.look-overlay-total {
  font-size: 14px;
  font-weight: 700;
  color: var(--w-text);
  margin-bottom: 16px;
  padding: 0 2px;
}

.look-overlay-buyall {
  display: block;
  width: 100%;
  padding: 14px 0;
  background: var(--w-accent);
  color: #0c0c0c;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}
.look-overlay-buyall:hover { background: #d4c4aa; transform: translateY(-1px); }

/* ─── Mobile ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .widget-header { padding: 14px 16px; }
  .widget-messages { padding: 14px 12px; }
  .widget-scenarios { padding: 12px; }
  .widget-input-row { padding: 10px 12px 14px; }
}
