/* Matrix360 Popup Calculator v1.0 — Saída Digital */

/* ── Botão flutuante ── */
#m360p-float {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
}
.m360p-float-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #E8391D;
  color: #fff;
  border: none;
  padding: 13px 20px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(232,57,29,.40);
  transition: background .18s, transform .15s, box-shadow .18s;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.m360p-float-btn:hover {
  background: #C42D14;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(232,57,29,.50);
}
.m360p-float-btn:active { transform: scale(.97); }

/* Botão inline */
.m360p-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #E8391D;
  color: #fff;
  border: none;
  padding: 12px 26px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: background .18s;
}
.m360p-open-btn:hover { background: #C42D14; }

/* ── Overlay ── */
#m360p-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s;
}
#m360p-overlay.m360p-show {
  opacity: 1;
  pointer-events: all;
}
#m360p-overlay.m360p-show #m360p-modal {
  transform: translateY(0) scale(1);
}

/* ── Modal ── */
#m360p-modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 680px;
  box-shadow: 0 24px 64px rgba(0,0,0,.20);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transform: translateY(20px) scale(.97);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
#m360p-header {
  background: #1A1A1A;
  border-bottom: 3px solid #E8391D;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
#m360p-logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
#m360p-logo {
  height: 28px;
  width: auto;
  display: block;
}
#m360p-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}
#m360p-sub {
  font-size: 12px;
  color: #9CA3AF;
}
#m360p-close {
  background: #374151;
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #FFFFFF;
  transition: background .18s, color .18s, transform .1s;
  flex-shrink: 0;
}
#m360p-close svg {
  width: 18px;
  height: 18px;
  display: block;
}
#m360p-close:hover { background: #E8391D; color: #fff; transform: scale(1.05); }
#m360p-close:active { transform: scale(.95); }

/* ── Body ── */
#m360p-body {
  padding: 24px 24px 16px;
  overflow-y: auto;
  flex: 1;
}

/* ── Grid de campos ── */
.m360p-grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.m360p-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.m360p-field label {
  font-size: 12px;
  font-weight: 600;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Select ── */
.m360p-sel-wrap {
  position: relative;
}
.m360p-sel-wrap select {
  width: 100%;
  padding: 11px 36px 11px 14px;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s;
  font-family: inherit;
}
.m360p-sel-wrap select:focus {
  outline: none;
  border-color: #E8391D;
  box-shadow: 0 0 0 3px rgba(232,57,29,.12);
}
.m360p-sel-wrap select:disabled {
  background: #F9FAFB;
  color: #9CA3AF;
  cursor: not-allowed;
}
.m360p-arr {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #6B7280;
}

/* ── Input valor ── */
.m360p-inp-valor {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  background: #fff;
  transition: border-color .18s, box-shadow .18s;
  font-family: inherit;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}
.m360p-inp-valor:focus {
  outline: none;
  border-color: #E8391D;
  box-shadow: 0 0 0 3px rgba(232,57,29,.12);
}
.m360p-inp-valor::placeholder { color: #9CA3AF; }

/* ── Erro ── */
.m360p-err {
  background: #FFF0ED;
  border: 1px solid #FECEC7;
  border-radius: 8px;
  padding: 10px 14px;
  color: #C42D14;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ── Botões ── */
.m360p-foot-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}
.m360p-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: background .18s, transform .1s;
  font-family: inherit;
  white-space: nowrap;
}
.m360p-btn:active { transform: scale(.98); }
.m360p-btn-primary {
  background: #E8391D;
  color: #fff;
}
.m360p-btn-primary:hover { background: #C42D14; }
.m360p-btn-primary:disabled {
  background: #D1D5DB;
  color: #9CA3AF;
  cursor: not-allowed;
}
.m360p-btn-ghost {
  background: transparent;
  color: #6B7280;
  border: 1.5px solid #E5E7EB;
}
.m360p-btn-ghost:hover { background: #F9FAFB; }

/* ── Resultado — Cards ── */
.m360p-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.m360p-card {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}
.m360p-card-hl {
  background: #FFF0ED;
  border-color: #E8391D;
}
.m360p-card-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #6B7280;
  display: block;
  margin-bottom: 5px;
}
.m360p-card-hl .m360p-card-lbl { color: #C42D14; }
.m360p-card-val {
  font-size: 22px;
  font-weight: 800;
  color: #111827;
  line-height: 1;
}
.m360p-card-hl .m360p-card-val { color: #E8391D; }
.m360p-card-sub {
  font-size: 11px;
  color: #9CA3AF;
  margin-top: 4px;
  display: block;
}
.m360p-card-hl .m360p-card-sub { color: #C42D14; opacity: .8; }

/* ── Resultado — Tabela ── */
.m360p-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 6px;
}
.m360p-tbl td {
  padding: 9px 12px;
  border-bottom: 1px solid #F3F4F6;
  color: #111827;
}
.m360p-tbl tr:last-child td { border-bottom: none; }
.m360p-tbl td:last-child { text-align: right; font-weight: 600; }
.m360p-acc td {
  background: #FFF0ED;
  font-weight: 700;
  color: #C42D14;
}

/* ── Footer ── */
#m360p-footer {
  text-align: center;
  font-size: 11px;
  color: #9CA3AF;
  padding: 10px 24px 14px;
  border-top: 1px solid #F3F4F6;
  flex-shrink: 0;
}
#m360p-footer strong { color: #374151; }
#m360p-footer a { color: #E8391D; text-decoration: none; font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 600px) {
  /* Overlay ocupa tela toda sem padding lateral */
  #m360p-overlay {
    align-items: flex-end;
    padding: 0;
  }
  /* Modal como bottom sheet: largura 100%, sem bordas laterais */
  #m360p-modal {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    margin-top: auto;
    max-height: 92vh;
  }
  /* Campos empilhados em coluna */
  .m360p-grid3 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  /* Cards lado a lado ainda */
  .m360p-cards {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  /* Botões em coluna, largura total */
  .m360p-foot-btns {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .m360p-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
  }
  /* Espaçamentos internos reduzidos */
  #m360p-body    { padding: 16px 14px 10px; }
  #m360p-header  { padding: 13px 14px; }
  #m360p-footer  { padding: 8px 14px 12px; font-size: 10px; }
  /* Título menor */
  #m360p-title   { font-size: 14px; }
  #m360p-sub     { font-size: 11px; }
  /* Logo menor */
  #m360p-logo    { height: 22px; }
  /* Botão flutuante: só ícone */
  #m360p-float   { bottom: 14px; right: 14px; }
  .m360p-float-btn { padding: 14px; border-radius: 50%; }
  .m360p-float-btn span { display: none; }
  /* Cards de resultado compactos */
  .m360p-card    { padding: 10px 10px; }
  .m360p-card-val { font-size: 17px; }
  .m360p-card-lbl { font-size: 9px; }
  /* Tabela fonte menor */
  .m360p-tbl td  { padding: 7px 10px; font-size: 12px; }
}

@media (max-width: 380px) {
  #m360p-modal   { max-height: 95vh; }
  .m360p-cards   { grid-template-columns: 1fr; }
  #m360p-body    { padding: 14px 12px 8px; }
  .m360p-card-val { font-size: 19px; }
}
