/* WooCommerce Voice Assistant – Widget Styles */
:root {
  --wva-primary: #7c3aed;
  --wva-primary-dark: #5b21b6;
  --wva-radius: 16px;
  --wva-shadow: 0 8px 32px rgba(0,0,0,.18);
  --wva-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Launcher button */
#wva-launcher {
  position: fixed;
  z-index: 99998;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--wva-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--wva-shadow);
  transition: transform .2s, background .2s;
  font-size: 22px;
}
#wva-launcher:hover { background: var(--wva-primary-dark); transform: scale(1.06); }
#wva-launcher.bottom-right { bottom: 90px; right: 24px; }
#wva-launcher.bottom-left  { bottom: 120px; left:  24px; }

#wva-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
}

/* Chat panel */
#wva-panel {
  position: fixed;
  z-index: 99999;
  width: 380px;
  max-height: 620px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--wva-radius);
  box-shadow: var(--wva-shadow);
  font-family: var(--wva-font);
  font-size: 14px;
  transition: opacity .25s, transform .25s;
  overflow: hidden;
}
#wva-panel.bottom-right { bottom: 162px; right: 24px; }
#wva-panel.bottom-left  { bottom: 192px; left:  24px; }
#wva-panel.wva-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

/* Header */
#wva-header {
  background: var(--wva-primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--wva-radius) var(--wva-radius) 0 0;
}
#wva-header-icon { font-size: 20px; }
#wva-header-title { flex: 1; font-weight: 600; font-size: 15px; }
#wva-header-subtitle { font-size: 11px; opacity: .8; }
#wva-btn-clear {
  background: none; border: none; color: rgba(255,255,255,.7);
  cursor: pointer; font-size: 13px; padding: 4px 6px; border-radius: 6px;
  transition: color .15s;
}
#wva-btn-clear:hover { color: #fff; }

/* Messages */
#wva-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8f7ff;
}
.wva-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.5;
  word-break: break-word;
  animation: wva-pop .2s ease;
}
.wva-bubble.assistant {
  background: #fff;
  color: #1a1a2e;
  border: 1px solid #e5e1f8;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.wva-bubble.user {
  background: var(--wva-primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.wva-bubble.typing { opacity: .6; font-style: italic; }

/* Product cards */
.wva-products {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.wva-card {
  background: #fff;
  border: 1px solid #e5e1f8;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  transition: box-shadow .15s;
}
.wva-card:hover { box-shadow: 0 2px 12px rgba(124,58,237,.15); }
.wva-card img {
  width: 56px; height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.wva-card-info { flex: 1; min-width: 0; }
.wva-card-name {
  font-weight: 600; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #1a1a2e;
}
.wva-card-stock { font-size: 11px; color: #6b7280; margin-top: 1px; }
.wva-card-stock.out { color: #ef4444; }
.wva-sale-badge {
  background: #ef4444; color: #fff; font-size: 10px;
  font-weight: 700; padding: 1px 5px; border-radius: 4px; margin-left: 4px;
}
.wva-card-actions { display: flex; flex-direction: column; gap: 4px; }
.wva-btn-cart {
  background: var(--wva-primary); color: #fff;
  border: none; border-radius: 8px; padding: 6px 10px;
  font-size: 12px; cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.wva-btn-cart:hover { background: var(--wva-primary-dark); }
.wva-btn-view, a.wva-btn-view {
  background: #f3f0ff; color: var(--wva-primary);
  border: none; border-radius: 8px; padding: 6px 10px;
  font-size: 12px; cursor: pointer;
  transition: background .15s;
  text-decoration: none; text-align: center;
  display: inline-block;
}
.wva-btn-view:hover, a.wva-btn-view:hover { background: #ede9fe; }

/* Input bar */
#wva-input-bar {
  padding: 12px;
  background: #fff;
  border-top: 1px solid #e5e1f8;
  display: flex;
  gap: 8px;
  align-items: center;
}
#wva-text-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  padding: 9px 14px;
  font-size: 14px;
  outline: none;
  font-family: var(--wva-font);
  transition: border-color .15s;
}
#wva-text-input:focus { border-color: var(--wva-primary); }
#wva-btn-mic, #wva-btn-send {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
#wva-btn-send { background: var(--wva-primary); color: #fff; }
#wva-btn-send:hover { background: var(--wva-primary-dark); }
#wva-btn-mic  { background: #f3f0ff; color: var(--wva-primary); }
#wva-btn-mic:hover { background: #ede9fe; }
#wva-btn-mic.recording {
  background: #ef4444; color: #fff;
  animation: wva-pulse 1s infinite;
}
#wva-status {
  font-size: 11px; color: #9ca3af; text-align: center;
  padding: 0 12px 8px; background: #fff;
}

/* Animations */
@keyframes wva-pop { from { opacity:0; transform: scale(.9); } to { opacity:1; transform: scale(1); } }
@keyframes wva-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50%       { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  #wva-panel { background: #1e1b2e; }
  #wva-messages { background: #151325; }
  .wva-bubble.assistant { background: #2d2752; color: #e9e6ff; border-color: #3d3768; }
  #wva-input-bar { background: #1e1b2e; border-top-color: #3d3768; }
  #wva-text-input { background: #2d2752; border-color: #3d3768; color: #e9e6ff; }
  .wva-card { background: #2d2752; border-color: #3d3768; }
  .wva-card-name { color: #e9e6ff; }
  .wva-btn-view { background: #3d3768; }
  #wva-status { background: #1e1b2e; }
}

/* Mobile */
@media (max-width: 480px) {
  #wva-panel { width: calc(100vw - 24px); right: 12px !important; left: 12px !important; }
}

/* Mensaje del vendedor */
.wva-bubble.vendor-msg {
  background: #fefce8;
  border: 1px solid #fde68a;
  color: #78350f;
}
@media (prefers-color-scheme: dark) {
  .wva-bubble.vendor-msg { background: #422006; border-color: #92400e; color: #fde68a; }
}

/* Detalle de producto dentro del chat */
.wva-detail-bubble { max-width: 95% !important; padding: 0 !important; overflow: hidden; }
.wva-product-detail { display: flex; flex-direction: column; }
.wva-product-detail img { width: 100%; max-height: 200px; object-fit: cover; border-radius: 12px 12px 0 0; }
.wva-detail-body { padding: 12px 14px; }
.wva-detail-name { font-weight: 600; font-size: 14px; color: #1a1a2e; margin-bottom: 10px; }
.wva-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wva-btn-external {
  display: inline-block; font-size: 12px; padding: 7px 12px;
  background: #f3f0ff; color: var(--wva-primary);
  border-radius: 8px; text-decoration: none;
  border: 1px solid #e0d9ff; transition: background .15s;
}
.wva-btn-external:hover { background: #ede9fe; }
@media (prefers-color-scheme: dark) {
  .wva-detail-name { color: #e9e6ff; }
  .wva-btn-external { background: #3d3768; color: #c4b5fd; border-color: #4c4580; }
  .wva-btn-external:hover { background: #4c4580; }
}

/* Selector de variaciones */
.wva-variation-selector { display: flex; flex-direction: column; gap: 10px; min-width: 240px; }
.wva-var-title { font-weight: 600; font-size: 13px; color: #1a1a2e; margin-bottom: 2px; }
.wva-var-group { display: flex; flex-direction: column; gap: 4px; }
.wva-var-label { font-size: 12px; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: .4px; }
.wva-var-select {
  border: 1px solid #d1d5db; border-radius: 8px;
  padding: 7px 10px; font-size: 13px;
  background: #fff; color: #1a1a2e;
  outline: none; cursor: pointer;
  transition: border-color .15s;
}
.wva-var-select:focus { border-color: var(--wva-primary); }
.wva-btn-add-variation { margin-top: 4px; }
.wva-btn-add-variation:disabled { opacity: .45; cursor: not-allowed; }
@media (prefers-color-scheme: dark) {
  .wva-var-title { color: #e9e6ff; }
  .wva-var-label { color: #a8a4c8; }
  .wva-var-select { background: #2d2752; border-color: #3d3768; color: #e9e6ff; }
}
