/* ═══════════════════════════════════════════
   PowerCool AI Chatbot — Styles
   ═══════════════════════════════════════════ */

:root {
  --pc-navy: #031322;
  --pc-dark-card: #051942;
  --pc-amber: #fba31c;
  --pc-blue: #3696dd;
  --pc-sky: #c2f0fa;
  --pc-text: #e8f0f8;
  --pc-text-dim: rgba(194, 240, 250, 0.45);
  --pc-surface: rgba(255, 255, 255, 0.04);
  --pc-border: rgba(255, 255, 255, 0.08);
  --pc-radius: 20px;
  --pc-chat-w: 380px;
  --pc-chat-h: 520px;
  --pc-font: var(--font-poppins, "Poppins", sans-serif);
  --pc-font-body: var(--font-inter, "Inter", sans-serif);
}

/* ── Trigger Button ── */
.pc-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--pc-navy) 0%, var(--pc-dark-card) 100%);
  border-left: 4px solid var(--pc-amber);
  box-shadow: 0 4px 24px rgba(3, 19, 34, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: pc-pulse 2.5s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}

.pc-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 32px rgba(3, 19, 34, 0.6), 0 0 0 1px rgba(251, 163, 28, 0.2);
}

.pc-trigger:active {
  transform: scale(0.96);
}

.pc-chat-open .pc-trigger {
  animation: none;
}

/* Icon states */
.pc-icon-normal,
.pc-icon-close {
  position: absolute;
  transition: opacity 0.25s ease, transform 0.3s ease;
}

.pc-icon-normal {
  opacity: 1;
  transform: rotate(0deg);
}

.pc-icon-close {
  opacity: 0;
  transform: rotate(-90deg);
}

.pc-chat-open .pc-icon-normal {
  opacity: 0;
  transform: rotate(90deg);
}

.pc-chat-open .pc-icon-close {
  opacity: 1;
  transform: rotate(0deg);
}

/* ── Notification Badge ── */
.pc-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-family: var(--pc-font);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pc-badge-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.pc-badge.pc-hidden {
  display: none;
}

/* ── Chat Window ── */
.pc-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9997;
  width: var(--pc-chat-w);
  height: var(--pc-chat-h);
  border-radius: var(--pc-radius);
  background: var(--pc-dark-card);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.25s ease;
}

.pc-chat-open .pc-window {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* ── Header ── */
.pc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, var(--pc-navy) 0%, var(--pc-dark-card) 100%);
  border-bottom: 1px solid var(--pc-border);
  flex-shrink: 0;
}

.pc-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--pc-surface);
  border: 1px solid var(--pc-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.pc-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.pc-header-info {
  flex: 1;
  min-width: 0;
}

.pc-header-name {
  font-family: var(--pc-font);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

.pc-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--pc-font-body);
  font-size: 11px;
  color: var(--pc-text-dim);
  margin-top: 2px;
}

.pc-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.pc-header-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--pc-surface);
  color: var(--pc-text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.pc-header-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* ── Messages Area ── */
.pc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.pc-messages::-webkit-scrollbar {
  width: 4px;
}

.pc-messages::-webkit-scrollbar-track {
  background: transparent;
}

.pc-messages::-webkit-scrollbar-thumb {
  background: rgba(251, 163, 28, 0.2);
  border-radius: 4px;
}

/* ── Message Bubbles ── */
.pc-msg {
  max-width: 85%;
  animation: pc-msg-in 0.3s ease-out;
}

.pc-msg-bot {
  align-self: flex-start;
}

.pc-msg-user {
  align-self: flex-end;
}

.pc-msg-bubble {
  padding: 10px 14px;
  border-radius: 4px 14px 14px 14px;
  font-family: var(--pc-font-body);
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.pc-msg-bot .pc-msg-bubble {
  background: rgba(54, 150, 221, 0.1);
  border-left: 3px solid var(--pc-blue);
  color: var(--pc-text);
}

.pc-msg-user .pc-msg-bubble {
  background: var(--pc-amber);
  color: var(--pc-navy);
  border-radius: 14px 4px 14px 14px;
  border-left: none;
  font-weight: 500;
}

.pc-msg-bubble a {
  color: var(--pc-amber);
  text-decoration: underline;
}

.pc-msg-user .pc-msg-bubble a {
  color: var(--pc-navy);
}

.pc-msg-bubble strong {
  font-weight: 700;
}

.pc-msg-bubble ul {
  margin: 6px 0;
  padding-left: 18px;
}

.pc-msg-bubble li {
  margin: 3px 0;
}

.pc-msg-bubble code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

/* ── Typing Indicator ── */
.pc-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  align-self: flex-start;
}

.pc-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pc-blue);
  opacity: 0.5;
  animation: pc-dot-pulse 1.2s ease-in-out infinite;
}

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

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

/* ── Quick Option Buttons ── */
.pc-quick-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pc-quick-btn {
  border: 1px solid rgba(54, 150, 221, 0.3);
  background: rgba(54, 150, 221, 0.06);
  color: var(--pc-sky);
  font-family: var(--pc-font-body);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pc-quick-btn:hover {
  background: var(--pc-blue);
  border-color: var(--pc-blue);
  color: #fff;
}

/* ── Input Area ── */
.pc-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--pc-navy);
  border-top: 1px solid var(--pc-border);
  flex-shrink: 0;
}

.pc-input {
  flex: 1;
  border: 1px solid var(--pc-border);
  background: var(--pc-surface);
  color: #fff;
  font-family: var(--pc-font-body);
  font-size: 13.5px;
  padding: 10px 14px;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}

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

.pc-input:focus {
  border-color: var(--pc-amber);
}

.pc-send-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--pc-amber);
  color: var(--pc-navy);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.pc-send-btn:hover {
  opacity: 0.85;
}

.pc-send-btn:active {
  transform: scale(0.92);
}

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

/* ── Animations ── */
@keyframes pc-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes pc-badge-pop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

@keyframes pc-msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pc-dot-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .pc-trigger {
    bottom: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
  }

  .pc-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 75vh;
    border-radius: var(--pc-radius) var(--pc-radius) 0 0;
  }

  .pc-chat-open .pc-trigger {
    bottom: calc(75vh + 8px);
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .pc-trigger,
  .pc-msg,
  .pc-badge,
  .pc-typing-dot,
  .pc-window {
    animation: none !important;
    transition: opacity 0.15s ease !important;
  }
}
