/* =========================================================
   Matrix360 Calculator — Stylesheet v1.3
   ========================================================= */

:root {
  --m360-primary:     #00c875;
  --m360-primary-dk:  #00a85e;
  --m360-accent:      #00c875;
  --m360-accent-dk:   #00a85e;
  --m360-bg:          #f8fafc;
  --m360-card:        #ffffff;
  --m360-border:      #e2e8f0;
  --m360-text:        #1e293b;
  --m360-muted:       #64748b;
  --m360-error:       #dc2626;
  --m360-radius:      14px;
  --m360-shadow:      0 4px 24px rgba(0,0,0,.08);
  /* Tamanho dos botões — controlado pelo admin */
  --m360-btn-padding-y:  10px;
  --m360-btn-padding-x:  20px;
  --m360-btn-font-size:  14px;
}

/* ── Card ── */
.m360-card {
  background: var(--m360-card);
  border: 1px solid var(--m360-border);
  border-radius: var(--m360-radius);
  box-shadow: var(--m360-shadow);
  padding: 36px 40px;
  max-width: 780px;
  margin: 0 auto 32px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--m360-text);
  box-sizing: border-box;
  width: 100%;
}

/* ── Header ── */
.m360-header {
  margin-bottom: 28px;
  border-bottom: 2px solid var(--m360-accent);
  padding-bottom: 20px;
}
.m360-logo {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--m360-accent);
  margin-bottom: 6px;
}
.m360-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--m360-text);
}
.m360-sub {
  font-size: 14px;
  color: var(--m360-muted);
  margin: 0;
}

/* ── Form fields ── */
.m360-form  { display: flex; flex-direction: column; gap: 16px; }
.m360-row   { display: flex; flex-direction: column; gap: 16px; }
.m360-row-2 { flex-direction: row; gap: 16px; }
.m360-row-2 .m360-field { flex: 1; min-width: 0; }

.m360-field { display: flex; flex-direction: column; gap: 6px; }
.m360-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--m360-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.m360-input,
.m360-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--m360-border);
  border-radius: 8px;
  font-size: 15px;
  color: var(--m360-text);
  background: var(--m360-bg);
  transition: border-color .2s;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}
.m360-input:focus,
.m360-select:focus {
  outline: none;
  border-color: var(--m360-primary);
  background: #fff;
}
.m360-input-sm { padding: 8px 10px; font-size: 14px; }

/* Select — seta (iOS/Android) */
.m360-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* ── Meses ── */
.m360-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--m360-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 8px;
  border-top: 1px solid var(--m360-border);
  padding-top: 16px;
}
.m360-grid-months {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* ══════════════════════════════════════════
   BOTÕES — base
══════════════════════════════════════════ */
.m360-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  width: 100%;
  box-sizing: border-box;
}
.m360-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--m360-btn-padding-y) var(--m360-btn-padding-x);
  font-size: var(--m360-btn-font-size);
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: background .18s, transform .1s;
  white-space: nowrap;
  box-sizing: border-box;
  /* nunca ultrapassa a largura disponível */
  max-width: 100%;
  flex-shrink: 1;
}
.m360-btn:active { transform: scale(.98); }

/* Botão ghost (Limpar) — borda explícita */
.m360-btn-ghost {
  background: transparent;
  color: var(--m360-muted);
  border: 1.5px solid var(--m360-border) !important;
}
.m360-btn-ghost:hover { background: var(--m360-bg); }

/* ── Botão PDF ── */
/* Visibilidade controlada 100% via JS (inline style no elemento) */
.m360-pdf-bar {
  display: none; /* JS sobrescreve para block após o cálculo */
  margin-top: 22px;
  padding-top: 18px;
  border-top: 2px dashed var(--m360-border);
  width: 100%;
  box-sizing: border-box;
}
.m360-pdf-bar.is-visible {
  display: block !important;
}
.m360-btn-pdf {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  background: #1e293b !important;
  color: #fff !important;
  border: none !important;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: background .18s;
  box-sizing: border-box;
  max-width: 100%;
  white-space: nowrap;
}
.m360-btn-pdf:hover,
.m360-btn-pdf:focus { background: #0f172a !important; color: #fff !important; }

/* ── Results ── */
.m360-result {
  margin-top: 28px;
  border-top: 2px dashed var(--m360-border);
  padding-top: 24px;
  overflow-x: hidden;
}
.m360-result-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 18px;
  color: var(--m360-text);
}

/* Economy highlight */
.m360-highlight-box {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}
.m360-hl {
  flex: 1;
  background: linear-gradient(135deg, #f0fff8 0%, #e6f9f0 100%);
  border: 1.5px solid var(--m360-accent);
  border-radius: 12px;
  padding: 18px 20px;
  text-align: center;
}
.m360-hl-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--m360-accent-dk);
  letter-spacing: .06em;
  display: block;
  margin-bottom: 4px;
}
.m360-hl-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--m360-accent-dk);
  line-height: 1;
}
.m360-hl-sub {
  font-size: 12px;
  color: var(--m360-muted);
  margin-top: 4px;
  display: block;
}

/* Table */
.m360-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
  border-radius: 8px;
}
.m360-table-wrap .m360-table { margin-bottom: 0; min-width: 300px; }
.m360-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 16px;
}
.m360-table th {
  background: var(--m360-bg);
  color: var(--m360-muted);
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--m360-border);
}
.m360-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--m360-border);
  color: var(--m360-text);
}
.m360-table td.m360-td-val { font-weight: 600; text-align: right; }
.m360-table tr:last-child td { border-bottom: none; }
.m360-table tr.m360-row-accent td {
  background: #f0fff8;
  font-weight: 700;
  color: var(--m360-accent-dk);
}

/* Badge */
.m360-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
}
.m360-badge-green  { background: #dcfce7; color: #15803d; }
.m360-badge-orange { background: #fff7ed; color: #c2410c; }

/* Error / Loading */
.m360-error {
  margin-top: 20px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 14px 18px;
  color: var(--m360-error);
  font-size: 14px;
}
.m360-loading {
  margin-top: 20px;
  text-align: center;
  color: var(--m360-muted);
  font-size: 15px;
  animation: m360-pulse 1.2s ease-in-out infinite;
}
@keyframes m360-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* Disclaimer */
.m360-disclaimer {
  margin-top: 24px;
  font-size: 11px;
  color: var(--m360-muted);
  line-height: 1.6;
  border-top: 1px solid var(--m360-border);
  padding-top: 14px;
}

/* ── Assinatura ── */
.m360-signature {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--m360-border);
  text-align: center;
  font-size: 12px;
  color: var(--m360-muted);
  letter-spacing: .02em;
  word-break: break-word;
  line-height: 1.8;
}
.m360-signature strong { color: var(--m360-text); }
.m360-signature a {
  color: var(--m360-primary);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.m360-signature a:hover { text-decoration: underline; }

/* ── Tabs ── */
.m360-tabs-wrapper { max-width: 820px; margin: 0 auto; }
.m360-tabs-nav {
  display: flex;
  gap: 4px;
  background: var(--m360-bg);
  border: 1px solid var(--m360-border);
  border-radius: 10px 10px 0 0;
  padding: 6px 6px 0;
}
.m360-tab-btn {
  flex: 1;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-radius: 8px 8px 0 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: var(--m360-muted);
  transition: background .18s, color .18s;
}
.m360-tab-btn:hover { background: #fff; color: var(--m360-text); }
.m360-tab-active {
  background: #fff;
  color: var(--m360-primary);
  box-shadow: 0 -2px 0 var(--m360-primary) inset;
}
.m360-tab-panel { display: none; }
.m360-tab-show  { display: block; }
.m360-tabs-wrapper .m360-card { border-radius: 0 0 var(--m360-radius) var(--m360-radius); }

/* ══════════════════════════════════════════
   RESPONSIVO — Tablet ≤ 640px
══════════════════════════════════════════ */
@media (max-width: 640px) {
  .m360-card          { padding: 20px 14px; border-radius: 10px; margin: 0 0 16px; }
  .m360-header h2     { font-size: 18px; }
  .m360-sub           { font-size: 13px; }
  .m360-row-2         { flex-direction: column; gap: 12px; }
  .m360-highlight-box { gap: 10px; }
  .m360-hl            { padding: 14px 10px; }
  .m360-hl-value      { font-size: 22px; }
  .m360-grid-months   { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .m360-tab-btn       { font-size: 13px; padding: 10px 8px; }
  .m360-table th,
  .m360-table td      { font-size: 12px; padding: 8px 9px; }

  /* Botões lado a lado, compactos */
  .m360-actions       { gap: 8px; }
  .m360-btn           { padding: 9px 14px; font-size: 13px; }

  /* Assinatura: quebra em linhas no mobile */
  .m360-signature     { font-size: 11px; }
}

/* ══════════════════════════════════════════
   RESPONSIVO — Celular ≤ 420px
══════════════════════════════════════════ */
@media (max-width: 420px) {
  .m360-card          { padding: 16px 12px; }
  .m360-header h2     { font-size: 16px; }
  .m360-highlight-box { flex-direction: column; }
  .m360-hl-value      { font-size: 24px; }
  .m360-grid-months   { grid-template-columns: repeat(2, 1fr); }
  .m360-tabs-nav      { flex-wrap: wrap; }
  .m360-tab-btn       { flex: 1 1 45%; font-size: 12px; padding: 9px 4px; }
  .m360-table th,
  .m360-table td      { font-size: 11px; padding: 6px 8px; }

  /* Botões empilhados */
  .m360-actions       { flex-direction: column; gap: 8px; }
  .m360-btn           { width: 100%; padding: 11px 14px; font-size: 13px; }

  /* Botão PDF largura total */
  .m360-btn-pdf       { width: 100%; justify-content: center; }

  /* Assinatura centralizada e compacta */
  .m360-signature {
    font-size: 11px;
    padding: 10px 0 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    align-items: center;
  }
}

@media print {
  body > * { display: none !important; }
}
