/* ==========================================================================
   Digital Maheshwari — sitewide "Enquire Now" button + popup
   Loaded globally from components/header.php. Shared tokens only.
   ========================================================================== */

/* ---- Floating trigger ----
   Desktop: a vertical tab on the right edge, mid-screen — well above the
   WhatsApp/Call buttons (bottom-right), so the two never meet. */
.enq-trigger {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: var(--dm-z-overlay);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 18px 12px;
  writing-mode: vertical-rl;
  transform: translateY(-50%) rotate(180deg);
  background: var(--dm-ink);
  color: var(--dm-text-inverse);
  border: 0;
  border-radius: 0 var(--dm-radius-sm) var(--dm-radius-sm) 0; /* rotated: visually the left corners */
  box-shadow: -6px 10px 30px rgba(12, 18, 32, 0.22);
  font: 700 0.8rem/1 var(--dm-font-body, inherit);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: padding var(--dm-duration) var(--dm-ease), background var(--dm-duration) var(--dm-ease);
}
.enq-trigger::before { content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 3px; background: var(--dm-gold); }
.enq-trigger svg { width: 16px; height: 16px; transform: rotate(90deg); color: var(--dm-gold-light); flex-shrink: 0; }
.enq-trigger:hover { padding-left: 16px; background: #141c2e; }
.enq-trigger:focus-visible { outline: 2px solid var(--dm-gold); outline-offset: 3px; }
.enq-trigger__short { display: none; }
.enq-open .enq-trigger { visibility: hidden; }

/* ---- Modal shell ---- */
.enq[hidden] { display: none; }
.enq { position: fixed; inset: 0; z-index: var(--dm-z-toast); display: grid; place-items: center; padding: 24px; }
.enq__overlay { position: absolute; inset: 0; background: rgba(12, 18, 32, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity 240ms var(--dm-ease); }
.enq__dialog {
  position: relative;
  width: min(940px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  background: var(--dm-surface);
  border-radius: var(--dm-radius);
  box-shadow: 0 30px 80px rgba(12, 18, 32, 0.35);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  transition: opacity 240ms var(--dm-ease), transform 260ms var(--dm-ease);
}
.enq.is-open .enq__overlay { opacity: 1; }
.enq.is-open .enq__dialog { opacity: 1; transform: none; }
html.enq-open, html.enq-open body { overflow: hidden; }

.enq__close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--dm-ink); cursor: pointer; transition: background var(--dm-duration-fast) var(--dm-ease); }
.enq__close svg { width: 20px; height: 20px; }
.enq__close:hover { background: var(--dm-surface-alt); }
.enq__close:focus-visible { outline: 2px solid var(--dm-gold); outline-offset: 2px; }

/* ---- Brand side ---- */
.enq__brand { background: var(--dm-ink); color: rgba(248, 248, 251, 0.78); padding: 40px 34px; display: flex; flex-direction: column; gap: 14px; border-right: 3px solid var(--dm-gold); }
.enq__brand img { width: 56px; height: 56px; border-radius: 50%; background: #fff; padding: 3px; border: 2px solid var(--dm-gold); }
.enq__brand h2 { color: var(--dm-text-inverse); font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); line-height: 1.15; margin: 8px 0 0; }
.enq__brand p { margin: 0; font-size: var(--dm-body-sm); line-height: 1.65; }
.enq__facts { margin: auto 0 0; padding-top: 22px; border-top: 1px solid rgba(248, 248, 251, 0.16); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.enq__facts div { display: flex; flex-direction: column-reverse; gap: 2px; }
.enq__facts dd { margin: 0; font-family: var(--dm-font-display); font-size: 2rem; font-weight: 600; line-height: 1; color: var(--dm-gold-light); }
.enq__facts dt { font-size: var(--dm-caption); color: rgba(248, 248, 251, 0.7); }
.enq__areas { font-size: var(--dm-caption) !important; font-weight: 600; color: rgba(248, 248, 251, 0.6); }

/* ---- Form side ---- */
.enq__body { padding: 36px 34px 28px; overflow-y: auto; overscroll-behavior: contain; }
.enq__alert { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--dm-radius-sm); background: #f6e6e6; color: var(--dm-error); border: 1px solid #e5bcbc; font-size: var(--dm-body-sm); font-weight: 600; }
.enq__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; padding-right: 30px; }
.enq-f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.enq-f--full { grid-column: 1 / -1; }
.enq-f label { font-size: 0.82rem; font-weight: 600; color: var(--dm-ink); }
.enq-f__req { color: var(--dm-oxblood); }
.enq-f__opt { font-weight: 500; font-size: var(--dm-caption); color: var(--dm-text-muted); margin-left: 3px; }
.enq-f input, .enq-f select, .enq-f textarea {
  width: 100%; min-height: 46px; padding: 0.65rem 0.85rem;
  border: 1px solid var(--dm-border-strong); border-radius: var(--dm-radius-sm);
  background: var(--dm-bg, #fff); font: inherit; font-size: 1rem; color: var(--dm-ink);
  transition: border-color var(--dm-duration-fast) var(--dm-ease), box-shadow var(--dm-duration-fast) var(--dm-ease);
}
.enq-f textarea { min-height: 80px; resize: vertical; line-height: 1.55; }
.enq-f input::placeholder, .enq-f textarea::placeholder { color: var(--dm-text-muted); opacity: 0.7; }
.enq-f input:hover, .enq-f select:hover, .enq-f textarea:hover { border-color: var(--dm-ink); }
.enq-f input:focus, .enq-f select:focus, .enq-f textarea:focus { outline: none; border-color: var(--dm-gold-dark); box-shadow: 0 0 0 3px rgba(198, 149, 47, 0.2); }
.enq-f select { appearance: none; -webkit-appearance: none; padding-right: 2.3rem; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230c1220' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.8rem center; background-size: 15px; }
.enq-f__err { display: none; color: var(--dm-error); font-size: var(--dm-caption); font-weight: 600; }
.enq-f.has-error input, .enq-f.has-error select, .enq-f.has-error textarea { border-color: var(--dm-error); }
.enq-f.has-error .enq-f__err { display: block; }

.enq__foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--dm-border); }
.enq__submit { position: relative; overflow: hidden; min-height: 50px; padding-inline: 1.8rem; }
.enq__submit svg { width: 16px; height: 16px; transition: transform var(--dm-duration) var(--dm-ease); }
.enq__submit::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--dm-gold); transform: scaleX(0); transform-origin: left; transition: transform var(--dm-duration) var(--dm-ease); }
.enq__submit:hover svg, .enq__submit:focus-visible svg { transform: translateX(4px); }
.enq__submit:hover::after, .enq__submit:focus-visible::after { transform: scaleX(1); }
.enq__submit[disabled] { opacity: 0.7; cursor: progress; }
.enq__wa { margin: 0; font-size: var(--dm-body-sm); color: var(--dm-text-muted); }
.enq__wa a { color: var(--dm-ink); font-weight: 700; border-bottom: 1px solid var(--dm-border-strong); }
.enq__wa a:hover { color: var(--dm-gold-dark); border-color: var(--dm-gold); }

/* Success */
.enq__done { padding: 40px 10px; text-align: center; outline: none; }
.enq__done-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--dm-ink); color: var(--dm-gold-light); margin-bottom: 18px; }
.enq__done-icon svg { width: 28px; height: 28px; }
.enq__done h3 { font-size: 2rem; margin-bottom: 10px; }
.enq__done p { max-width: 36ch; margin: 0 auto 24px; color: var(--dm-text-muted); }
.enq__done-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* ---- Tablet / mobile ---- */
@media (max-width: 860px) {
  .enq__dialog { grid-template-columns: minmax(0, 1fr); width: min(560px, 100%); overflow-y: auto; overscroll-behavior: contain; }
  .enq__body { overflow: visible; }
  .enq__brand { border-right: 0; border-bottom: 3px solid var(--dm-gold); padding: 26px 24px 22px; gap: 10px; }
  .enq__brand img { width: 44px; height: 44px; }
  .enq__brand p { display: none; }
  .enq__facts { margin-top: 6px; padding-top: 14px; }
  .enq__facts dd { font-size: 1.6rem; }
  .enq__close { color: var(--dm-text-inverse); }
  .enq__close:hover { background: rgba(248, 248, 251, 0.12); }
  .enq__grid { padding-right: 0; }
}
@media (max-width: 640px) {
  /* Compact pill above the WhatsApp/Call buttons */
  .enq-trigger {
    top: auto;
    bottom: calc(var(--dm-space-5) + 56px * 2 + var(--dm-space-3) * 2);
    right: var(--dm-space-5);
    writing-mode: horizontal-tb;
    transform: none;
    padding: 0 16px;
    min-height: 44px;
    border-radius: var(--dm-radius-full);
    letter-spacing: 0.04em;
    font-size: 0.82rem;
    box-shadow: var(--dm-shadow-lg);
  }
  .enq-trigger::before { display: none; }
  .enq-trigger svg { transform: none; }
  .enq-trigger:hover { padding-left: 16px; }
  .enq-trigger__full { display: none; }
  .enq-trigger__short { display: inline; }
  .enq { padding: 12px; align-items: center; }
  .enq__dialog { width: 94vw; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .enq__body { padding: 22px 18px 20px; }
  .enq__grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .enq-f input, .enq-f select { min-height: 50px; }
  .enq__foot { flex-direction: column; align-items: stretch; text-align: center; }
  .enq__submit { width: 100%; justify-content: center; min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  .enq__overlay, .enq__dialog { transition: none; }
}
.enq__brand p { color: rgba(248, 248, 251, 0.78); }
.enq__brand .enq__areas { color: rgba(248, 248, 251, 0.6); }
.enq__facts div { flex-direction: column; }
@media (max-width: 640px) { .enq-trigger { bottom: calc(var(--dm-space-5) + 56px * 2 + var(--dm-space-3) + 20px); } }
.enq__package { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--dm-gold); background: var(--dm-surface-alt); border-radius: 0 var(--dm-radius-sm) var(--dm-radius-sm) 0; font-size: var(--dm-body-sm); color: var(--dm-text); }
.enq__package strong { color: var(--dm-ink); }
