/*
 * Chatty Widget CSS v1.1
 * Scoped under #chatty-widget-wrap to prevent WP theme conflicts.
 * NO all:unset — instead, every property is explicitly set.
 */

/* ─── VARIABLES ─────────────────────────────────────────── */
:root {
  --chatty-yellow: #fdfe00;
  --chatty-bg: #141414;
  --chatty-bg2: #1e1e1e;
  --chatty-bg3: #272727;
  --chatty-bg4: #313131;
  --chatty-border: rgba(255,255,255,0.1);
  --chatty-text: #ececec;
  --chatty-text2: #aaa;
  --chatty-muted: #606060;
  --chatty-green: #22c55e;
  --chatty-amber: #f59e0b;
  --chatty-red: #ef4444;
}

/* ─── CONTAINER ─────────────────────────────────────────── */
#chatty-widget-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--chatty-text);
  -webkit-font-smoothing: antialiased;
}


/* ─── INLINE SVG ICONS ──────────────────────────────────── */
#chatty-widget-wrap svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  pointer-events: none;
}

.chatty-svg-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chatty-fab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatty-option-icon svg,
.chatty-icon-btn svg {
  display: block;
}

/* ─── FAB BUTTON ────────────────────────────────────────── */
#chatty-fab-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--chatty-yellow);
  border: none;
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(253,254,0,0.45), 0 2px 8px rgba(0,0,0,0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  margin-left: auto;
  padding: 0;
}

#chatty-fab-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(253,254,0,0.6), 0 2px 12px rgba(0,0,0,0.5);
}

#chatty-fab-btn:active {
  transform: scale(0.94);
}

#chatty-fab-btn i {
  font-size: 24px;
  color: #000;
  line-height: 1;
  display: block;
}

/* ─── CHAT PANEL ────────────────────────────────────────── */
#chatty-panel {
  width: 360px;
  height: 540px;
  background: var(--chatty-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  box-shadow: 0 16px 60px rgba(0,0,0,0.8), 0 4px 16px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
  animation: chatty-open 0.28s cubic-bezier(0.34, 1.3, 0.64, 1) both;
}

@keyframes chatty-open {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── PANEL HEADER ──────────────────────────────────────── */
.chatty-header {
  background: var(--chatty-bg2);
  border-bottom: 1px solid var(--chatty-border);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: 66px;
}

.chatty-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.chatty-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.chatty-avatar-img,
.chatty-avatar-initials {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatty-avatar-img {
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.15);
}

.chatty-avatar-initials {
  background: var(--chatty-yellow);
  color: #000;
  font-size: 17px;
  font-weight: 800;
  font-family: inherit;
}

.chatty-status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2.5px solid var(--chatty-bg2);
}
.chatty-dot-online  { background: var(--chatty-green); }
.chatty-dot-away    { background: var(--chatty-amber); }
.chatty-dot-offline { background: var(--chatty-muted); }

.chatty-agent-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chatty-agent-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: inherit;
  line-height: 1.2;
  display: block;
}

.chatty-agent-status {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}
.chatty-agent-status i { font-size: 7px; }
.chatty-status-online  { color: var(--chatty-green); }
.chatty-status-away    { color: var(--chatty-amber); }
.chatty-status-offline { color: var(--chatty-muted); }

.chatty-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  color: var(--chatty-muted);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  padding: 0;
  margin: 0;
}
.chatty-close-btn:hover {
  background: var(--chatty-bg4);
  color: #fff;
}
.chatty-close-btn i { display: block; line-height: 1; }

/* ─── PANEL BODY ────────────────────────────────────────── */
.chatty-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.chatty-view {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  overflow: hidden;
}
.chatty-view.active {
  display: flex;
}

/* ─── MENU VIEW ─────────────────────────────────────────── */
.chatty-menu-view {
  overflow-y: auto;
  padding: 14px;
  gap: 8px;
}

.chatty-menu-view::-webkit-scrollbar { width: 4px; }
.chatty-menu-view::-webkit-scrollbar-thumb { background: var(--chatty-bg4); border-radius: 4px; }

.chatty-greeting {
  background: var(--chatty-bg2);
  border: 1px solid var(--chatty-border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 6px;
}

.chatty-greeting p {
  margin: 0;
  padding: 0;
  font-size: 13px;
  color: var(--chatty-text2);
  line-height: 1.6;
  font-family: inherit;
}

/* ─── MENU OPTION BUTTONS ───────────────────────────────── */
.chatty-option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  background: var(--chatty-bg2);
  border: 1px solid var(--chatty-border);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  color: var(--chatty-text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  text-decoration: none;
}

.chatty-option-btn:hover {
  border-color: var(--chatty-yellow);
  background: rgba(253,254,0,0.05);
  transform: translateX(3px);
}
.chatty-option-btn:active {
  transform: translateX(1px);
}

.chatty-option-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: rgba(253,254,0,0.1);
  color: var(--chatty-yellow);
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.chatty-option-btn:hover .chatty-option-icon {
  background: rgba(253,254,0,0.18);
}

.chatty-option-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chatty-option-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  display: block;
  font-family: inherit;
  line-height: 1.3;
}

.chatty-option-desc {
  font-size: 11px;
  color: var(--chatty-muted);
  display: block;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chatty-option-arrow {
  color: var(--chatty-muted);
  font-size: 12px;
  flex-shrink: 0;
  transition: color 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
}
.chatty-option-btn:hover .chatty-option-arrow {
  color: var(--chatty-yellow);
  transform: translateX(3px);
}

/* ─── CHAT VIEW ─────────────────────────────────────────── */
.chatty-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.chatty-messages::-webkit-scrollbar { width: 3px; }
.chatty-messages::-webkit-scrollbar-thumb { background: var(--chatty-bg4); border-radius: 4px; }

.chatty-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  gap: 3px;
}
.chatty-msg-user  { align-self: flex-end;   align-items: flex-end; }
.chatty-msg-agent { align-self: flex-start; align-items: flex-start; }

.chatty-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  font-family: inherit;
  display: block;
}
.chatty-msg-user  .chatty-bubble { background: var(--chatty-yellow); color: #000; border-bottom-right-radius: 4px; }
.chatty-msg-agent .chatty-bubble { background: var(--chatty-bg2); color: var(--chatty-text); border-bottom-left-radius: 4px; border: 1px solid var(--chatty-border); }

.chatty-msg-time {
  font-size: 10px;
  color: var(--chatty-muted);
  font-family: inherit;
  padding: 0 2px;
  display: block;
}

.chatty-file-bubble a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--chatty-yellow);
  text-decoration: none;
  background: var(--chatty-bg2);
  border: 1px solid var(--chatty-border);
  padding: 8px 12px;
  border-radius: 10px;
  font-family: inherit;
  transition: background 0.15s;
}
.chatty-file-bubble a:hover { background: var(--chatty-bg3); }

/* ─── CHAT TOPBAR (back button) ─────────────────────────── */
.chatty-chat-topbar {
  flex-shrink: 0;
  padding: 8px 12px 0;
  display: flex;
  align-items: center;
}

/* ─── EMOJI PICKER ──────────────────────────────────────── */
.chatty-emoji-wrap {
  position: relative;
  flex-shrink: 0;
}
.chatty-emoji-picker {
  position: absolute;
  bottom: 6px;
  left: 8px;
  right: 8px;
  background: var(--chatty-bg2);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 156px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.6);
}
.chatty-emoji-picker::-webkit-scrollbar { width: 3px; }
.chatty-emoji-picker::-webkit-scrollbar-thumb { background: var(--chatty-bg4); border-radius: 3px; }

.chatty-emoji-picker button {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  font-size: 18px;
  padding: 5px 2px;
  border-radius: 6px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}
.chatty-emoji-picker button:hover { background: var(--chatty-bg3); }

/* ─── CHAT INPUT ────────────────────────────────────────── */
.chatty-input-wrap {
  flex-shrink: 0;
  background: var(--chatty-bg2);
  border-top: 1px solid var(--chatty-border);
  padding: 10px 12px 12px;
}

.chatty-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: var(--chatty-bg3);
  border: 1px solid var(--chatty-border);
  border-radius: 13px;
  padding: 7px 8px;
  transition: border-color 0.18s;
}
.chatty-input-row:focus-within {
  border-color: var(--chatty-yellow);
  box-shadow: 0 0 0 3px rgba(253,254,0,0.08);
}

.chatty-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--chatty-text);
  font-size: 13px;
  font-family: inherit;
  resize: none;
  min-height: 22px;
  max-height: 100px;
  line-height: 1.5;
  padding: 1px 0;
  cursor: text;
  display: block;
}
.chatty-textarea::placeholder { color: var(--chatty-muted); }

.chatty-icon-btn {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  color: var(--chatty-muted);
  font-size: 15px;
  padding: 5px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}
.chatty-icon-btn:hover { color: var(--chatty-yellow); background: rgba(253,254,0,0.08); }
.chatty-icon-btn i { display: block; line-height: 1; }

label.chatty-icon-btn { cursor: pointer; }

.chatty-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--chatty-yellow);
  border: none;
  outline: none;
  cursor: pointer;
  color: #000;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s, transform 0.12s;
}
.chatty-send-btn:hover  { background: #e5e600; }
.chatty-send-btn:active { transform: scale(0.9); }
.chatty-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.chatty-send-btn i { display: block; line-height: 1; }

.chatty-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 2px;
}

.chatty-end-btn {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  color: var(--chatty-muted);
  font-size: 11px;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  border-radius: 5px;
  transition: color 0.15s;
  text-decoration: none;
}
.chatty-end-btn:hover { color: var(--chatty-red); }
.chatty-end-btn i { font-size: 11px; }

.chatty-char-count {
  font-size: 10px;
  color: var(--chatty-muted);
  font-family: inherit;
}

.chatty-chat-closed-bar {
  padding: 10px 14px;
  background: rgba(239,68,68,0.08);
  border-top: 1px solid rgba(239,68,68,0.2);
  color: var(--chatty-red);
  font-size: 12px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ─── CALLBACK FORM VIEW ────────────────────────────────── */
.chatty-form-view {
  overflow-y: auto;
  padding: 16px 14px;
  min-height: 0;
}
.chatty-form-view::-webkit-scrollbar { width: 4px; }
.chatty-form-view::-webkit-scrollbar-thumb { background: var(--chatty-bg4); border-radius: 4px; }

.chatty-back-btn {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  color: var(--chatty-muted);
  font-size: 12px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 0 14px;
  transition: color 0.15s;
}
.chatty-back-btn:hover { color: var(--chatty-text); }
.chatty-back-btn i { font-size: 11px; }

.chatty-form-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  font-family: inherit;
  margin: 0 0 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chatty-form-title i { color: var(--chatty-yellow); font-size: 16px; }

.chatty-form-desc {
  font-size: 12px;
  color: var(--chatty-text2);
  font-family: inherit;
  line-height: 1.6;
  margin: 0 0 18px;
  display: block;
}

.chatty-form-field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chatty-form-field label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--chatty-muted);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: default;
}
.chatty-form-field label i { color: var(--chatty-yellow); font-size: 10px; }

.chatty-req { color: var(--chatty-red); }

.chatty-form-field input {
  width: 100%;
  background: var(--chatty-bg2);
  border: 1px solid var(--chatty-border);
  border-radius: 10px;
  color: var(--chatty-text);
  font-size: 13px;
  font-family: inherit;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: block;
  cursor: text;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}
.chatty-form-field input:focus {
  border-color: var(--chatty-yellow);
  box-shadow: 0 0 0 3px rgba(253,254,0,0.1);
}
.chatty-form-field input::placeholder { color: var(--chatty-muted); }

.chatty-form-error {
  font-size: 12px;
  color: var(--chatty-red);
  font-family: inherit;
  display: none;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}
.chatty-form-error.visible { display: flex; }

.chatty-submit-btn {
  width: 100%;
  background: var(--chatty-yellow);
  color: #000;
  border: none;
  outline: none;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, transform 0.12s;
  margin-top: 8px;
}
.chatty-submit-btn:hover  { background: #e5e600; }
.chatty-submit-btn:active { transform: scale(0.98); }
.chatty-submit-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.chatty-submit-btn i { font-size: 14px; }

/* ─── SUCCESS VIEW ──────────────────────────────────────── */
.chatty-success-view {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 24px;
  gap: 10px;
}

.chatty-success-icon {
  font-size: 54px;
  color: var(--chatty-green);
  line-height: 1;
  margin-bottom: 4px;
}

.chatty-success-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  font-family: inherit;
  line-height: 1.4;
  display: block;
}

.chatty-success-desc {
  font-size: 13px;
  color: var(--chatty-text2);
  font-family: inherit;
  line-height: 1.6;
  display: block;
  margin-bottom: 6px;
}

.chatty-success-back {
  background: var(--chatty-bg2);
  border: 1px solid var(--chatty-border);
  border-radius: 9px;
  color: var(--chatty-text);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 9px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  margin-top: 6px;
}
.chatty-success-back:hover { border-color: var(--chatty-yellow); background: var(--chatty-bg3); }

/* ─── FOOTER ────────────────────────────────────────────── */
.chatty-footer {
  padding: 7px 14px;
  text-align: center;
  font-size: 10px;
  color: var(--chatty-muted);
  font-family: inherit;
  background: var(--chatty-bg2);
  border-top: 1px solid var(--chatty-border);
  flex-shrink: 0;
  letter-spacing: 0.2px;
}

/* ─── MOBILE ────────────────────────────────────────────── */
@media (max-width: 480px) {
  #chatty-widget-wrap {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
  }
  #chatty-panel {
    width: 100%;
    height: calc(100svh - 80px);
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    margin-bottom: 0;
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
  }
  #chatty-fab-btn {
    position: fixed;
    bottom: 16px;
    right: 16px;
    margin: 0;
  }
}
