/* Chef's Restaurant Store - Chat Widget */
.crs-chat-launcher {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9302c, #ff6b35);
  color: #fff;
  border: none;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.crs-chat-launcher:hover { transform: translateY(-2px); }
.crs-chat-launcher svg { width: 24px; height: 24px; }
.crs-chat-launcher .crs-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 10px; height: 10px;
  background: #25d366;
  border: 2px solid white;
  border-radius: 50%;
}

.crs-chat-panel {
  position: fixed !important;
  right: 18px; bottom: 86px;
  z-index: 2147483646; /* near max int — beat any site-wide overlays */
  width: min(380px, calc(100vw - 24px));
  height: min(580px, calc(100vh - 110px));
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  pointer-events: auto !important;
  isolation: isolate;
}
.crs-chat-panel.crs-open { display: flex !important; }
.crs-chat-panel * { pointer-events: auto !important; box-sizing: border-box; }
.crs-chat-launcher { z-index: 2147483647; pointer-events: auto !important; }

.crs-chat-header {
  background: linear-gradient(135deg, #c9302c, #ff6b35);
  color: white;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.crs-chat-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.crs-chat-header small { display: block; opacity: 0.85; font-size: 11px; margin-top: 2px; }
.crs-chat-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.crs-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f7f7f7;
}
.crs-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 14px;
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.crs-msg-user {
  background: #c9302c;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}
.crs-msg-bot {
  background: white;
  color: #222;
  border: 1px solid #e5e5e5;
  border-bottom-left-radius: 4px;
}
.crs-msg-bot.crs-typing { font-style: italic; color: #888; }

.crs-product-cards-wrap {
  position: relative;
  margin-bottom: 4px;
}
.crs-product-cards-wrap::before {
  content: "swipe for more →";
  display: block;
  font-size: 10px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: right;
  padding: 0 4px 2px 0;
}
.crs-product-cards-wrap.crs-no-overflow::before { display: none; }
.crs-product-cards-wrap::after {
  content: "";
  position: absolute;
  top: 14px; right: 0; bottom: 12px;
  width: 36px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(247,247,247,0), #f7f7f7 85%);
  border-radius: 0 10px 10px 0;
  opacity: 1;
  transition: opacity 0.2s;
}
.crs-product-cards-wrap.crs-scrolled-end::after,
.crs-product-cards-wrap.crs-no-overflow::after { opacity: 0; }
.crs-product-cards {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.crs-product-cards::-webkit-scrollbar { height: 4px; }
.crs-product-cards::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }
.crs-product-card {
  flex: 0 0 130px;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
  scroll-snap-align: start;
}
.crs-product-card:hover { border-color: #c9302c; }
.crs-product-card { position: relative; }
.crs-product-card img {
  width: 100%; height: 80px; object-fit: cover;
  border-radius: 6px; margin-bottom: 6px; background: #f0f0f0;
}
.crs-quick-add {
  position: absolute;
  top: 4px; right: 4px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(201, 48, 44, 0.95);
  color: white;
  border: 2px solid white;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: transform 0.15s, background 0.15s;
  padding: 0;
  z-index: 2;
}
.crs-quick-add:hover {
  background: #c9302c;
  transform: scale(1.1);
}
.crs-quick-add.crs-added {
  background: #25a058;
  pointer-events: none;
}
.crs-quick-add.crs-loading {
  opacity: 0.7;
  pointer-events: none;
}
.crs-product-card .crs-pname {
  font-size: 12px; font-weight: 600; color: #222;
  margin-bottom: 2px; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.crs-product-card .crs-pprice { font-size: 13px; color: #c9302c; font-weight: 700; }

/* Cart card */
.crs-cart-card {
  background: white;
  border: 1px solid #e5e5e5;
  border-left: 4px solid #c9302c;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}
.crs-cart-title {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #888;
  margin-bottom: 8px;
}
.crs-cart-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dashed #eee;
}
.crs-cart-line:last-of-type { border-bottom: none; }
.crs-cart-qty { color: #c9302c; font-weight: 700; }
.crs-cart-name {
  flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #222;
}
.crs-cart-total { color: #222; font-weight: 600; }
.crs-cart-totals { margin-top: 8px; padding-top: 8px; border-top: 1px solid #eee; }
.crs-cart-totals > div {
  display: flex; justify-content: space-between;
  font-size: 12px; color: #555; padding: 2px 0;
}
.crs-cart-grand {
  font-size: 14px !important; font-weight: 700; color: #c9302c !important;
  margin-top: 4px; padding-top: 6px !important; border-top: 1px solid #eee;
}

/* Order confirmation */
.crs-order-card {
  background: linear-gradient(135deg, #1f7a3a, #2a8c4a);
  color: white;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  font-size: 13px;
}
.crs-order-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.crs-order-num {
  font-family: "SF Mono", Monaco, Consolas, monospace;
  font-size: 16px; font-weight: 700; margin-bottom: 10px; opacity: 0.95;
}
.crs-order-line {
  display: flex; justify-content: space-between;
  padding: 3px 0; opacity: 0.95;
}
.crs-order-note {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.25);
  font-size: 11px; opacity: 0.85;
}

/* Footer (input area) */
.crs-chat-footer {
  border-top: 1px solid #e5e5e5;
  padding: 10px;
  background: white;
  display: flex; gap: 8px;
}
.crs-chat-input {
  flex: 1; padding: 9px 12px;
  border: 1px solid #ddd !important; border-radius: 22px !important;
  background: #fff !important;
  color: #222 !important;
  font-size: 14px !important;
  outline: none; font-family: inherit;
  display: block !important;
  width: auto !important;
  height: auto !important;
  min-height: 36px;
  appearance: none !important;
  -webkit-appearance: none !important;
  pointer-events: auto !important;
  user-select: text !important;
  cursor: text !important;
  opacity: 1 !important;
  visibility: visible !important;
}
.crs-chat-input:focus { border-color: #c9302c !important; }
.crs-chat-send {
  background: #c9302c !important; color: white !important;
  border: none !important; border-radius: 22px !important;
  padding: 0 16px !important; font-weight: 600;
  cursor: pointer !important; font-size: 13px;
  min-height: 36px;
  pointer-events: auto !important;
  opacity: 1 !important;
}
.crs-chat-send:disabled { opacity: 0.5 !important; cursor: not-allowed !important; }
