/**
 * OrientHealthLink Chat Widget Styles
 */

/* Chat button — slim vertical tab */
#ohl-chat-button {
  position: fixed;
  bottom: 100px;
  right: 0;
  width: 36px;
  padding: 14px 0;
  border-radius: 8px 0 0 8px;
  background: linear-gradient(180deg, #059669 0%, #047857 100%);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: -2px 2px 12px rgba(5, 150, 105, 0.3);
  transition: all 0.3s ease;
  z-index: 9998;
}

#ohl-chat-button:hover {
  width: 42px;
  box-shadow: -3px 3px 18px rgba(5, 150, 105, 0.45);
}

#ohl-chat-button.ohl-hidden {
  display: none;
}

#ohl-chat-button .ohl-chat-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
}

#ohl-chat-button svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

#ohl-chat-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Chat window */
#ohl-chat-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 48px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s ease;
}

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

/* Header */
#ohl-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
}

#ohl-chat-title {
  font-size: 15px;
  font-weight: 600;
}

#ohl-chat-subtitle {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 2px;
}

#ohl-chat-header-actions {
  display: flex;
  gap: 6px;
}

#ohl-chat-header-actions button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: background 0.2s;
}

#ohl-chat-header-actions button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Body */
#ohl-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f8fafc;
}

#ohl-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Messages */
.ohl-message {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}

.ohl-msg-visitor {
  align-self: flex-end;
  background: #059669;
  color: white;
  border-bottom-right-radius: 4px;
}

.ohl-msg-admin {
  align-self: flex-start;
  background: white;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}

.ohl-msg-system {
  align-self: center;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
}

.ohl-msg-content {
  white-space: pre-wrap;
}

.ohl-original {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 11px;
  opacity: 0.7;
  font-style: italic;
}

.ohl-msg-visitor .ohl-original {
  border-top-color: rgba(255, 255, 255, 0.3);
}

.ohl-msg-time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
}

/* Typing indicator */
#ohl-chat-typing {
  padding: 8px 14px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  font-size: 12px;
  color: #64748b;
  align-self: flex-start;
  margin-top: 8px;
}

#ohl-chat-typing::after {
  content: '';
  display: inline-block;
  width: 4px;
  animation: typing-dots 1.4s infinite;
}

@keyframes typing-dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* Footer */
#ohl-chat-footer {
  padding: 10px 14px;
  background: white;
  border-top: 1px solid #e5e7eb;
}

#ohl-chat-translation-notice {
  font-size: 10px;
  color: #94a3b8;
  text-align: center;
  margin-bottom: 6px;
}

#ohl-chat-input-area {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#ohl-chat-input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 9px 14px;
  font-size: 13px;
  resize: none;
  max-height: 100px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

#ohl-chat-input:focus {
  border-color: #059669;
}

#ohl-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #059669;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

#ohl-chat-send:hover {
  background: #047857;
}

#ohl-chat-send:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

/* Powered by */
#ohl-chat-powered {
  padding: 6px;
  text-align: center;
  font-size: 10px;
  color: #94a3b8;
  background: #f8fafc;
}

/* Registration form */
#ohl-chat-register {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s ease;
}

#ohl-chat-register.ohl-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#ohl-chat-reg-header {
  padding: 18px;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
  text-align: center;
}

#ohl-chat-reg-title {
  font-size: 16px;
  font-weight: 600;
}

#ohl-chat-reg-subtitle {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 4px;
}

#ohl-chat-reg-form {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#ohl-chat-reg-form input {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

#ohl-chat-reg-form input:focus {
  border-color: #059669;
}

#ohl-chat-reg-submit {
  background: #059669;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#ohl-chat-reg-submit:hover {
  background: #047857;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  #ohl-chat-button {
    bottom: 80px;
    right: 0;
    width: 32px;
    padding: 10px 0;
  }

  #ohl-chat-button:hover {
    width: 36px;
  }

  #ohl-chat-button .ohl-chat-label {
    font-size: 11px;
  }

  #ohl-chat-window,
  #ohl-chat-register {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}

/* Scrollbar styling */
#ohl-chat-body::-webkit-scrollbar {
  width: 5px;
}

#ohl-chat-body::-webkit-scrollbar-track {
  background: transparent;
}

#ohl-chat-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

#ohl-chat-body::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Auto-reply and system message styles */
.ohl-msg-system {
  background: #f0f4ff !important;
  border-left: 3px solid #3b82f6;
  font-style: italic;
  opacity: 0.9;
}
.ohl-msg-system .ohl-msg-content {
  color: #4b5563;
}
.ohl-msg-system .ohl-msg-time {
  color: #9ca3af;
}
