/* ===== TO COFFEE Chatbot Widget ===== */

:root {
  --tc-primary: #3a250f;
  --tc-primary-light: #5a4230;
  --tc-accent: #d08e3e;
  --tc-accent-hover: #b8792f;
  --tc-cream: #ffeedd;
  --tc-bg: #fdf6ef;
  --tc-white: #ffffff;
  --tc-text: #2c1810;
  --tc-text-light: #8a7565;
  --tc-shadow: rgba(58, 37, 15, 0.25);
  --tc-shadow-lg: rgba(58, 37, 15, 0.35);
  --tc-radius: 20px;
  --tc-chat-w: 380px;
  --tc-chat-h: 520px;
  --tc-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== Side Tab Icon ===== */
.tc-icon {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 84px;
  background: linear-gradient(135deg, var(--tc-primary) 0%, var(--tc-primary-light) 100%);
  border-radius: 14px 0 0 14px;
  cursor: pointer;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s var(--tc-ease), box-shadow 0.35s ease, width 0.3s ease;
  box-shadow: -3px 4px 16px var(--tc-shadow);
  border: none;
  outline: none;
  padding: 0;
}

.tc-icon:hover {
  transform: translateY(-50%) translateX(-8px);
  box-shadow: -6px 6px 24px var(--tc-shadow-lg);
}

.tc-icon.tc-icon-active {
  background: linear-gradient(135deg, var(--tc-accent) 0%, var(--tc-accent-hover) 100%);
}

/* SVG Icon */
.tc-icon svg {
  width: 32px;
  height: 40px;
}

.tc-svg-cup { display: block; }
.tc-svg-close { display: none; }

.tc-icon-active .tc-svg-cup { display: none; }
.tc-icon-active .tc-svg-close { display: block; }

/* Steam Animation */
.tc-steam-line {
  animation: tc-steam 2.4s ease-in-out infinite;
}
.tc-steam-line:nth-child(2) { animation-delay: 0.4s; }
.tc-steam-line:nth-child(3) { animation-delay: 0.8s; }

@keyframes tc-steam {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-3px); opacity: 1; }
}

/* Notification Badge */
.tc-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 18px;
  height: 18px;
  background: #e53935;
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0);
  transition: transform 0.3s var(--tc-ease);
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.tc-badge.tc-badge-visible {
  transform: scale(1);
  animation: tc-badge-pulse 2s ease-in-out infinite 0.3s;
}

@keyframes tc-badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ===== Chat Window ===== */
.tc-chat-window {
  position: fixed;
  right: 64px;
  top: 50%;
  width: var(--tc-chat-w);
  height: var(--tc-chat-h);
  background: var(--tc-white);
  border-radius: var(--tc-radius);
  box-shadow: 0 12px 48px var(--tc-shadow-lg);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-50%) scale(0.85) translateX(24px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.4s var(--tc-ease);
}

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

/* ===== Header ===== */
.tc-header {
  background: linear-gradient(135deg, var(--tc-primary) 0%, var(--tc-primary-light) 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.tc-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--tc-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.tc-header-avatar svg {
  width: 22px;
  height: 22px;
}

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

.tc-header-name {
  color: var(--tc-cream);
  font-size: 15px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0.5px;
}

.tc-header-status {
  color: rgba(255, 238, 221, 0.7);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.tc-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4caf50;
  display: inline-block;
  animation: tc-dot-pulse 2s ease-in-out infinite;
}

@keyframes tc-dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.tc-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: var(--tc-cream);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}

.tc-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ===== Messages Area ===== */
.tc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--tc-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tc-messages::-webkit-scrollbar {
  width: 5px;
}

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

.tc-messages::-webkit-scrollbar-thumb {
  background: var(--tc-accent);
  border-radius: 10px;
}

/* Message Bubbles */
.tc-msg {
  max-width: 82%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  word-wrap: break-word;
}

.tc-msg.tc-animate {
  animation: tc-msg-in 0.3s ease-out;
}

.tc-msg-bot {
  align-self: flex-start;
  background: var(--tc-cream);
  color: var(--tc-text);
  border-radius: 16px 16px 16px 4px;
}

.tc-msg-bot a {
  color: var(--tc-accent-hover);
  text-decoration: underline;
}

.tc-msg-bot ul {
  margin: 6px 0;
  padding-left: 18px;
}

.tc-msg-bot li {
  margin-bottom: 3px;
}

.tc-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--tc-accent) 0%, var(--tc-accent-hover) 100%);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
}

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

/* Typing Indicator */
.tc-typing {
  align-self: flex-start;
  background: var(--tc-cream);
  border-radius: 16px 16px 16px 4px;
  padding: 12px 18px;
  display: flex;
  gap: 5px;
  align-items: center;
}

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

.tc-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.tc-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes tc-typing-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===== Quick Buttons ===== */
.tc-quick-btns {
  padding: 8px 16px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  flex-shrink: 0;
  background: var(--tc-bg);
  border-top: 1px solid rgba(208, 142, 62, 0.15);
}

.tc-quick-btns::-webkit-scrollbar {
  display: none;
}

.tc-quick-btns:empty {
  display: none;
}

.tc-quick-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1.5px solid var(--tc-accent);
  border-radius: 18px;
  background: transparent;
  color: var(--tc-accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tc-quick-btn:hover {
  background: var(--tc-accent);
  color: #fff;
}

/* ===== Input Area ===== */
.tc-input-area {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(208, 142, 62, 0.15);
  background: var(--tc-white);
  flex-shrink: 0;
}

.tc-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--tc-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: transparent;
  padding: 6px 4px;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
}

.tc-input::placeholder {
  color: var(--tc-text-light);
}

.tc-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--tc-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, background 0.2s ease;
  padding: 0;
}

.tc-send-btn:hover {
  background: var(--tc-accent-hover);
  transform: scale(1.08);
}

.tc-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
  .tc-icon {
    top: auto;
    bottom: 20px;
    right: 0;
    transform: none;
    height: 64px;
    width: 46px;
    border-radius: 12px 0 0 12px;
  }

  .tc-icon:hover {
    transform: translateX(-4px);
  }

  .tc-chat-window {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    transform: translateY(100%);
    opacity: 1;
  }

  .tc-chat-window.tc-open {
    transform: translateY(0);
  }
}
