/* Call Me Back FAB v1.1 – cmb.css | by Comunicaalcalá */

/* Variables inyectadas desde PHP:
   --cmb-brand, --cmb-brand-dark, --cmb-brand-light, --cmb-brand-rgba, --cmb-brand-ring */
:root {
  --cmb-ink:     #111827;
  --cmb-muted:   #6B7280;
  --cmb-surface: #FFFFFF;
  --cmb-bg:      #F9FAFB;
  --cmb-border:  #E5E7EB;
  --cmb-error:   #DC2626;
  --cmb-ease:    cubic-bezier(0.16, 1, 0.3, 1);
  
}

/* ── Backdrop ── */
.cmb-backdrop {
  display: none;
  position: fixed; inset: 0;
  z-index: 2147483644;
  background: rgba(0,0,0,0);
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  transition: background .3s ease, backdrop-filter .3s ease;
}
.cmb-backdrop.cmb-visible {
  display: block;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* ── FAB base ── */
.cmb-fab {
  position: fixed;
  z-index: 2147483646;
  border: none;
  cursor: pointer;
  background: var(--cmb-brand);
  color: #fff;
  font-family: inherit;
  display: -webkit-inline-flex;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px var(--cmb-brand-rgba), 0 1px 6px rgba(0,0,0,.12);
  transition: background .2s ease, transform .2s var(--cmb-ease),
              box-shadow .2s ease, opacity .3s ease;
  overflow: hidden;
}
.cmb-fab:hover {
  background: var(--cmb-brand-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px var(--cmb-brand-rgba), 0 2px 8px rgba(0,0,0,.15);
}
.cmb-fab:active { transform: scale(.97); }
.cmb-fab.cmb-hidden { opacity: 0; pointer-events: none; }

/* FAB expandido (pill con texto) */
.cmb-fab--expanded {
  height: 48px;
  padding: 0 20px 0 16px;
  border-radius: 24px;
}
.cmb-fab--expanded .cmb-fab-icon {
  display: flex; align-items: center; flex-shrink: 0;
}
.cmb-fab--expanded .cmb-fab-label {
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}

/* FAB compacto (círculo, solo icono) */
.cmb-fab--compact {
  width: 56px; height: 56px;
  border-radius: 50%;
  padding: 0;
  justify-content: center;
}
.cmb-fab--compact .cmb-fab-icon {
  display: flex; align-items: center; justify-content: center;
}
.cmb-fab--compact .cmb-fab-label { display: none; }

/* pulse ring – solo en compacto */
.cmb-fab--compact::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid var(--cmb-brand);
  opacity: 0;
  animation: cmb-pulse 3s ease-out infinite;
}
@keyframes cmb-pulse {
  0%  { transform: scale(1);    opacity: .5; }
  70% { transform: scale(1.6);  opacity: 0;  }
  100%{ transform: scale(1.6);  opacity: 0;  }
}

/* ── Panel ── */
.cmb-panel {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 2147483645;
  background: var(--cmb-surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -2px 24px rgba(0,0,0,.10), 0 0 0 1px var(--cmb-border);
  display: flex; flex-direction: column;
  max-height: 90vh;
  transform: translateY(100%);
  transition: transform .45s var(--cmb-ease);
  padding-bottom: env(safe-area-inset-bottom, 0);
  font-family: inherit;
}
.cmb-panel.cmb-open { transform: translateY(0); }

@media (min-width: 600px) {
  .cmb-panel {
    left: auto; right: auto;
    width: 360px;
    border-radius: 16px;
    max-height: calc(100vh - 80px);
    transform: translateY(16px) scale(.98);
    opacity: 0;
    transition: transform .4s var(--cmb-ease), opacity .3s ease;
  }
  .cmb-panel.cmb-open { transform: translateY(0) scale(1); opacity: 1; }
}

/* drag handle */
.cmb-handle {
  width: 36px; height: 4px;
  background: var(--cmb-border);
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}
@media (min-width:600px) { .cmb-handle { display: none; } }

/* header */
.cmb-header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 18px 16px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--cmb-border);
}
.cmb-header-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--cmb-brand-light);
  color: var(--cmb-brand);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cmb-header-text { flex: 1; min-width: 0; }
.cmb-title {
  font-size: 1rem; font-weight: 600;
  color: var(--cmb-ink); line-height: 1.3;
  letter-spacing: -.01em;
}
.cmb-subtitle {
  font-size: .75rem; color: var(--cmb-muted);
  font-weight: 400; margin-top: 1px; line-height: 1.4;
}
.cmb-close {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--cmb-border);
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--cmb-muted); flex-shrink: 0;
  transition: background .15s, color .15s;
}
.cmb-close:hover { background: var(--cmb-bg); color: var(--cmb-ink); }

/* body scroll */
.cmb-body { overflow-y: auto; padding: 18px; flex: 1; scrollbar-width: thin; }

/* fields */
.cmb-field { margin-bottom: 13px; }
.cmb-field label {
  display: block;
  font-size: .75rem; font-weight: 600;
  color: var(--cmb-ink); margin-bottom: 5px;
  letter-spacing: .01em;
}
.cmb-req { color: var(--cmb-brand); margin-left: 1px; }
.cmb-opt { color: var(--cmb-muted); font-weight: 400; }

.cmb-field input[type="text"],
.cmb-field input[type="tel"],
.cmb-field select,
.cmb-field textarea {
  width: 100%; box-sizing: border-box;
  padding: 9px 12px;
  border: 1.5px solid var(--cmb-border);
  border-radius: 8px;
  background: var(--cmb-bg);
  font-family: inherit;
  font-size: .875rem; color: var(--cmb-ink);
  outline: none; appearance: none; -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  line-height: 1.5;
}
.cmb-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.cmb-field textarea { resize: vertical; min-height: 68px; line-height: 1.5; }
.cmb-field input:focus,
.cmb-field select:focus,
.cmb-field textarea:focus {
  border-color: var(--cmb-brand);
  box-shadow: 0 0 0 3px var(--cmb-brand-ring);
  background: #fff;
}
.cmb-field input.cmb-invalid,
.cmb-field select.cmb-invalid,
.cmb-field textarea.cmb-invalid {
  border-color: var(--cmb-error);
  box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}

/* privacy */
.cmb-privacy {
  display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 14px; cursor: pointer;
  font-size: .75rem; color: var(--cmb-muted); line-height: 1.5;
  font-family: inherit;
}
.cmb-privacy input[type="checkbox"] {
  margin-top: 1px; flex-shrink: 0;
  accent-color: var(--cmb-brand);
  width: 14px; height: 14px; cursor: pointer;
}
.cmb-privacy a { color: var(--cmb-brand); text-decoration: none; }
.cmb-privacy a:hover { text-decoration: underline; }

/* error */
.cmb-error {
  font-family: inherit;
  font-size: .78rem; color: var(--cmb-error);
  background: rgba(220,38,38,.05);
  border: 1px solid rgba(220,38,38,.18);
  border-radius: 7px;
  padding: 8px 11px;
  margin-bottom: 12px;
  display: none;
  line-height: 1.5;
}
.cmb-error.cmb-show { display: block; }

/* submit */
.cmb-submit {
  width: 100%; padding: 11px 16px;
  border-radius: 10px; border: none;
  background: var(--cmb-brand); color: #fff;
  font-family: inherit;
  font-size: .875rem; font-weight: 600;
  cursor: pointer; letter-spacing: .01em;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, transform .15s;
  box-sizing: border-box;
}
.cmb-submit:hover { background: var(--cmb-brand-dark); transform: translateY(-1px); }
.cmb-submit:active { transform: scale(.98); }
.cmb-submit:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.cmb-spinner { animation: cmb-spin .7s linear infinite; }
@keyframes cmb-spin { to { transform: rotate(360deg); } }

/* success */
.cmb-success { text-align: center; padding: 28px 12px 8px; }
.cmb-success-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--cmb-brand-light);
  color: var(--cmb-brand);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.cmb-success-msg {
  font-size: .95rem; font-weight: 500;
  color: var(--cmb-ink); line-height: 1.5;
  margin: 0 0 18px;
  font-family: inherit;
}
.cmb-success-close {
  padding: 8px 22px; border-radius: 8px;
  border: 1.5px solid var(--cmb-border);
  background: transparent; cursor: pointer;
  font-family: inherit;
  font-size: .825rem; color: var(--cmb-muted);
  transition: background .15s, color .15s;
}
.cmb-success-close:hover { background: var(--cmb-bg); color: var(--cmb-ink); }
