/* DC Academy Chat Widget — Black/Gold theme */

#dc-chat-widget {
  --dc-gold: #c8a855;
  --dc-gold-light: #d4b96a;
  --dc-black: #1a1a1a;
  --dc-dark: #222222;
  --dc-darker: #181818;
  --dc-white: #f5f5f5;
  --dc-gray: #888888;
  --dc-radius: 12px;

  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

/* ── Launcher button ─────────────────────────────── */

#dc-chat-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--dc-gold);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

#dc-chat-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

#dc-chat-launcher svg {
  width: 28px;
  height: 28px;
  fill: var(--dc-black);
  transition: opacity 0.2s;
}

#dc-chat-launcher .dc-close-icon {
  display: none;
}

#dc-chat-widget.dc-open #dc-chat-launcher .dc-chat-icon {
  display: none;
}

#dc-chat-widget.dc-open #dc-chat-launcher .dc-close-icon {
  display: block;
}

/* ── Chat window ─────────────────────────────────── */

#dc-chat-window {
  display: none;
  flex-direction: column;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--dc-darker);
  border-radius: var(--dc-radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  position: absolute;
  bottom: 72px;
  right: 0;
}

#dc-chat-widget.dc-open #dc-chat-window {
  display: flex;
}

/* ── Header ──────────────────────────────────────── */

#dc-chat-header {
  background: var(--dc-black);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #333;
}

#dc-chat-header .dc-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--dc-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--dc-black);
  flex-shrink: 0;
}

#dc-chat-header .dc-header-info {
  flex: 1;
}

#dc-chat-header .dc-header-name {
  color: var(--dc-white);
  font-weight: 600;
  font-size: 15px;
}

#dc-chat-header .dc-header-status {
  color: var(--dc-gold);
  font-size: 12px;
  margin-top: 2px;
}

/* ── Messages area ───────────────────────────────── */

#dc-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#dc-chat-messages::-webkit-scrollbar {
  width: 4px;
}

#dc-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#dc-chat-messages::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 2px;
}

.dc-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  word-wrap: break-word;
  animation: dc-fade-in 0.2s ease;
}

@keyframes dc-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dc-msg.dc-bot {
  background: var(--dc-dark);
  color: var(--dc-white);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.dc-msg.dc-user {
  background: var(--dc-gold);
  color: var(--dc-black);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.dc-msg a {
  color: var(--dc-gold-light);
  text-decoration: underline;
}

.dc-msg.dc-user a {
  color: var(--dc-black);
}

/* Typing indicator */
.dc-typing {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  align-self: flex-start;
}

.dc-typing span {
  width: 7px;
  height: 7px;
  background: var(--dc-gray);
  border-radius: 50%;
  animation: dc-bounce 1.2s infinite;
}

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

@keyframes dc-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ── Input area ──────────────────────────────────── */

#dc-chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #333;
  background: var(--dc-black);
}

#dc-chat-input {
  flex: 1;
  background: var(--dc-dark);
  border: 1px solid #444;
  border-radius: 20px;
  padding: 10px 16px;
  color: var(--dc-white);
  font-size: 14px;
  outline: none;
  resize: none;
  font-family: inherit;
}

#dc-chat-input::placeholder {
  color: var(--dc-gray);
}

#dc-chat-input:focus {
  border-color: var(--dc-gold);
}

#dc-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--dc-gold);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

#dc-chat-send:hover {
  opacity: 0.85;
}

#dc-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#dc-chat-send svg {
  width: 18px;
  height: 18px;
  fill: var(--dc-black);
}

/* ── Powered by ──────────────────────────────────── */

#dc-chat-footer {
  text-align: center;
  padding: 6px;
  font-size: 10px;
  color: #555;
  background: var(--dc-darker);
}

/* ── Mobile ──────────────────────────────────────── */

/* ── Mobile close button (in header) ────────────── */

#dc-chat-close-mobile {
  display: none;
}

@media (max-width: 480px) {
  #dc-chat-widget.dc-open #dc-chat-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    z-index: 9999999;
  }

  #dc-chat-widget.dc-open #dc-chat-launcher {
    display: none !important;
  }

  #dc-chat-widget {
    bottom: 16px;
    right: 16px;
  }

  #dc-chat-close-mobile {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid #555;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto;
  }

  #dc-chat-close-mobile svg {
    width: 16px;
    height: 16px;
    fill: var(--dc-white);
  }

  #dc-chat-widget.dc-open #dc-chat-close-mobile {
    display: flex;
  }

  #dc-chat-header {
    padding: 12px 14px;
  }

  #dc-chat-header .dc-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  #dc-chat-header .dc-header-name {
    font-size: 14px;
  }

  #dc-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .dc-msg {
    padding: 8px 12px;
    font-size: 14px;
  }

  #dc-chat-input {
    font-size: 16px;
    padding: 10px 14px;
  }

  #dc-chat-input-area {
    padding: 10px 12px;
    padding-bottom: env(safe-area-inset-bottom, 10px);
  }

  #dc-chat-launcher {
    width: 52px;
    height: 52px;
  }

  #dc-chat-launcher svg {
    width: 24px;
    height: 24px;
  }
}
