/* TG Consultant Button (UA) — layout v1.6.0 */

/* Base tokens */
:root{
  --tgcb-primary:#0a64c2;
  --tgcb-primary-2:#0b5aa9;
  --tgcb-border:#D6DCE3;
  --tgcb-title:#0a2239;
  --tgcb-bg:#ffffff;
  --tgcb-safe-bottom: env(safe-area-inset-bottom, 0px);
  --tgcb-safe-top: env(safe-area-inset-top, 0px);
}

html{ -webkit-text-size-adjust:100%; }

/* Floating fab button */
.tgcb-fab{
  position:fixed;
  bottom:24px;
  right:max(16px, env(safe-area-inset-right));
  z-index:9998;
  padding:12px 24px;
  border-radius:999px;
  background:linear-gradient(135deg,#0a64c2,#0b5aa9);
  color:#fff;
  font-weight:800;
  font-size:16px;
  border:none;
  display:flex !important;
  align-items:center;
  justify-content:center;
  gap:8px;
  cursor:pointer;
  box-shadow:0 10px 26px rgba(0,0,0,.22);
  text-decoration:none;
  line-height:1.2;
}
.tgcb-pos-left{
  left:max(16px, env(safe-area-inset-left));
  right:auto;
}
.tgcb-fab span{ display:inline-block; }

/* Inline button */
.tgcb-inline-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:12px 24px;
  border-radius:999px;
  border:none;
  background:linear-gradient(135deg,#0a64c2,#0b5aa9);
  color:#fff;
  font-weight:700;
  font-size:16px;
  cursor:pointer;
  text-decoration:none;
  line-height:1.2;
}

/* Modal root */
.tgcb-modal{
  position:fixed;
  inset:0;
  z-index:10000;
  display:none;
}
.tgcb-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.45);
}
.tgcb-modal-inner{
  position:relative;
  width:100%;
  height:100%;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  overflow:auto;
  padding:16px 8px;
  box-sizing:border-box;
}

/* Card desktop / tablet */
.tgcb-modal-card{
  position:relative;
  max-width:720px;
  width:calc(100% - 24px);
  margin:6vh auto;
  background:var(--tgcb-bg);
  border-radius:18px;
  padding:18px 20px 0;
  border:1px solid rgba(10,100,194,.08);
  box-shadow:0 22px 42px rgba(0,0,0,.30);
  max-height:calc(100vh - 12vh);
  display:flex;
  flex-direction:column;
}

.tgcb-title{
  margin:0 0 8px;
  font-family:ui-serif,Georgia,"Times New Roman",serif;
  font-size:36px;
  letter-spacing:-0.3px;
  font-weight:900;
  color:var(--tgcb-title);
}
.tgcb-desc{
  margin:0 0 14px;
  font-size:18px;
  color:#354A5F;
}

/* Scrollable fields area */
.tgcb-fields{
  flex:1 1 auto;
  overflow-y:auto;
  padding:6px 4px 12px;
  -webkit-overflow-scrolling:touch;
}

/* Footer & submit */
.tgcb-footer{
  flex:0 0 auto;
  margin-top:8px;
  padding:12px 0 18px;
  border-top:1px solid var(--tgcb-border);
  background:#fff;
}

.tgcb-submit{
  width:100%;
  padding:14px 18px;
  border:0;
  border-radius:999px;
  background:linear-gradient(135deg,#0a64c2,#0b5aa9);
  color:#fff;
  font-weight:800;
  font-size:18px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:1.2;
}
.tgcb-submit span{ display:inline-block; }
.tgcb-submit:hover{
  background:var(--tgcb-primary-2);
}
.tgcb-submit:disabled{
  opacity:.8;
  cursor:default;
}

.tgcb-spinner{
  display:none;
  margin-left:8px;
  width:18px;
  height:18px;
  border-radius:50%;
  border:2px solid rgba(255,255,255,.6);
  border-top-color:#fff;
  animation:tgcb-spin .8s linear infinite;
}
.tgcb-submit.is-sending .tgcb-spinner{
  display:inline-block;
}
@keyframes tgcb-spin{ to{ transform:rotate(360deg);} }

/* Labels & inputs */
.tgcb-modal-card label{
  display:block;
  font-weight:700;
  margin-top:14px;
  font-size:16px;
}
.tgcb-modal-card input{
  width:100%;
  margin-top:8px;
  padding:11px 12px;
  border:1px solid var(--tgcb-border);
  border-radius:12px;
  font-size:16px;
  outline:none;
  box-sizing:border-box;
}
.tgcb-modal-card input:focus{
  border-color:var(--tgcb-primary);
  box-shadow:0 0 0 3px rgba(10,100,194,.12);
}

/* Car field wrap + suggestions */
.tgcb-car-wrap{ position:relative; }
.tgcb-car-wrap input{ width:100%; }
.tgcb-suggest{
  display:none;
  position:absolute;
  z-index:10001;
  max-height:260px;
  overflow:auto;
  background:#fff;
  border-radius:10px;
  margin-top:0;
  border:1px solid var(--tgcb-border);
  box-shadow:0 8px 24px rgba(0,0,0,.12);
  min-width:100%;
}
.tgcb-s-item{
  padding:10px 12px;
  cursor:pointer;
  font-size:15px;
}
.tgcb-s-item:hover,
.tgcb-s-item:focus{
  background:#F4F7FB;
  outline:none;
}

/* Checkbox group */
.tgcb-types{
  margin-top:16px;
  border:1px dashed #E2E8F0;
  padding:14px 16px 10px;
  border-radius:14px;
  display:flex;
  flex-wrap:wrap;
  column-gap:24px;
  row-gap:10px;
  align-items:flex-start;
}
.tgcb-types legend{
  font-weight:900;
  font-size:22px;
  margin-bottom:8px;
}
.tgcb-check{
  display:flex;
  align-items:flex-start;
  gap:8px;
  font-weight:700;
  font-size:14px;
  line-height:1.3;
  flex:1 1 calc(33.333% - 24px);
  min-width:140px;
  max-width:260px;
}
.tgcb-check input{
  -webkit-appearance:none;
  appearance:none;
  width:20px;
  height:20px;
  border-radius:6px;
  border:2px solid #c8d1dc;
  background:#fff;
  margin-top:1px;
  flex:0 0 20px;
  position:relative;
}
.tgcb-check input:focus{
  outline:none;
  box-shadow:0 0 0 3px rgba(10,100,194,.18);
}
.tgcb-check input:checked{
  background:#0a64c2;
  border-color:#0a64c2;
}
.tgcb-check input:checked::after{
  content:"";
  position:absolute;
  left:5px;
  top:2px;
  width:6px;
  height:12px;
  border:3px solid #fff;
  border-top:0;
  border-left:0;
  transform:rotate(45deg);
}
.tgcb-check span{
  display:block;
  white-space:normal;
  word-wrap:break-word;
}

/* Status & success */
.tgcb-status{
  margin-top:10px;
  font-size:14px;
  min-height:18px;
  color:#c2410c;
}
.tgcb-success{
  display:none;
  text-align:center;
  margin:16px 4px 4px;
}
.tgcb-success--show{ display:block; }
.tgcb-checkmark svg{
  width:64px;
  height:64px;
  stroke:#16a34a;
}

/* Toast */
.tgcb-toast{
  position:absolute;
  top:10px;
  right:10px;
  background:#0a64c2;
  color:#fff;
  padding:8px 12px;
  border-radius:999px;
  font-size:13px;
  box-shadow:0 12px 30px rgba(0,0,0,.2);
  opacity:0;
  transform:translateY(-6px);
  transition:.25s;
}
.tgcb-toast.show{
  opacity:1;
  transform:translateY(0);
}

/* Close button */
.tgcb-close{
  position:absolute;
  top:10px;
  right:10px;
  border:0;
  background:#EEF2F7;
  color:#1f2937;
  border-radius:999px;
  padding:6px 10px;
  cursor:pointer;
  font-weight:700;
  font-size:13px;
}

/* MOBILE LAYOUT v3 (more compact, inline checkbox labels) */
@media (max-width:480px){

  .tgcb-fab{
    left:50% !important;
    right:auto !important;
    transform:translateX(-50%);
    bottom:18px;
    font-size:14px;
    padding:10px 18px;
    text-align:center;
  }

  .tgcb-modal-inner{
    padding:0;
    align-items:flex-start;
    justify-content:center;
  }

  /* Карточка компактнее по высоте и ширине */
  .tgcb-modal-card{
    max-width:94%;
    width:calc(100% - 24px);
    margin:32px auto 12px;
    border-radius:18px;
    padding:8px 10px 0;
    box-shadow:0 16px 32px rgba(0,0,0,.35);
    height:auto;
    max-height:calc(100vh - 140px);
    display:flex;
    flex-direction:column;
    overflow-y:auto;
  }

  .tgcb-title{
    font-size:24px;
    margin-bottom:2px;
  }
  .tgcb-desc{
    font-size:13px;
    margin-bottom:6px;
  }

  .tgcb-fields{
    flex:0 0 auto;
    padding:4px 4px 8px;
  }

  .tgcb-modal-card label{
    margin-top:6px;
    font-size:13px;
  }
  .tgcb-modal-card input{
    padding:7px 8px;
    font-size:14px;
  }

  .tgcb-types{
    margin-top:8px;
    padding:6px 6px 4px;
    row-gap:4px;
  }
  .tgcb-types legend{
    font-size:16px;
    margin-bottom:4px;
  }

  /* чекбоксы в 2 колонки, текст на одной линии с чекбоксом */
  .tgcb-check{
    display:flex;
    align-items:center;
    gap:6px;
    font-weight:700;
    font-size:13px;
    line-height:1.2;
    flex:1 1 50%;
    min-width:0;
  }

  .tgcb-check input{
    width:18px;
    height:18px;
    margin-top:0;
  }

  .tgcb-footer{
    position:sticky;
    bottom:0;
    margin-top:6px;
    padding:8px 0 10px;
    border-top:1px solid var(--tgcb-border);
    background:#fff;
  }
  .tgcb-submit{
    padding:10px 12px;
    font-size:15px;
  }
}
