/* Graylock live chat widget – bubble + panel (above header so always visible) */
#graylock-chat-root {
  position: fixed !important;
  bottom: 0 !important;
  right: 0 !important;
  z-index: 1000000 !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  box-sizing: border-box;
  pointer-events: none;
}
#graylock-chat-root * { box-sizing: border-box; }
#graylock-chat-root .graylock-chat-bubble,
#graylock-chat-root .graylock-chat-panel { pointer-events: auto; }

/* Bubble – small round bubble that hangs at bottom, like standard chat widgets */
.graylock-chat-bubble {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1a5f7a 0%, #0f4c5c 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(15, 76, 92, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 20px 20px 0;
  transition: transform 0.2s, box-shadow 0.2s;
  /* Entrance: slide up and bounce once so it’s noticeable */
  animation: graylock-chat-bubble-enter 0.6s ease-out;
}
.graylock-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 5px 16px rgba(15, 76, 92, 0.5);
}
.graylock-chat-bubble svg {
  width: 26px;
  height: 26px;
}
@keyframes graylock-chat-bubble-enter {
  0% { transform: translateY(80px); opacity: 0; }
  60% { transform: translateY(-6px); opacity: 1; }
  80% { transform: translateY(3px); }
  100% { transform: translateY(0); opacity: 1; }
}
.graylock-chat-bubble .graylock-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

/* Panel */
.graylock-chat-panel {
  position: absolute;
  bottom: 90px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.graylock-chat-panel.hidden { display: none; }

.graylock-chat-panel-header {
  background: linear-gradient(135deg, #1a5f7a 0%, #0f4c5c 100%);
  color: #fff;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 1rem;
}
.graylock-chat-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.graylock-chat-msg-row {
  display: flex;
  width: 100%;
  clear: both;
}
.graylock-chat-msg-row.visitor { justify-content: flex-end; }
.graylock-chat-msg-row.staff { justify-content: flex-start; }
.graylock-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.9375rem;
  line-height: 1.4;
  word-wrap: break-word;
}
.graylock-chat-msg-row.visitor .graylock-chat-msg {
  background: #1a5f7a;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.graylock-chat-msg-row.staff .graylock-chat-msg {
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}
.graylock-chat-msg-time {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 4px;
}
.graylock-chat-msg-row.visitor .graylock-chat-msg-time { color: rgba(255,255,255,0.9); }
.graylock-chat-msg-attachment {
  margin-top: 6px;
}
.graylock-chat-msg-attachment a {
  color: #1a5f7a;
  text-decoration: none;
  font-size: 0.875rem;
}
.graylock-chat-msg-attachment a:hover { text-decoration: underline; }

.graylock-chat-panel-input-wrap {
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.graylock-chat-emoji-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.graylock-chat-emoji-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.graylock-chat-emoji-btn:hover { background: #f1f5f9; }
.graylock-chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.graylock-chat-input-row textarea {
  flex: 1;
  min-height: 44px;
  max-height: 100px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9375rem;
  resize: none;
}
.graylock-chat-input-row textarea:focus {
  outline: none;
  border-color: #1a5f7a;
  box-shadow: 0 0 0 2px rgba(26, 95, 122, 0.2);
}
.graylock-chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #1a5f7a;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.graylock-chat-send-btn:hover { background: #0f4c5c; }
.graylock-chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.graylock-chat-attach-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.graylock-chat-attach-btn:hover { background: #f1f5f9; }
.graylock-chat-attach-btn input { display: none; }
.graylock-chat-file-name {
  font-size: 12px;
  color: #64748b;
  padding: 0 4px;
}

/* After-hours panel – same dimensions as chat panel */
.graylock-chat-after-hours-panel .graylock-chat-after-hours-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f8fafc;
  font-size: 0.9375rem;
}
.graylock-chat-after-hours-intro {
  margin-bottom: 1rem;
  color: #475569;
  line-height: 1.5;
}
.graylock-chat-after-hours-intro:empty { display: none; }
.graylock-chat-after-hours-done {
  padding: 1rem 0;
  text-align: center;
}
