@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;800&family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --red: #be3321;
  --red-dark: #8f2316;
  --red-light: #e84c38;
  --green: #1a5c35;
  --gold: #d4970a;
  --gold-light: #f6d97a;
  --cream: #fdf8f2;
  --bg: #f5f0eb;
  --text: #1a1008;
  --muted: #7a6a5a;
  --border: #e8ddd2;
  --white: #ffffff;
  --shadow-lg: 0 32px 80px rgba(190,51,33,0.18), 0 8px 20px rgba(0,0,0,0.08);
  --shadow-panel: 0 40px 100px rgba(0,0,0,0.25), 0 0 0 1px rgba(190,51,33,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ── Page Layout ── */
.page-bg {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(ellipse 60% 50% at 10% 20%, rgba(190,51,33,0.07), transparent),
    radial-gradient(ellipse 50% 60% at 90% 80%, rgba(26,92,53,0.06), transparent),
    linear-gradient(160deg, #fdf8f2 0%, #f0e8df 100%);
}

.demo-card {
  width: min(780px, 94vw);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 32px;
  padding: 48px 44px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.10), 0 0 0 1px rgba(190,51,33,0.05);
  position: relative;
  overflow: hidden;
}

.demo-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--green), var(--red), var(--gold));
}

.demo-card-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 20px;
  box-shadow: 0 6px 20px rgba(190,51,33,0.2);
}

.demo-card h1 {
  font-family: 'Playfair Display', serif;
  font-size: 38px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 12px;
}

.demo-card h1 span {
  color: var(--red);
}

.demo-card .subtitle {
  font-size: 16px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.6;
  max-width: 480px;
}

.demo-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
  margin: 28px 0;
}

.try-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.try-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.try-row button {
  border: 1.5px solid var(--border);
  background: var(--cream);
  color: var(--red-dark);
  padding: 11px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}

.try-row button:hover {
  background: var(--red);
  color: white;
  border-color: var(--red);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(190,51,33,0.25);
}

/* ── Chat Toggle Button ── */
.mf-chat-button {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 72px;
  height: 72px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--red-light), var(--red-dark));
  box-shadow: 0 8px 30px rgba(190,51,33,0.45), 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
  z-index: 99998;
  display: grid;
  place-items: center;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s ease;
}

.mf-chat-button:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 40px rgba(190,51,33,0.55), 0 4px 12px rgba(0,0,0,0.15);
}

.mf-chat-button img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.mf-chat-button span {
  font-size: 30px;
  line-height: 1;
}

/* ── Chat Panel ── */
.mf-panel {
  position: fixed;
  right: 28px;
  bottom: 116px;
  width: min(440px, calc(100vw - 32px));
  height: auto;
  max-height: calc(100vh - 148px);
  background: var(--white);
  border-radius: 28px;
  border: 1px solid rgba(190,51,33,0.12);
  box-shadow: var(--shadow-panel);
  z-index: 99999;
  display: none;
  overflow: hidden;
  transform-origin: bottom right;
  animation: panelIn 0.3s cubic-bezier(0.34,1.4,0.64,1);
}

@keyframes panelIn {
  from { opacity: 0; transform: scale(0.88) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.mf-panel.open {
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.mf-head {
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--red-dark) 0%, var(--red) 60%, var(--red-light) 100%);
  color: white;
  display: flex;
  gap: 13px;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}

.mf-head::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), transparent 70%);
  opacity: 0.7;
}

.mf-head img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.35);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  background: white;
}

.mf-head-text { flex: 1; }

.mf-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.mf-sub {
  font-size: 11px;
  opacity: 0.78;
  margin-top: 3px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.mf-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  margin-right: 5px;
  box-shadow: 0 0 0 2px rgba(74,222,128,0.3);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(74,222,128,0.3); }
  50% { box-shadow: 0 0 0 5px rgba(74,222,128,0.1); }
}

.mf-close {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.2s;
  line-height: 1;
}

.mf-close:hover { background: rgba(255,255,255,0.28); }

/* ── Chat Body ── */
.mf-body {
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
  padding: 20px 16px;
  background: var(--cream);
  scroll-behavior: smooth;
}

.mf-body::-webkit-scrollbar { width: 5px; }
.mf-body::-webkit-scrollbar-track { background: transparent; }
.mf-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ── Messages ── */
.mf-msg {
  max-width: 86%;
  padding: 13px 16px;
  border-radius: 20px;
  margin-bottom: 10px;
  line-height: 1.55;
  font-size: 14.5px;
  white-space: pre-wrap;
  word-break: break-word;
  animation: msgIn 0.25s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mf-bot {
  background: var(--white);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.mf-user {
  margin-left: auto;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: white;
  border-bottom-right-radius: 5px;
  box-shadow: 0 4px 14px rgba(190,51,33,0.3);
}

/* ── Quick Chips ── */
.mf-chips {
  padding: 10px 14px;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--red) #f3e4da;
}

.mf-chips::-webkit-scrollbar {
  height: 8px;
}

.mf-chips::-webkit-scrollbar-track {
  background: #f3e4da;
  border-radius: 999px;
}

.mf-chips::-webkit-scrollbar-thumb {
  background: var(--red);
  border-radius: 999px;
}

.mf-chips::-webkit-scrollbar-thumb:hover {
  background: var(--red-dark);
}

.mf-chip {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1.5px solid rgba(190,51,33,0.2);
  background: var(--cream);
  color: var(--red-dark);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.mf-chip:hover {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

/* ── Input Form ── */
.mf-form {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  background: var(--white);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.mf-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 14.5px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  color: var(--text);
  background: var(--cream);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.mf-input:focus {
  border-color: var(--red);
  background: white;
  box-shadow: 0 0 0 3px rgba(190,51,33,0.1);
}

.mf-send {
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: white;
  padding: 0 20px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(190,51,33,0.3);
  flex-shrink: 0;
}

.mf-send:hover {
  background: linear-gradient(135deg, var(--red-light), var(--red));
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(190,51,33,0.4);
}

/* ── Links & Images ── */
.mf-links, .mf-images {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 12px;
}

.mf-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  background: linear-gradient(135deg, #fff8e6, #fff3d4);
  border: 1.5px solid var(--gold-light);
  color: #6b4800;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}

.mf-link:hover {
  background: var(--gold);
  color: white;
  border-color: var(--gold);
}

.mf-images img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: white;
  transition: transform 0.2s;
}

.mf-images img:hover { transform: scale(1.04); }

/* ── Typing Indicator ── */
.mf-typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 4px 2px;
}

.mf-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c0a090;
  display: block;
  animation: mfblink 1.2s infinite ease-in-out;
}

.mf-typing i:nth-child(2) { animation-delay: 0.18s; }
.mf-typing i:nth-child(3) { animation-delay: 0.36s; }

@keyframes mfblink {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-5px); opacity: 1; background: var(--red); }
}

/* ── Responsive ── */
@media (max-width: 520px) {
  .mf-panel {
    right: 8px;
    bottom: 96px;
    width: calc(100vw - 16px);
    height: auto;
    max-height: calc(100vh - 112px);
    border-radius: 22px;
  }
  .mf-body {
    max-height: calc(100vh - 300px);
  }
  .mf-chat-button {
    right: 16px;
    bottom: 16px;
    width: 64px;
    height: 64px;
  }
  .demo-card {
    padding: 32px 24px;
  }
  .demo-card h1 {
    font-size: 28px;
  }
}