/* ===== DIANA — DYNAMASTER AI ASSISTANT v2 ===== */
/* Premium dark theme with gold accents */

/* ── Reset & Base ── */
.dm-chat-btn,
.dm-chat-panel,
.dm-chat-panel * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Chat Toggle Button ── */
.dm-chat-btn {
  position: fixed;
  bottom: 100px;
  right: 25px;
  width: 66px;
  height: 66px;
  background: linear-gradient(145deg, #ffcc00 0%, #e6a800 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 20px rgba(255, 204, 0, 0.4),
    0 0 0 0 rgba(255, 204, 0, 0.3),
    inset 0 1px 0 rgba(255,255,255,0.3);
  z-index: 9998;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 3px solid rgba(255,255,255,0.15);
  animation: dm-beacon 3s ease-in-out infinite;
  overflow: hidden;
}

.dm-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(255, 204, 0, 0.55);
}

.dm-chat-btn svg {
  width: 46px;
  height: 46px;
  border-radius: 50%;
}

.dm-chat-btn .dm-tooltip {
  position: absolute;
  right: 78px;
  background: #1a1a1a;
  color: #fff;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.82rem;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  letter-spacing: -0.01em;
}

.dm-chat-btn .dm-tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: #1a1a1a;
}

.dm-chat-btn:hover .dm-tooltip { opacity: 1; }

.dm-chat-btn.dm-hidden {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

@keyframes dm-beacon {
  0%, 100% { box-shadow: 0 4px 20px rgba(255, 204, 0, 0.4), 0 0 0 0 rgba(255, 204, 0, 0.25), inset 0 1px 0 rgba(255,255,255,0.3); }
  50% { box-shadow: 0 4px 20px rgba(255, 204, 0, 0.4), 0 0 0 14px rgba(255, 204, 0, 0), inset 0 1px 0 rgba(255,255,255,0.3); }
}

/* ── Chat Panel ── */
.dm-chat-panel {
  position: fixed;
  bottom: 100px;
  right: 25px;
  width: 400px;
  height: 620px;
  background: #141414;
  border-radius: 24px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 204, 0, 0.08),
    0 0 80px rgba(255, 204, 0, 0.04);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.dm-chat-panel.dm-open {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ── Header ── */
.dm-chat-header {
  background: linear-gradient(180deg, #1c1c1c 0%, #171717 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
  border-bottom: 1px solid rgba(255, 204, 0, 0.15);
}

.dm-chat-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 204, 0, 0.3), transparent);
}

.dm-chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dm-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #ffcc00;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #2a2a2a, #1e1e1e);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 8px rgba(255, 204, 0, 0.15);
}

.dm-chat-avatar img,
.dm-chat-avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dm-chat-avatar::after {
  content: '';
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #1c1c1c;
  animation: dm-online-pulse 2s ease-in-out infinite;
}

@keyframes dm-online-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

.dm-chat-header-text h4 {
  margin: 0;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dm-chat-header-text span {
  color: #22c55e;
  font-size: 0.7rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.dm-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.dm-chat-close,
.dm-voice-toggle {
  background: none;
  border: none;
  color: #666;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
  transition: all 0.2s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dm-chat-close:hover,
.dm-voice-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ccc;
}

.dm-voice-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.dm-voice-toggle.dm-voice-on { color: #ffcc00; }
.dm-voice-toggle.dm-voice-on svg { fill: #ffcc00; }

/* ── Welcome Section ── */
.dm-welcome {
  padding: 20px 20px 10px;
  text-align: center;
  flex-shrink: 0;
}

.dm-welcome-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid #ffcc00;
  margin: 0 auto 10px;
  overflow: hidden;
  background: linear-gradient(135deg, #2a2a2a, #1e1e1e);
  box-shadow: 0 6px 24px rgba(255, 204, 0, 0.15), 0 0 0 6px rgba(255, 204, 0, 0.05);
}

.dm-welcome-avatar img,
.dm-welcome-avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dm-welcome h3 {
  margin: 0 0 4px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dm-welcome p {
  margin: 0;
  color: #888;
  font-size: 0.78rem;
  line-height: 1.5;
}

/* ── Guided Flow Buttons ── */
.dm-flow-section {
  padding: 12px 16px 14px;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
}

.dm-flow-section::-webkit-scrollbar { display: none; }

.dm-flow-section h5 {
  margin: 0 0 10px;
  color: #666;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.dm-flow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dm-flow-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 14px 12px;
  border-radius: 14px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.3;
  position: relative;
  overflow: hidden;
}

.dm-flow-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 204, 0, 0.06) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.25s;
}

.dm-flow-btn:hover::before { opacity: 1; }

.dm-flow-btn:hover {
  border-color: rgba(255, 204, 0, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 204, 0, 0.08);
}

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

.dm-flow-btn .dm-flow-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 4px rgba(255, 204, 0, 0.35));
  transition: transform 0.25s ease, filter 0.25s ease;
}
.dm-flow-btn:hover .dm-flow-icon {
  transform: scale(1.08) rotate(-4deg);
  filter: drop-shadow(0 0 8px rgba(255, 204, 0, 0.7));
}
.dm-flow-btn .dm-flow-icon svg {
  display: block;
  width: 24px;
  height: 24px;
}

.dm-flow-btn > div {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dm-flow-btn .dm-flow-label {
  font-weight: 600;
  display: block;
  font-size: 0.8rem;
  color: #fff;
  line-height: 1.3;
}

.dm-flow-btn .dm-flow-desc {
  font-size: 0.68rem;
  color: #777;
  display: block;
  line-height: 1.3;
  font-weight: 400;
}

.dm-flow-grid .dm-flow-full {
  grid-column: 1 / -1;
}

/* ── Messages Area ── */
.dm-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 204, 0, 0.2) transparent;
}

.dm-chat-messages::-webkit-scrollbar { width: 3px; }
.dm-chat-messages::-webkit-scrollbar-track { background: transparent; }
.dm-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 204, 0, 0.25);
  border-radius: 4px;
}

/* ── Message Bubbles ── */
.dm-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.84rem;
  line-height: 1.55;
  word-wrap: break-word;
  animation: dm-msg-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dm-msg-in {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dm-msg-bot {
  background: #1e1e1e;
  color: #e0e0e0;
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(255,255,255,0.04);
}

.dm-msg-bot strong { color: #ffcc00; font-weight: 600; }
.dm-msg-bot em { color: #bbb; font-style: italic; }
.dm-msg-bot ul, .dm-msg-bot ol { margin: 6px 0; padding-left: 18px; }
.dm-msg-bot li { margin: 3px 0; }
.dm-msg-bot a { color: #ffcc00; text-decoration: underline; text-underline-offset: 2px; }
.dm-msg-bot code {
  background: rgba(255, 204, 0, 0.08);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.82rem;
}

.dm-msg-user {
  background: linear-gradient(135deg, #ffcc00 0%, #f0b400 100%);
  color: #1a1a1a;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(255, 204, 0, 0.2);
}

/* ── Bot message with avatar ── */
.dm-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  align-self: flex-start;
  max-width: 90%;
}

.dm-msg-row .dm-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: #1e1e1e;
  border: 1px solid rgba(255, 204, 0, 0.2);
}

.dm-msg-row .dm-msg-avatar img,
.dm-msg-row .dm-msg-avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dm-msg-row .dm-msg {
  max-width: 100%;
}

/* ── Product Cards ── */
.dm-product-card {
  background: linear-gradient(135deg, #1a1a1a, #222);
  border: 1px solid rgba(255, 204, 0, 0.12);
  border-radius: 16px;
  overflow: hidden;
  align-self: flex-start;
  max-width: 90%;
  animation: dm-msg-in 0.3s ease-out;
}

.dm-product-card-img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  background: #fff;
  padding: 10px;
}

.dm-product-card-body {
  padding: 12px 14px;
}

.dm-product-card-body h4 {
  margin: 0 0 4px;
  color: #ffcc00;
  font-size: 0.88rem;
  font-weight: 700;
}

.dm-product-card-body .dm-product-series {
  color: #777;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.dm-product-card-body p {
  margin: 0 0 10px;
  color: #bbb;
  font-size: 0.78rem;
  line-height: 1.45;
}

.dm-product-card-body .dm-product-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.dm-product-spec-tag {
  background: rgba(255, 204, 0, 0.08);
  color: #daa520;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 500;
  border: 1px solid rgba(255, 204, 0, 0.1);
}

.dm-product-card-cta {
  width: 100%;
  background: linear-gradient(135deg, #ffcc00, #e6a800);
  color: #1a1a1a;
  border: none;
  padding: 10px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  letter-spacing: -0.01em;
}

.dm-product-card-cta:hover {
  background: linear-gradient(135deg, #e6b800, #cc9900);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 204, 0, 0.25);
}

/* ── Quick Actions (in-chat) ── */
.dm-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  align-self: flex-start;
}

.dm-quick-btn {
  background: transparent;
  border: 1px solid rgba(255, 204, 0, 0.25);
  color: #daa520;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.76rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: 500;
}

.dm-quick-btn:hover {
  background: #ffcc00;
  color: #1a1a1a;
  border-color: #ffcc00;
}

/* ── Typing Indicator ── */
.dm-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: #1e1e1e;
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  align-self: flex-start;
  max-width: 70px;
  border: 1px solid rgba(255,255,255,0.04);
}

.dm-typing-dot {
  width: 6px;
  height: 6px;
  background: #ffcc00;
  border-radius: 50%;
  animation: dm-typing-bounce 1.4s infinite;
}

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

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

/* ── Speaking Indicator ── */
.dm-speaking-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 204, 0, 0.06);
  border-radius: 10px;
  align-self: flex-start;
  margin-top: -4px;
  border: 1px solid rgba(255, 204, 0, 0.1);
}

.dm-speaking-indicator span {
  color: #daa520;
  font-size: 0.68rem;
  font-weight: 500;
}

.dm-speaking-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 14px;
}

.dm-speaking-bar {
  width: 3px;
  background: #ffcc00;
  border-radius: 2px;
  animation: dm-speak-bar 0.8s ease-in-out infinite;
}

.dm-speaking-bar:nth-child(1) { height: 6px; animation-delay: 0s; }
.dm-speaking-bar:nth-child(2) { height: 10px; animation-delay: 0.15s; }
.dm-speaking-bar:nth-child(3) { height: 14px; animation-delay: 0.3s; }
.dm-speaking-bar:nth-child(4) { height: 8px; animation-delay: 0.45s; }

@keyframes dm-speak-bar {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

/* ── Input Area ── */
.dm-chat-input-area {
  padding: 10px 12px;
  background: #111;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.dm-chat-input {
  flex: 1;
  background: #1e1e1e;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 10px 16px;
  color: white;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.dm-chat-input:focus {
  border-color: rgba(255, 204, 0, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.08);
}

.dm-chat-input::placeholder { color: #555; }

.dm-chat-send,
.dm-chat-mic {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #ffcc00, #e6a800);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(255, 204, 0, 0.2);
}

.dm-chat-send:hover,
.dm-chat-mic:hover {
  background: linear-gradient(135deg, #e6b800, #cc9900);
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(255, 204, 0, 0.3);
}

.dm-chat-send:disabled,
.dm-chat-mic:disabled {
  background: #333;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.dm-chat-send svg,
.dm-chat-mic svg {
  width: 18px;
  height: 18px;
  fill: #1a1a1a;
}

.dm-chat-mic.dm-recording {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  animation: dm-mic-pulse 1s ease-in-out infinite;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.dm-chat-mic.dm-recording svg { fill: #fff; }

@keyframes dm-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

/* ── Powered By ── */
.dm-powered {
  padding: 5px 12px;
  text-align: center;
  background: #111;
  flex-shrink: 0;
}

.dm-powered span {
  color: #444;
  font-size: 0.62rem;
  letter-spacing: 0.03em;
}

.dm-powered strong {
  color: #997a00;
  font-weight: 700;
}

/* ── Mobile: Small phones ── */
@media (max-width: 480px) {
  .dm-chat-panel {
    width: calc(100vw - 12px);
    height: calc(100dvh - 70px);
    bottom: 6px;
    right: 6px;
    border-radius: 20px;
  }

  .dm-chat-btn {
    width: 58px;
    height: 58px;
    bottom: 80px;
    right: 14px;
  }

  .dm-chat-btn svg {
    width: 40px;
    height: 40px;
  }

  .dm-welcome {
    padding: 16px 16px 8px;
  }

  .dm-welcome-avatar {
    width: 56px;
    height: 56px;
  }

  .dm-welcome h3 { font-size: 0.95rem; }
  .dm-welcome p { font-size: 0.74rem; }

  .dm-flow-section {
    padding: 10px 12px 12px;
  }

  .dm-flow-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .dm-flow-btn {
    padding: 12px 10px;
  }

  .dm-flow-grid .dm-flow-full {
    grid-column: 1;
  }

  .dm-msg { max-width: 92%; font-size: 0.82rem; }
  .dm-msg-row { max-width: 94%; }

  .dm-chat-header { padding: 12px 12px; }
  .dm-chat-input-area { padding: 8px 10px; }
  .dm-chat-input { padding: 9px 14px; font-size: 0.82rem; }
}

/* ── Tablet ── */
@media (max-width: 768px) and (min-width: 481px) {
  .dm-chat-panel {
    width: 380px;
    height: 580px;
  }
}

/* ── Utility ── */
.dm-hidden-section { display: none !important; }
