/* ===========================================================
   MACCHINAA — Pre-order Inquiry Chat Widget
   Self-contained styles. Palette matches the site:
   primary red #bf2229, dark #1c191a, white cards.
   =========================================================== */

#mcc-inq-root {
  --inq-red: #bf2229;
  --inq-red-dark: #9c1b21;
  --inq-dark: #1c191a;
  --inq-gold: #e6c24c;
  --inq-card: #ffffff;
  --inq-ink: #1b1718;
  --inq-muted: #6b7785;
  --inq-line: #e2e7ee;
  --inq-bg: #f4f6f9;
  font-family: "Segoe UI", "Helvetica Neue", Tahoma, Arial, "Noto Sans Arabic", sans-serif;
}

/* ===== Floating launcher button ===== */
#mcc-inq-btn {
  position: fixed;
  inset-inline-start: 16px;      /* bottom-start corner (RTL aware) */
  bottom: 20px;                  /* desktop */
  z-index: 950;                  /* above bottom-nav (900), below overlay (1000) */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--inq-red), var(--inq-red-dark));
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: .95rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(191, 34, 41, .38), 0 2px 6px rgba(0, 0, 0, .25);
  border: 1.5px solid rgba(230, 194, 76, .65);
  transition: transform .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
#mcc-inq-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(191, 34, 41, .48); }
#mcc-inq-btn:active { transform: translateY(0); }
#mcc-inq-btn .inq-btn-ic { font-size: 1.25rem; line-height: 1; }
#mcc-inq-btn .inq-btn-tx { white-space: nowrap; }

/* unread dot */
#mcc-inq-btn .inq-dot {
  position: absolute;
  inset-block-start: -4px;
  inset-inline-end: -4px;
  width: 14px; height: 14px;
  background: var(--inq-gold);
  border: 2px solid #fff;
  border-radius: 50%;
  display: none;
}
#mcc-inq-btn.has-unread .inq-dot { display: block; }

/* hide button while panel is open */
#mcc-inq-root.inq-open #mcc-inq-btn { display: none; }

/* ===== Panel ===== */
#mcc-inq-panel {
  position: fixed;
  inset-inline-start: 16px;
  bottom: 20px;
  z-index: 951;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  display: none;
  flex-direction: column;
  background: var(--inq-card);
  border: 1px solid var(--inq-line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(28, 25, 26, .30);
  animation: inq-pop .18s ease;
}
#mcc-inq-root.inq-open #mcc-inq-panel { display: flex; }

@keyframes inq-pop {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== Panel header ===== */
.inq-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--inq-dark), #38302f);
  color: #fff;
}
.inq-head .inq-logo {
  width: 34px; height: 34px; flex: none; object-fit: contain;
  border-radius: 7px; background: #fff; padding: 2px;
}
.inq-head .inq-htxt { line-height: 1.3; flex: 1 1 auto; min-width: 0; }
.inq-head .inq-htxt .inq-title { font-weight: 800; font-size: .95rem; }
.inq-head .inq-htxt .inq-sub { font-size: .72rem; color: var(--inq-gold); }
.inq-head .inq-close {
  flex: none; background: rgba(255, 255, 255, .12); color: #fff; border: 0;
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  font-size: 1.1rem; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.inq-head .inq-close:hover { background: rgba(255, 255, 255, .22); }

/* ===== Body (scroll area) ===== */
.inq-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  background: var(--inq-bg);
}

/* intro + form view */
.inq-intro {
  background: #fff8f8;
  border: 1px solid var(--inq-line);
  border-inline-start: 4px solid var(--inq-red);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .85rem;
  color: var(--inq-ink);
  line-height: 1.6;
  margin-bottom: 12px;
}
.inq-form { display: flex; flex-direction: column; gap: 10px; }
.inq-form input,
.inq-form textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--inq-line);
  border-radius: 9px;
  font-family: inherit;
  font-size: .95rem;
  background: #fff;
  color: var(--inq-ink);
}
.inq-form textarea { resize: vertical; min-height: 78px; }
.inq-form input:focus,
.inq-form textarea:focus { outline: 2px solid var(--inq-red); border-color: var(--inq-red); }

.inq-btn-send {
  background: var(--inq-red);
  color: #fff; border: 0;
  padding: 12px; border-radius: 10px;
  font-family: inherit; font-weight: 800; font-size: .95rem;
  cursor: pointer;
}
.inq-btn-send:hover { background: var(--inq-red-dark); }
.inq-btn-send:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Conversation ===== */
.inq-msgs { display: flex; flex-direction: column; gap: 8px; }
.inq-msg {
  max-width: 82%;
  padding: 8px 11px;
  border-radius: 12px;
  font-size: .88rem;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.inq-msg .inq-meta { display: block; font-size: .62rem; opacity: .7; margin-top: 4px; }
/* visitor → right (start side in RTL) */
.inq-msg.visitor {
  align-self: flex-start;
  background: var(--inq-red);
  color: #fff;
  border-end-start-radius: 4px;
}
/* staff → left (end side in RTL) */
.inq-msg.staff {
  align-self: flex-end;
  background: #fff;
  color: var(--inq-ink);
  border: 1px solid var(--inq-line);
  border-end-end-radius: 4px;
}
.inq-msg.staff .inq-meta { color: var(--inq-muted); }

.inq-empty { text-align: center; color: var(--inq-muted); font-size: .82rem; padding: 16px 4px; }

/* ===== Footer / composer ===== */
.inq-foot {
  flex: none;
  border-top: 1px solid var(--inq-line);
  background: #fff;
  padding: 8px;
}
.inq-status {
  font-size: .7rem;
  min-height: 1em;
  padding: 0 4px 5px;
  color: var(--inq-muted);
}
.inq-status.err { color: var(--inq-red); font-weight: 700; }
.inq-status.ok  { color: #0f7a4d; }
.inq-compose { display: flex; gap: 6px; align-items: flex-end; }
.inq-compose textarea {
  flex: 1 1 auto;
  resize: none;
  max-height: 96px;
  min-height: 40px;
  padding: 10px 11px;
  border: 1px solid var(--inq-line);
  border-radius: 10px;
  font-family: inherit;
  font-size: .9rem;
}
.inq-compose textarea:focus { outline: 2px solid var(--inq-red); border-color: var(--inq-red); }
.inq-compose button {
  flex: none;
  width: 44px; height: 42px;
  background: var(--inq-red);
  color: #fff; border: 0; border-radius: 10px;
  font-size: 1.15rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.inq-compose button:hover { background: var(--inq-red-dark); }
.inq-compose button:disabled { opacity: .5; cursor: not-allowed; }

/* form-level error */
.inq-form-err {
  color: var(--inq-red);
  font-size: .78rem;
  font-weight: 700;
  min-height: 1em;
}

/* ===== Small screens: lift button above the fixed bottom-nav (~62px) ===== */
@media (max-width: 820px), (pointer: coarse) {
  #mcc-inq-btn {
    bottom: calc(74px + env(safe-area-inset-bottom));
  }
  #mcc-inq-panel {
    bottom: calc(74px + env(safe-area-inset-bottom));
    inset-inline-start: 12px;
    inset-inline-end: 12px;
    width: auto;
    max-width: none;
    max-height: 68vh;
  }
  /* on very small screens show icon only */
  #mcc-inq-btn .inq-btn-tx { display: none; }
  #mcc-inq-btn { padding: 14px; }
  #mcc-inq-btn .inq-btn-ic { font-size: 1.4rem; }
}

@media print {
  #mcc-inq-root { display: none !important; }
}
