/* ===========================================
   JunkBot Widget — Styles
   Green / White — Professional Junk Removal
   =========================================== */

:root {
  --jb-primary:       #2e7d32;
  --jb-primary-dark:  #1b5e20;
  --jb-primary-light: #43a047;
  --jb-white:         #ffffff;
  --jb-gray-50:       #f8fafc;
  --jb-gray-100:      #f1f5f9;
  --jb-gray-200:      #e2e8f0;
  --jb-gray-400:      #94a3b8;
  --jb-gray-600:      #475569;
  --jb-gray-800:      #1e293b;
  --jb-shadow:        0 12px 48px rgba(0, 0, 0, 0.16);
  --jb-radius:        18px;
  --jb-bubble:        62px;
  --jb-width:         390px;
  --jb-height:        620px;
}

/* ── Floating Bubble ── */
#cjo-jb-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: var(--jb-bubble);
  height: var(--jb-bubble);
  border-radius: 50%;
  background: var(--jb-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(46, 125, 50, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 99999;
  border: none;
  outline: none;
  padding: 0;
}

#cjo-jb-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 28px rgba(46, 125, 50, 0.55);
}

#cjo-jb-bubble:focus-visible {
  outline: 3px solid var(--jb-primary-light);
  outline-offset: 2px;
}

.jb-bubble-icon,
.jb-bubble-close {
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.jb-bubble-icon svg {
  width: 28px;
  height: 28px;
  fill: white;
  display: block;
}

.jb-bubble-close {
  opacity: 0;
  transform: rotate(-90deg);
}

.jb-bubble-close svg {
  width: 22px;
  height: 22px;
  stroke: white;
  fill: none;
  display: block;
}

#cjo-jb-bubble.open .jb-bubble-icon {
  opacity: 0;
  transform: rotate(90deg);
}

#cjo-jb-bubble.open .jb-bubble-close {
  opacity: 1;
  transform: rotate(0deg);
}

/* Notification pulse when closed */
#cjo-jb-bubble:not(.open)::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 11px;
  height: 11px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid white;
  animation: jb-pulse 2.5s infinite;
}

@keyframes jb-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.25); opacity: 0.7; }
}

/* ── Widget Window ── */
#cjo-jb-window {
  position: fixed;
  bottom: calc(var(--jb-bubble) + 36px);
  right: 24px;
  width: var(--jb-width);
  height: var(--jb-height);
  background: var(--jb-white);
  border-radius: var(--jb-radius);
  box-shadow: var(--jb-shadow);
  display: flex;
  flex-direction: column;
  z-index: 99998;
  overflow: hidden;
  /* Closed state */
  transform: scale(0.88) translateY(16px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.2s ease;
}

#cjo-jb-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
.jb-header {
  background: linear-gradient(135deg, var(--jb-primary) 0%, var(--jb-primary-dark) 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.jb-header-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.jb-header-avatar svg {
  width: 22px;
  height: 22px;
  fill: white;
}

.jb-header-info {
  flex: 1;
  min-width: 0;
}

.jb-header-name {
  color: white;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.jb-header-status {
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.jb-header-status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #86efac;
  border-radius: 50%;
  flex-shrink: 0;
}

.jb-header-actions {
  display: flex;
  gap: 6px;
}

.jb-header-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.jb-header-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.jb-header-btn svg {
  width: 15px;
  height: 15px;
  stroke: white;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

/* ── Messages Area ── */
.jb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--jb-gray-50);
  scroll-behavior: smooth;
}

.jb-messages::-webkit-scrollbar { width: 4px; }
.jb-messages::-webkit-scrollbar-track { background: transparent; }
.jb-messages::-webkit-scrollbar-thumb {
  background: var(--jb-gray-200);
  border-radius: 2px;
}

/* ── Message Bubbles ── */
.jb-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: jb-fade-up 0.22s ease;
}

@keyframes jb-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.jb-msg.bot  { align-self: flex-start; }
.jb-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.jb-msg-avatar {
  width: 28px;
  height: 28px;
  background: var(--jb-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.jb-msg-avatar svg {
  width: 15px;
  height: 15px;
  fill: white;
}

.jb-msg-bubble {
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  word-wrap: break-word;
  max-width: 100%;
}

.jb-msg.bot .jb-msg-bubble {
  background: var(--jb-white);
  color: var(--jb-gray-800);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.07);
}

.jb-msg.user .jb-msg-bubble {
  background: var(--jb-primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.jb-msg-bubble strong { font-weight: 700; }
.jb-msg-bubble em     { font-style: italic; }
.jb-msg-bubble ul     { margin: 6px 0 2px 16px; padding: 0; }
.jb-msg-bubble li     { margin-bottom: 2px; }

/* Uploaded image in chat */
.jb-msg-image {
  max-width: 190px;
  border-radius: 10px;
  display: block;
  margin-bottom: 6px;
  border: 1px solid var(--jb-gray-200);
}

/* ── Typing Indicator ── */
.jb-typing {
  display: flex;
  gap: 8px;
  align-self: flex-start;
  align-items: flex-end;
  animation: jb-fade-up 0.2s ease;
}

.jb-typing-dots {
  background: var(--jb-white);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 12px 14px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.07);
  display: flex;
  gap: 5px;
  align-items: center;
}

.jb-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--jb-gray-400);
  border-radius: 50%;
  animation: jb-bounce 1.3s infinite ease-in-out;
}
.jb-typing-dot:nth-child(2) { animation-delay: 0.16s; }
.jb-typing-dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes jb-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-6px); }
}

/* ── Quote Card ── */
.jb-quote-wrap {
  align-self: flex-start;
  width: 100%;
  max-width: 100%;
  animation: jb-fade-up 0.3s ease;
}

.jb-quote-card {
  background: var(--jb-white);
  border: 2px solid var(--jb-primary-light);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 3px 14px rgba(46, 125, 50, 0.12);
}

.jb-quote-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
}

.jb-quote-header-icon {
  width: 32px;
  height: 32px;
  background: var(--jb-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.jb-quote-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--jb-primary-dark);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.2;
}

.jb-quote-subtitle {
  font-size: 11px;
  color: var(--jb-gray-400);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.jb-quote-items {
  border-top: 1px solid var(--jb-gray-200);
  padding-top: 10px;
}

.jb-quote-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--jb-gray-600);
  padding: 5px 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  border-bottom: 1px dashed var(--jb-gray-200);
  gap: 8px;
}

.jb-quote-line:last-of-type {
  border-bottom: none;
}

.jb-quote-line-label { flex: 1; }
.jb-quote-line-cost  { font-weight: 600; color: var(--jb-gray-800); white-space: nowrap; }

.jb-quote-empty {
  font-size: 13px;
  color: var(--jb-gray-400);
  font-style: italic;
  padding: 6px 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.jb-quote-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--jb-primary-dark);
  padding: 11px 0 4px;
  margin-top: 8px;
  border-top: 2px solid var(--jb-primary-light);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.jb-quote-note {
  font-size: 11px;
  color: var(--jb-gray-400);
  margin-top: 10px;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── CTA Buttons ── */
.jb-cta-row {
  display: flex;
  gap: 8px;
  margin-top: 13px;
}

.jb-btn {
  flex: 1;
  padding: 10px 10px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-align: center;
  text-decoration: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1.2;
}

.jb-btn-primary {
  background: var(--jb-primary);
  color: white !important;
}

.jb-btn-primary:hover {
  background: var(--jb-primary-dark);
  color: white !important;
}

.jb-btn-secondary {
  background: var(--jb-gray-100);
  color: var(--jb-gray-800) !important;
  border: 1px solid var(--jb-gray-200);
}

.jb-btn-secondary:hover {
  background: var(--jb-gray-200);
  color: var(--jb-gray-800) !important;
}

/* ── Input Area ── */
.jb-input-area {
  padding: 10px 14px 10px;
  background: var(--jb-white);
  border-top: 1px solid var(--jb-gray-200);
  flex-shrink: 0;
}

/* Dimensions Panel Toggle */
.jb-dim-toggle-row {
  text-align: center;
  padding: 2px 0 8px;
}

.jb-dim-toggle-btn {
  font-size: 11px;
  color: var(--jb-primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: background 0.12s;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.jb-dim-toggle-btn:hover {
  background: var(--jb-gray-100);
  text-decoration: none;
}

/* Dimensions Panel */
.jb-dim-panel {
  background: var(--jb-gray-50);
  border: 1px solid var(--jb-gray-200);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 9px;
  display: none;
}

.jb-dim-panel.open { display: block; }

.jb-dim-panel-title {
  font-size: 11px;
  color: var(--jb-gray-600);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 0 0 9px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.jb-dim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 9px;
}

.jb-dim-field label {
  font-size: 11px;
  color: var(--jb-gray-400);
  display: block;
  margin-bottom: 3px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.jb-dim-field input {
  width: 100%;
  border: 1px solid var(--jb-gray-200);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  outline: none;
  box-sizing: border-box;
  background: white;
  transition: border-color 0.14s;
}

.jb-dim-field input:focus { border-color: var(--jb-primary-light); }

.jb-dim-submit {
  width: 100%;
  padding: 8px;
  background: var(--jb-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: background 0.15s;
}

.jb-dim-submit:hover { background: var(--jb-primary-dark); }

/* Image Upload Preview */
.jb-img-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  background: var(--jb-gray-50);
  border: 1px solid var(--jb-gray-200);
  border-radius: 9px;
  padding: 6px 8px;
}

.jb-img-preview-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  flex-shrink: 0;
}

.jb-img-preview-label {
  flex: 1;
  font-size: 12px;
  color: var(--jb-gray-600);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jb-img-preview-remove {
  background: var(--jb-gray-200);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--jb-gray-600);
  line-height: 1;
  transition: background 0.12s;
}

.jb-img-preview-remove:hover { background: #fca5a5; color: #991b1b; }

/* Input Row */
.jb-input-row {
  display: flex;
  gap: 7px;
  align-items: flex-end;
}

#cjo-jb-input {
  flex: 1;
  border: 1.5px solid var(--jb-gray-200);
  border-radius: 11px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  resize: none;
  outline: none;
  max-height: 100px;
  line-height: 1.45;
  transition: border-color 0.15s;
  background: white;
  color: var(--jb-gray-800);
}

#cjo-jb-input:focus { border-color: var(--jb-primary-light); }
#cjo-jb-input::placeholder { color: var(--jb-gray-400); }

.jb-action-btns {
  display: flex;
  gap: 6px;
  align-items: center;
}

.jb-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  padding: 0;
}

.jb-upload-btn {
  background: var(--jb-gray-100);
  border: 1px solid var(--jb-gray-200);
}

.jb-upload-btn:hover { background: var(--jb-gray-200); }

.jb-upload-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--jb-gray-600);
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.jb-send-btn {
  background: var(--jb-primary);
}

.jb-send-btn:hover:not(:disabled) { background: var(--jb-primary-dark); }

.jb-send-btn:disabled {
  background: var(--jb-gray-200);
  cursor: not-allowed;
}

.jb-send-btn svg {
  width: 18px;
  height: 18px;
  fill: white;
}

.jb-send-btn:disabled svg { fill: var(--jb-gray-400); }

/* Footer */
.jb-footer-bar {
  text-align: center;
  font-size: 10px;
  color: var(--jb-gray-400);
  padding: 4px 0 2px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: 0.2px;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  :root {
    --jb-width: 80vw;
    --jb-height: 50dvh;
  }

  #cjo-jb-window {
    bottom: calc(var(--jb-bubble) + 20px);
    right: 12px;
    border-radius: var(--jb-radius);
    transform-origin: bottom right;
    height: 75dvh;
    height: 75vh; /* fallback */
    max-height: 560px;
  }

  #cjo-jb-bubble {
    bottom: 11px;
    right: 11px;
  }
}

@media (max-width: 360px) {
  .jb-dim-grid { grid-template-columns: 1fr; }
  .jb-category-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Category Grid ── */
.jb-category-wrap {
  align-self: flex-start;
  width: 100%;
  animation: jb-fade-up 0.25s ease;
}

.jb-category-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--jb-gray-400);
  margin-bottom: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.jb-category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.jb-cat-btn {
  background: var(--jb-white);
  border: 1.5px solid var(--jb-gray-200);
  border-radius: 11px;
  padding: 10px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.jb-cat-btn:hover {
  border-color: var(--jb-primary-light);
  background: #f0f7ff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.jb-cat-icon { font-size: 22px; line-height: 1; }

.jb-cat-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--jb-gray-800);
  text-align: center;
  line-height: 1.3;
}

/* ── Quick Reply Chips ── */
.jb-quickreply-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-self: flex-start;
  padding: 2px 0 4px;
  animation: jb-fade-up 0.2s ease;
}

.jb-quickreply-btn {
  background: var(--jb-white);
  border: 1.5px solid var(--jb-primary);
  color: var(--jb-primary);
  border-radius: 20px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: all 0.14s;
  white-space: nowrap;
}

.jb-quickreply-btn:hover {
  background: var(--jb-primary);
  color: white;
}

/* ── Quote Items List ── */
.jb-quote-items-list {
  font-size: 12px;
  color: var(--jb-gray-600);
  margin-bottom: 10px;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
