/* ============================================================
   SALÃO AI — CEP Search Modal · Estilo
   Arquivo: public/css/cep-search-modal.css

   Modal full-screen para busca de CEP por estado/cidade/rua.
   Usa tokens do projeto: --brand, --text, --border, --radius.
   ============================================================ */

/* ── WRAP INPUT + BOTÃO 🔍 ─────────────────────────────────── */
.cep-input-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.cep-input-wrap > input {
  width: 100%;
  padding-right: 38px !important;
}

/* ── BOTÃO 🔍 AO LADO DO INPUT CEP ──────────────────────────── */
.csm-trigger {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: #FCF8F1;
  border: 1px solid #E5E7EB;
  color: #B8954F;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .78rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  line-height: 1;
  z-index: 2;
}
.csm-trigger:hover {
  background: #B8954F;
  border-color: #B8954F;
  color: #fff;
  box-shadow: 0 2px 8px rgba(184,149,79,.25);
}
.csm-trigger:active { transform: translateY(-50%) scale(.95); }

/* ── OVERLAY / BOX ─────────────────────────────────────────── */
.csm-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: csmFadeIn .18s ease;
}
.csm-overlay.hidden { display: none !important; }

@keyframes csmFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.csm-box {
  background: #fff;
  border-radius: 14px;
  width: 560px;
  max-width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(15, 23, 42, .25);
  overflow: hidden;
  animation: csmSlideUp .22s cubic-bezier(.4, 0, .2, 1);
}

@keyframes csmSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

body.csm-lock { overflow: hidden; }

/* ── HEADER ────────────────────────────────────────────────── */
.csm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid #E5E7EB;
  background: linear-gradient(135deg, #FCF8F1 0%, #FFFFFF 100%);
}
.csm-title {
  font-size: .95rem;
  font-weight: 700;
  color: #2C1810;
}
.csm-close {
  background: none;
  border: none;
  color: #6B7280;
  font-size: 1.15rem;
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: 6px;
  line-height: 1;
  transition: all .12s;
}
.csm-close:hover {
  background: #F3F4F6;
  color: #DC2626;
}

/* ── STEPS (breadcrumb) ────────────────────────────────────── */
.csm-steps {
  display: flex;
  gap: .5rem;
  padding: .65rem 1.1rem;
  background: #F9FAFB;
  border-bottom: 1px solid #E5E7EB;
  font-size: .72rem;
  font-weight: 600;
  color: #9CA3AF;
}
.csm-step {
  padding: .25rem .7rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #E5E7EB;
  transition: all .15s;
}
.csm-step.active {
  background: #B8954F;
  border-color: #B8954F;
  color: #fff;
  box-shadow: 0 1px 4px rgba(184, 149, 79, .3);
}
.csm-step.done {
  background: #ECFDF5;
  border-color: #059669;
  color: #059669;
}

/* ── BODY / PANELS ─────────────────────────────────────────── */
.csm-body {
  padding: 1rem 1.1rem;
  overflow-y: auto;
  flex: 1;
  min-height: 280px;
}
.csm-panel { display: block; }
.csm-panel.hidden { display: none !important; }

.csm-breadcrumb {
  font-size: .8rem;
  color: #6B7280;
  padding: .35rem .7rem;
  background: #FCF8F1;
  border-radius: 6px;
  margin-bottom: .6rem;
  border-left: 3px solid #B8954F;
}
.csm-breadcrumb strong { color: #2C1810; margin-right: .25rem; }

/* ── INPUT BUSCA ───────────────────────────────────────────── */
.csm-input {
  width: 100%;
  padding: .65rem .85rem;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  font-size: .88rem;
  font-family: inherit;
  color: #111827;
  background: #fff;
  outline: none;
  box-sizing: border-box;
  transition: all .15s;
  text-transform: none;
}
.csm-input:focus {
  border-color: #B8954F;
  box-shadow: 0 0 0 3px rgba(184, 149, 79, .12);
}
.csm-input::placeholder { color: #C0C0D0; }

/* ── GRID DE UF ────────────────────────────────────────────── */
.csm-grid-uf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .4rem;
  margin-top: .75rem;
}
.csm-uf-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .1rem;
  padding: .55rem .7rem;
  background: #fff;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
  font-family: inherit;
}
.csm-uf-btn:hover {
  border-color: #B8954F;
  background: #FCF8F1;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(184, 149, 79, .1);
}
.csm-uf-sigla {
  font-size: .95rem;
  font-weight: 800;
  color: #2C1810;
  letter-spacing: .02em;
}
.csm-uf-nome {
  font-size: .68rem;
  color: #6B7280;
  font-weight: 500;
}

/* ── LISTA (cidade / logradouro) ───────────────────────────── */
.csm-lista {
  margin-top: .65rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  max-height: 320px;
  overflow-y: auto;
}
.csm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .55rem .75rem;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  cursor: pointer;
  transition: all .12s;
  text-align: left;
  font-family: inherit;
  font-size: .85rem;
}
.csm-item:hover {
  border-color: #B8954F;
  background: #FCF8F1;
  transform: translateX(2px);
}
.csm-item-txt { color: #2C1810; font-weight: 500; }
.csm-item-txt mark {
  background: #FEF3C7;
  color: #92400E;
  padding: 0 .1em;
  border-radius: 2px;
}
.csm-item-badge {
  background: #F3F4F6;
  color: #6B7280;
  font-size: .68rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 999px;
}

/* ── ITEM LOGRADOURO (mais info) ───────────────────────────── */
.csm-item-log {
  align-items: flex-start;
  padding: .65rem .8rem;
}
.csm-log-info {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  flex: 1;
  min-width: 0;
}
.csm-log-rua {
  font-size: .85rem;
  font-weight: 600;
  color: #2C1810;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.csm-log-bairro {
  font-size: .7rem;
  color: #6B7280;
}
.csm-log-cep {
  background: #ECFDF5;
  color: #059669;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: .75rem;
  font-weight: 700;
  padding: .25rem .55rem;
  border-radius: 6px;
  white-space: nowrap;
}

/* ── MENSAGENS ESTADO ──────────────────────────────────────── */
.csm-msg {
  padding: 1.25rem .5rem;
  text-align: center;
  color: #6B7280;
  font-size: .85rem;
}
.csm-msg a {
  color: #B8954F;
  text-decoration: none;
  font-weight: 600;
}
.csm-msg a:hover { text-decoration: underline; }
.csm-spin {
  display: inline-block;
  animation: csmSpin 1s linear infinite;
  margin-right: .25rem;
}
@keyframes csmSpin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}

/* ── FOOTER ────────────────────────────────────────────────── */
.csm-footer {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  padding: .75rem 1.1rem;
  border-top: 1px solid #E5E7EB;
  background: #F9FAFB;
}
.csm-btn-voltar,
.csm-btn-cancelar {
  padding: .5rem .9rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  font-family: inherit;
  transition: all .12s;
  border: 1px solid transparent;
}
.csm-btn-voltar {
  background: #fff;
  border-color: #E5E7EB;
  color: #374151;
}
.csm-btn-voltar:hover {
  border-color: #B8954F;
  color: #B8954F;
  background: #FCF8F1;
}
.csm-btn-cancelar {
  background: #fff;
  border-color: #E5E7EB;
  color: #6B7280;
}
.csm-btn-cancelar:hover {
  border-color: #DC2626;
  color: #DC2626;
  background: #FEF2F2;
}

/* ── MOBILE ────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .csm-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .csm-box {
    max-width: 100%;
    width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
    animation: csmSlideMobile .22s cubic-bezier(.4, 0, .2, 1);
  }
  @keyframes csmSlideMobile {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .csm-grid-uf {
    grid-template-columns: repeat(2, 1fr);
  }
  .csm-step {
    padding: .2rem .5rem;
    font-size: .65rem;
  }
}
