/* ═══════════════════════════════════════════
   Callback Widget v2 — Frontend Styles
═══════════════════════════════════════════ */
:root {
  --cbw-color:  #89328b;
  --cbw-radius: 16px;
  --cbw-shadow: 0 8px 40px rgba(0,0,0,.22);
  --cbw-font:   'Segoe UI', system-ui, sans-serif;
}

/* ── Shared reset ── */
#cbw-trigger, #cbw-panel, #cbw-overlay,
#cbw-panel * { box-sizing: border-box; }

/* ════════════════════════════════════════
   TRIGGER – CIRCLE (default)
════════════════════════════════════════ */
#cbw-trigger {
  position: fixed;
  z-index: 99998;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cbw-color);
  color: #fff;
  transition: transform .2s, box-shadow .2s;
  font-family: var(--cbw-font);
  line-height: 1;
}

/* circle */
#cbw-trigger.cbw-style-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  box-shadow: 0 4px 24px rgba(0,0,0,.28);
  font-size: 0; /* icon only */
}
#cbw-trigger.cbw-style-circle .cbw-trigger-icon { font-size: 26px; }
#cbw-trigger.cbw-style-circle .cbw-trigger-text { display: none; }

#cbw-trigger.cbw-style-circle:hover {
  transform: scale(1.12);
  box-shadow: 0 8px 32px rgba(0,0,0,.32);
}

/* tab */
#cbw-trigger.cbw-style-tab {
  width: auto;
  height: auto;
  padding: 16px 10px;
  border-radius: 0;
  box-shadow: 2px 2px 12px rgba(0,0,0,.2);
  flex-direction: column;
  align-items: center;
  gap: 8px;
  writing-mode: horizontal-tb;
}
#cbw-trigger.cbw-style-tab.cbw-side-right { border-radius: 8px 0 0 8px; }
#cbw-trigger.cbw-style-tab.cbw-side-left  { border-radius: 0 8px 8px 0; }
#cbw-trigger.cbw-style-tab .cbw-phone-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
#cbw-trigger.cbw-style-tab .cbw-trigger-text {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}
#cbw-trigger.cbw-style-tab.cbw-side-left .cbw-trigger-text {
  transform: rotate(180deg);
}
#cbw-trigger.cbw-style-tab:hover { filter: brightness(1.1); }

/* rectangle */
#cbw-trigger.cbw-style-rectangle {
  width: auto;
  min-width: 48px;
  height: auto;
  padding: 20px 14px;
  border-radius: 0;
  box-shadow: 3px 0 20px rgba(0,0,0,.2);
  flex-direction: column;
  gap: 10px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}
#cbw-trigger.cbw-style-rectangle.cbw-side-right { border-radius: 12px 0 0 12px; }
#cbw-trigger.cbw-style-rectangle.cbw-side-left  { border-radius: 0 12px 12px 0; }
#cbw-trigger.cbw-style-rectangle .cbw-trigger-icon {
  font-size: 24px;
  writing-mode: horizontal-tb;
}
#cbw-trigger.cbw-style-rectangle .cbw-trigger-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
  text-transform: uppercase;
}
#cbw-trigger.cbw-style-rectangle:hover { filter: brightness(1.08); }

/* side-left flip for rectangle text readability (tab is now horizontal, no flip needed) */
#cbw-trigger.cbw-style-rectangle.cbw-side-left .cbw-trigger-text {
  transform: rotate(180deg);
}

/* ════════════════════════════════════════
   OVERLAY + PANEL
════════════════════════════════════════ */
#cbw-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
  z-index: 99999;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 28px;
}
#cbw-overlay.cbw-open { display: flex; animation: cbwFadeIn .2s ease; }
@keyframes cbwFadeIn { from{opacity:0} to{opacity:1} }

/* panel positions */
#cbw-overlay.cbw-panel-left   { justify-content: flex-start; }
#cbw-overlay.cbw-panel-right  { justify-content: flex-end;   }
#cbw-overlay.cbw-panel-top    { align-items: flex-start; }
#cbw-overlay.cbw-panel-middle { align-items: center; }
#cbw-overlay.cbw-panel-bottom { align-items: flex-end; }

#cbw-panel {
  background: #fff;
  border-radius: var(--cbw-radius);
  box-shadow: var(--cbw-shadow);
  width: 100%;
  max-width: 360px;
  overflow: hidden;
  font-family: var(--cbw-font);
  animation: cbwSlideUp .25s cubic-bezier(.22,1,.36,1);
  transform-origin: bottom right;
}
#cbw-overlay.cbw-panel-left #cbw-panel   { transform-origin: bottom left; }
#cbw-overlay.cbw-panel-top  #cbw-panel   { transform-origin: top right;   animation-name: cbwSlideDown; }

@keyframes cbwSlideUp   { from{transform:translateY(24px) scale(.96);opacity:0} to{transform:none;opacity:1} }
@keyframes cbwSlideDown { from{transform:translateY(-24px) scale(.96);opacity:0} to{transform:none;opacity:1} }

/* ── Header ── */
.cbw-header {
  background: var(--cbw-color);
  color: #fff;
  padding: 18px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.cbw-header-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.cbw-header h3 { margin:0 0 2px; font-size:15px; font-weight:700; color:#fff; line-height:1.2; }
.cbw-header p  { margin:0; font-size:12px; opacity:.85; }
.cbw-close {
  margin-left: auto; background: none; border: none; color: #fff;
  cursor: pointer; font-size: 20px; opacity: .8; padding: 0 0 0 8px; flex-shrink: 0;
}
.cbw-close:hover { opacity:1; }

/* ── Body ── */
.cbw-body { padding: 20px; }
.cbw-field { margin-bottom: 14px; }
.cbw-field label {
  display: block; font-size: 12px; font-weight: 600;
  color: #374151; margin-bottom: 5px;
  letter-spacing: .3px; text-transform: uppercase;
}
.cbw-field input, .cbw-field textarea {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid #e5e7eb; border-radius: 8px;
  font-size: 14px; font-family: var(--cbw-font);
  transition: border-color .15s, box-shadow .15s;
  outline: none; color: #111; background: #f9fafb;
}
.cbw-field input:focus, .cbw-field textarea:focus {
  border-color: var(--cbw-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cbw-color) 18%, transparent);
  background: #fff;
}
.cbw-field textarea { resize: vertical; min-height: 72px; }
.cbw-or { text-align:center; font-size:11px; color:#9ca3af; margin:-4px 0 4px; letter-spacing:.5px; }

/* ── Submit ── */
#cbw-submit {
  width: 100%; padding: 12px;
  background: var(--cbw-color); color: #fff;
  border: none; border-radius: 9px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  font-family: var(--cbw-font);
  transition: opacity .15s, transform .15s; margin-top: 4px;
}
#cbw-submit:hover  { opacity: .88; }
#cbw-submit:active { transform: scale(.98); }
#cbw-submit:disabled { opacity: .6; cursor: not-allowed; }

/* ── Messages ── */
#cbw-error {
  background:#fef2f2; color:#b91c1c; border:1px solid #fecaca;
  border-radius:8px; padding:10px 12px; font-size:13px;
  margin-bottom:12px; display:none;
}
#cbw-success {
  text-align:center; padding:24px 20px 28px; display:none;
}
#cbw-success .cbw-check { font-size:52px; line-height:1; margin-bottom:12px; }
#cbw-success h4 { margin:0 0 6px; font-size:17px; color:#111; }
#cbw-success p  { margin:0; font-size:13px; color:#6b7280; }

/* ── Footer ── */
.cbw-footer {
  border-top:1px solid #f3f4f6; padding:10px 20px;
  font-size:11px; color:#9ca3af; text-align:center;
}

/* ── Phone SVG icon (always white) ── */
.cbw-phone-svg { display:block; width:26px; height:26px; fill:#fff; flex-shrink:0; }
.cbw-style-tab .cbw-phone-svg,
.cbw-style-rectangle .cbw-phone-svg { width:22px; height:22px; }

/* ── Mobile ── */
@media (max-width:480px) {
  /* Panel slides up full-width from bottom */
  #cbw-overlay { padding:0; align-items:flex-end; justify-content:stretch; }
  #cbw-panel { max-width:100%; border-radius:var(--cbw-radius) var(--cbw-radius) 0 0; }

  /* Circle → shrink a bit */
  #cbw-trigger.cbw-style-circle {
    width: 50px;
    height: 50px;
  }
  #cbw-trigger.cbw-style-circle .cbw-phone-svg {
    width: 22px;
    height: 22px;
  }

  /* Tab & Rectangle → tiny sliver, icon only, no text, fixed 50px tall */
  #cbw-trigger.cbw-style-tab,
  #cbw-trigger.cbw-style-rectangle {
    padding: 0 5px;
    min-width: 0;
    width: 24px;
    height: 50px;
  }
  #cbw-trigger.cbw-style-tab .cbw-phone-svg,
  #cbw-trigger.cbw-style-rectangle .cbw-phone-svg {
    width: 14px;
    height: 14px;
  }
  #cbw-trigger.cbw-style-tab .cbw-trigger-text,
  #cbw-trigger.cbw-style-rectangle .cbw-trigger-text {
    display: none;
  }

  /* Rounded corners stay correct per side on mobile */
  #cbw-trigger.cbw-style-rectangle.cbw-side-right { border-radius: 8px 0 0 8px; }
  #cbw-trigger.cbw-style-rectangle.cbw-side-left  { border-radius: 0 8px 8px 0; }
  #cbw-trigger.cbw-style-tab.cbw-side-right       { border-radius: 6px 0 0 6px; }
  #cbw-trigger.cbw-style-tab.cbw-side-left        { border-radius: 0 6px 6px 0; }
}
