/* OfficePal Chat Widget */
:root {
  --op-orange: #E8913A;
  --op-orange-hover: #d17e2e;
  --op-dark: #1a1a2e;
  --op-darker: #12121f;
  --op-darkest: #0d0d18;
  --op-text: #e8e8e8;
  --op-text-muted: #9a9ab0;
  --op-border: #2a2a40;
  --op-user-bg: #E8913A;
  --op-bot-bg: #1e1e35;
  --op-input-bg: #16162a;
}

#op-chat-widget * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Floating Bubble */
#op-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--op-orange);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(232, 145, 58, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 99999;
}
#op-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(232, 145, 58, 0.55);
}
#op-chat-bubble svg {
  width: 28px;
  height: 28px;
  transition: opacity 0.15s;
}
#op-chat-bubble .op-close-icon { display: none; }
#op-chat-bubble.open .op-chat-icon { display: none; }
#op-chat-bubble.open .op-close-icon { display: block; }

/* Chat Window */
#op-chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-height: 560px;
  height: calc(100vh - 140px);
  background: var(--op-darker);
  border: 1px solid var(--op-border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
#op-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.op-chat-header {
  background: var(--op-darkest);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--op-border);
  flex-shrink: 0;
}
.op-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--op-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
}
.op-chat-header-text h3 {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.op-chat-header-text p {
  color: var(--op-text-muted);
  font-size: 12px;
}

/* Messages */
.op-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--op-border) transparent;
}
.op-chat-messages::-webkit-scrollbar { width: 5px; }
.op-chat-messages::-webkit-scrollbar-thumb { background: var(--op-border); border-radius: 4px; }

.op-msg {
  max-width: 82%;
  padding: 12px 16px;
  margin-left: 8px;
  margin-right: 8px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--op-text);
  word-wrap: break-word;
}
.op-msg a {
  color: var(--op-orange);
  text-decoration: underline;
}
.op-msg-user a {
  color: #fff;
}
.op-msg p { margin: 0; }
.op-msg strong { font-weight: 600; }
.op-msg .op-gap { height: 10px; }
.op-msg .op-li { height: 6px; }
.op-msg-bot {
  background: var(--op-bot-bg);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.op-msg-user {
  background: var(--op-user-bg);
  color: #fff !important;
  font-weight: 500;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}

/* Typing indicator */
.op-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
  background: var(--op-bot-bg);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.op-typing span {
  width: 7px;
  height: 7px;
  background: var(--op-text-muted);
  border-radius: 50%;
  animation: op-bounce 1.2s infinite;
}
.op-typing span:nth-child(2) { animation-delay: 0.15s; }
.op-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes op-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Input */
.op-chat-input {
  display: flex;
  padding: 12px;
  gap: 8px;
  border-top: 1px solid var(--op-border);
  background: var(--op-darkest);
  flex-shrink: 0;
}
.op-chat-input textarea {
  flex: 1;
  background: var(--op-input-bg);
  border: 1px solid var(--op-border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--op-text);
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 80px;
  font-family: inherit;
  line-height: 1.4;
}
.op-chat-input textarea::placeholder { color: var(--op-text-muted); }
.op-chat-input textarea:focus { border-color: var(--op-orange); }
.op-chat-input button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--op-orange);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.op-chat-input button:hover { background: var(--op-orange-hover); }
.op-chat-input button:disabled { opacity: 0.5; cursor: default; }
.op-chat-input button svg { width: 18px; height: 18px; fill: #fff; }

/* Footer */
.op-chat-footer {
  text-align: center;
  padding: 6px;
  font-size: 11px;
  color: var(--op-text-muted);
  background: var(--op-darkest);
  flex-shrink: 0;
}
.op-chat-footer a {
  color: var(--op-orange);
  text-decoration: none;
}

/* Notification dot */
#op-chat-bubble .op-notif {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: #e53e3e;
  border-radius: 50%;
  border: 2px solid var(--op-darker);
  display: none;
}

/* Mobile */
@media (max-width: 480px) {
  #op-chat-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 80px);
    max-height: none;
    bottom: 72px;
    right: 8px;
    border-radius: 12px;
  }
  #op-chat-bubble {
    bottom: 12px;
    right: 12px;
  }
}
