/**
 * HYT Website — Chat Widget Styles
 * Design System: Global Tide
 */

/* ============ Toggle Button ============ */
.chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1677D3;
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(22, 119, 211, 0.3);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  z-index: 9998;
  padding: 0;
}

.chat-toggle:hover {
  background: #1365C0;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(22, 119, 211, 0.4);
}

.chat-toggle:active {
  transform: scale(0.95);
}

.chat-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(22, 119, 211, 0.3), 0 4px 12px rgba(22, 119, 211, 0.3);
}

/* ============ Chat Panel ============ */
.chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(10, 22, 40, 0.08), 0 8px 10px -6px rgba(10, 22, 40, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  animation: chatSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes chatSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-panel.hidden {
  display: none;
}

/* ============ Chat Header ============ */
.chat-header {
  background: #0B1D4A;
  color: #FFFFFF;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header-title {
  font-weight: 600;
  font-size: 1rem;
}

.chat-header-status {
  font-size: 0.75rem;
  color: #94A3B8;
}

/* ============ Chat Messages ============ */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #FAFAF9;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
  background: #E2E8F0;
  border-radius: 4px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.chat-message-user {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-message-agent {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message-user .chat-bubble {
  background: #D6EDFF;
  color: #0B1D4A;
  border-bottom-right-radius: 4px;
}

.chat-message-agent .chat-bubble {
  background: #FFFFFF;
  color: #475569;
  border: 1px solid #E2E8F0;
  border-bottom-left-radius: 4px;
}

.chat-message-time {
  font-size: 0.6875rem;
  color: #94A3B8;
  margin-top: 4px;
}

/* ============ Offline Banner ============ */
.chat-offline-banner {
  background: #FEF3C7;
  color: #D97706;
  text-align: center;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  margin: 8px 0;
}

/* ============ Chat Input ============ */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid #E2E8F0;
  background: #FFFFFF;
  flex-shrink: 0;
}

.chat-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex: 1;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
  background: #FAFAF9;
}

.chat-input:focus {
  border-color: #1677D3;
  box-shadow: 0 0 0 3px rgba(22, 119, 211, 0.15);
}

.chat-input::placeholder {
  color: #94A3B8;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #1677D3;
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: #1365C0;
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-send-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(22, 119, 211, 0.3);
}

/* ============ Responsive ============ */
@media (max-width: 480px) {
  .chat-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 100px);
    bottom: 80px;
    right: 8px;
    border-radius: 16px;
  }

  .chat-toggle {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
}
