/* =========================================================
   DGLT RESERVATION CHATBOT EXTENSIONS

   This stylesheet is loaded after css/style.css.
   It styles:
   - chatbot status messages
   - sample catering packages
   - reservation summaries
   - confirmation actions
   - OTP and completion states
========================================================= */

/* =========================================================
   CATERING CHAT PANEL SIZE
========================================================= */

body[data-chat-mode="catering"] .chat-panel {
  width:
    min(
      480px,
      calc(100vw - 32px)
    );

  height:
    min(
      720px,
      calc(100vh - 125px)
    );
}

body[data-chat-mode="catering"] .chat-body {
  scroll-behavior: smooth;
}

/* =========================================================
   CHAT MESSAGE STATES
========================================================= */

.chat-message.loading {
  color: var(--muted);
  background: #f7f2f2;

  font-style: italic;
}

.chat-message.loading::after {
  content: "";

  display: inline-block;

  width: 14px;
  height: 14px;
  margin-left: 8px;

  border:
    2px solid rgba(201, 20, 30, 0.18);

  border-top-color:
    var(--primary-red);

  border-radius: 50%;

  vertical-align: -2px;

  animation:
    chatbot-loading-spin
    700ms
    linear
    infinite;
}

.chat-message.error {
  border-color:
    rgba(180, 35, 44, 0.25);

  color: var(--danger);
  background: #fff1f2;
}

.chat-message.success {
  border-color:
    rgba(38, 131, 74, 0.24);

  color: var(--success);
  background: #edf9f1;

  font-weight: 800;
}

.chat-message.development {
  border-color:
    rgba(194, 120, 3, 0.28);

  color: #895200;
  background: #fff7e8;

  font-family:
    Consolas,
    "Courier New",
    monospace;

  font-weight: 800;
}

@keyframes chatbot-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================
   PACKAGE LIST
========================================================= */

.chat-package-list {
  width: 100%;
  margin-bottom: 18px;

  display: grid;
  gap: 14px;
}

.chat-package-note {
  margin: 0;
  padding: 12px 14px;

  border:
    1px solid rgba(194, 120, 3, 0.22);

  border-radius: 14px;

  color: #805000;
  background: #fff7e7;

  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

/* =========================================================
   PACKAGE CARD
========================================================= */

.chat-package-card {
  width: 100%;
  padding: 17px;

  border:
    1px solid var(--soft-border);

  border-radius: 18px;

  display: grid;
  gap: 10px;

  background:
    linear-gradient(
      180deg,
      var(--white),
      #fffafa
    );

  box-shadow:
    0 8px 20px
    rgba(82, 24, 28, 0.08);

  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.chat-package-card:hover {
  border-color: var(--primary-red);

  box-shadow:
    0 12px 28px
    rgba(82, 24, 28, 0.14);

  transform:
    translateY(-2px);
}

.chat-package-level {
  width: fit-content;
  padding: 5px 10px;

  border:
    1px solid var(--soft-red);

  border-radius:
    var(--radius-pill);

  color: var(--primary-red);
  background: var(--light-red);

  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-package-title {
  margin: 0;

  color: var(--charcoal);

  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
}

.chat-package-description {
  margin: 0;

  color: var(--muted);

  font-size: 12px;
  line-height: 1.5;
}

.chat-package-price {
  display: block;

  color: var(--primary-red);

  font-size: 23px;
  font-weight: 900;
}

.chat-package-per-guest {
  display: block;
  margin-top: -7px;

  color: var(--muted);

  font-size: 11px;
  font-weight: 700;
}

/* =========================================================
   PACKAGE ITEMS
========================================================= */

.chat-package-items {
  margin: 2px 0 4px;

  display: grid;
  gap: 7px;
}

.chat-package-items li {
  position: relative;

  padding-left: 17px;

  color: var(--charcoal);

  font-size: 12px;
  line-height: 1.45;
}

.chat-package-items li::before {
  content: "✓";

  position: absolute;
  top: 0;
  left: 0;

  color: var(--success);

  font-weight: 900;
}

/* =========================================================
   PACKAGE SELECTION BUTTON
========================================================= */

.chat-package-select {
  width: 100%;
  min-height: 42px;
  padding: 0 15px;

  border: 0;

  border-radius: 13px;

  color: var(--white);

  background:
    linear-gradient(
      135deg,
      var(--primary-red),
      var(--deep-red)
    );

  box-shadow:
    0 7px 16px
    rgba(201, 20, 30, 0.18);

  font-size: 12px;
  font-weight: 900;

  transition:
    transform var(--transition),
    box-shadow var(--transition),
    opacity var(--transition);
}

.chat-package-select:hover {
  transform:
    translateY(-1px);

  box-shadow:
    0 10px 20px
    rgba(201, 20, 30, 0.25);
}

.chat-package-select:disabled {
  cursor: not-allowed;
  opacity: 0.55;

  transform: none;
  box-shadow: none;
}

/* =========================================================
   RESERVATION SUMMARY CARD
========================================================= */

.chat-summary-card {
  width: 100%;
  margin-bottom: 18px;
  padding: 17px;

  border:
    1px solid var(--border);

  border-radius: 18px;

  background: var(--white);

  box-shadow:
    0 8px 20px
    rgba(82, 24, 28, 0.09);
}

.chat-summary-title {
  margin: 0 0 15px;

  color: var(--primary-red);

  font-size: 18px;
  font-weight: 900;
}

.chat-summary-row {
  padding: 9px 0;

  border-bottom:
    1px solid var(--soft-border);

  display: grid;

  grid-template-columns:
    minmax(90px, 0.8fr)
    minmax(0, 1.2fr);

  align-items: start;
  gap: 12px;

  font-size: 12px;
  line-height: 1.45;
}

.chat-summary-row:last-of-type {
  border-bottom: 0;
}

.chat-summary-row span {
  color: var(--muted);

  font-weight: 700;
}

.chat-summary-row strong {
  min-width: 0;

  color: var(--charcoal);

  font-weight: 900;

  text-align: right;

  overflow-wrap: anywhere;
}

.chat-summary-question {
  margin:
    16px 0 12px;

  color: var(--charcoal);

  font-size: 13px;
  font-weight: 900;
  line-height: 1.5;
}

.chat-summary-items {
  margin-top: 14px;
  padding: 12px;
  background: #fbf7f2;
  border: 1px solid var(--soft-border);
  border-radius: 13px;
}

.chat-summary-items h4 {
  margin: 0 0 9px;
  color: var(--charcoal);
  font-size: 11px;
  font-weight: 900;
}

.chat-summary-items ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-summary-items li {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--charcoal);
  font-size: 11px;
}

.chat-summary-items li > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.chat-summary-items li > strong {
  margin-left: auto;
  flex: 0 0 auto;
  color: var(--primary-red);
  font-size: 10px;
}

.chat-summary-items li > small {
  padding: 2px 6px;
  flex: 0 0 auto;
  color: #146c43;
  background: #eaf8f0;
  border-radius: var(--radius-pill);
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.chat-summary-preference-note {
  margin: 11px 0 0;
  padding: 10px 11px;
  color: #675b52;
  background: #fffaf3;
  border-left: 3px solid var(--primary-red);
  border-radius: 5px 10px 10px 5px;
  font-size: 10px;
  line-height: 1.55;
}

/* =========================================================
   SUMMARY ACTIONS
========================================================= */

.chat-summary-actions {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 9px;
}

.chat-action-primary,
.chat-action-secondary {
  min-height: 42px;
  padding: 0 12px;

  border-radius: 12px;

  font-size: 12px;
  font-weight: 900;

  transition:
    color var(--transition),
    background var(--transition),
    border-color var(--transition),
    transform var(--transition),
    opacity var(--transition);
}

.chat-action-primary {
  border:
    1px solid var(--primary-red);

  color: var(--white);
  background: var(--primary-red);
}

.chat-action-primary:hover {
  background: var(--deep-red);
  border-color: var(--deep-red);

  transform:
    translateY(-1px);
}

.chat-action-secondary {
  border:
    1px solid var(--border);

  color: var(--primary-red);
  background: var(--white);
}

.chat-action-secondary:hover {
  color: var(--white);
  background: var(--primary-red);
  border-color: var(--primary-red);

  transform:
    translateY(-1px);
}

.chat-action-primary:disabled,
.chat-action-secondary:disabled {
  cursor: not-allowed;
  opacity: 0.55;

  transform: none;
}

/* =========================================================
   OTP AND FINAL RECEIPT
========================================================= */

.chat-otp-card,
.chat-receipt-card {
  width: 100%;
  margin-bottom: 18px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--soft-border);
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(82, 24, 28, 0.09);
}

.chat-otp-card h3,
.chat-receipt-card h3 {
  margin: 0 0 8px;
  color: var(--charcoal);
  font-size: 17px;
  font-weight: 900;
}

.chat-otp-card p,
.chat-receipt-card > p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.chat-otp-card > small {
  display: block;
  color: #756b65;
  font-size: 9px;
  line-height: 1.5;
}

.chat-otp-resend {
  width: 100%;
  min-height: 40px;
  margin-top: 12px;
  color: var(--primary-red);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: 11px;
  font-weight: 900;
}

.chat-otp-resend:hover:not(:disabled) {
  color: var(--white);
  background: var(--primary-red);
  border-color: var(--primary-red);
}

.chat-otp-resend:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.chat-receipt-card {
  border-color: rgba(38, 131, 74, 0.3);
  background: linear-gradient(180deg, #ffffff, #f4fbf6);
}

.chat-receipt-status {
  display: inline-flex;
  margin-bottom: 9px;
  padding: 4px 8px;
  color: #146c43;
  background: #e7f7ed;
  border-radius: var(--radius-pill);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* =========================================================
   CHAT OPTION BUTTONS
========================================================= */

body[data-chat-mode="catering"]
.chat-options {
  width: 100%;

  display: grid;

  grid-template-columns:
    repeat(
      2,
      minmax(0, 1fr)
    );

  gap: 8px;
}

body[data-chat-mode="catering"]
.chat-option-button {
  width: 100%;
  min-height: 40px;
  height: auto;
  padding: 9px 12px;

  white-space: normal;
  line-height: 1.3;
}

/* =========================================================
   CHAT FORM STATES
========================================================= */

body[data-chat-mode="catering"]
.chat-input:disabled,
body[data-chat-mode="catering"]
.chat-send:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

body[data-chat-mode="catering"]
.chat-input[inputmode="numeric"] {
  letter-spacing: 0.24em;
  text-align: center;

  font-size: 17px;
  font-weight: 900;
}

body[data-chat-mode="catering"]
.chat-send {
  min-width: 68px;
}

/* =========================================================
   CHATBODY SCROLLBAR
========================================================= */

body[data-chat-mode="catering"]
.chat-body {
  scrollbar-width: thin;

  scrollbar-color:
    var(--border)
    transparent;
}

body[data-chat-mode="catering"]
.chat-body::-webkit-scrollbar {
  width: 8px;
}

body[data-chat-mode="catering"]
.chat-body::-webkit-scrollbar-track {
  background: transparent;
}

body[data-chat-mode="catering"]
.chat-body::-webkit-scrollbar-thumb {
  border:
    2px solid transparent;

  border-radius:
    var(--radius-pill);

  background:
    var(--border);

  background-clip:
    padding-box;
}

/* =========================================================
   RESERVATION STARTER FORM
========================================================= */

body[data-chat-mode="catering"]
.reservation-form-card
.section-description {
  margin-bottom: 22px;

  font-size: 14px;
}

body[data-chat-mode="catering"]
.reservation-information
.primary-button {
  margin-top: 26px;
}

body[data-chat-mode="catering"]
.conditional-fields {
  display: none;
}

body[data-chat-mode="catering"]
.conditional-fields.active {
  display: grid;
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 850px) {
  body[data-chat-mode="catering"]
  .chat-panel {
    width:
      min(
        460px,
        calc(100vw - 28px)
      );
  }
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 680px) {
  body[data-chat-mode="catering"]
  .chat-panel {
    right: 10px;
    bottom: 78px;

    width:
      calc(100vw - 20px);

    height:
      min(
        650px,
        calc(100vh - 98px)
      );

    border-radius: 20px;
  }

  body[data-chat-mode="catering"]
  .chat-body {
    padding: 14px;
  }

  .chat-package-card,
  .chat-summary-card {
    padding: 14px;
  }

  .chat-summary-row {
    grid-template-columns:
      1fr;

    gap: 4px;
  }

  .chat-summary-row strong {
    text-align: left;
  }

  .chat-summary-actions {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 420px) {
  body[data-chat-mode="catering"]
  .chat-options {
    grid-template-columns: 1fr;
  }

  body[data-chat-mode="catering"]
  .chat-form {
    grid-template-columns:
      minmax(0, 1fr)
      auto;
  }

  body[data-chat-mode="catering"]
  .chat-send {
    width: auto;
    min-width: 64px;
  }

  .chat-package-price {
    font-size: 21px;
  }
}

/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {
  .chat-message.loading::after {
    animation: none;
  }

  .chat-package-card,
  .chat-package-select,
  .chat-action-primary,
  .chat-action-secondary {
    transition: none;
  }
}

.chat-package-preference-summary {
  margin: 0;
  padding: 9px 11px;
  color: #146c43;
  background: #eefaf3;
  border: 1px solid #bfe8cf;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.4;
}

.chat-package-preferred-badge {
  display: inline-flex;
  margin-left: 7px;
  padding: 2px 6px;
  color: var(--primary-red);
  background: var(--light-red);
  border-radius: var(--radius-pill);
  font-size: 9px;
  font-weight: 900;
  line-height: 1.5;
  text-transform: uppercase;
}
