/* Minnesota Property Tax Calculator - Dark Theme */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --mptc-bg: #0d1117;
  --mptc-surface: #161b22;
  --mptc-surface2: #1c2230;
  --mptc-border: #253048;
  --mptc-border2: #1e2d42;
  --mptc-accent: #1a6fff;
  --mptc-accent2: #4d9fff;
  --mptc-accent-glow: rgba(26,111,255,0.18);
  --mptc-text: #e0e8f7;
  --mptc-text2: #8ba3c4;
  --mptc-text3: #5a7598;
  --mptc-green: #22c55e;
  --mptc-orange: #f59e0b;
  --mptc-red: #ef4444;
  --mptc-radius: 14px;
  --mptc-radius-sm: 8px;
  --mptc-shadow: 0 4px 32px rgba(0,0,0,0.45);
  --mptc-font: 'DM Sans', sans-serif;
  --mptc-mono: 'DM Mono', monospace;
  --mptc-transition: 0.2s ease;
}

/* ---- RESET WITHIN PLUGIN ---- */
#mptc-wrap, #mptc-wrap * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#mptc-wrap {
  font-family: var(--mptc-font);
  background: var(--mptc-bg);
  color: var(--mptc-text);
  border-radius: var(--mptc-radius);
  padding: 0;
  overflow: hidden;
  max-width: 960px;
  margin: 0 auto;
  box-shadow: var(--mptc-shadow), 0 0 0 1px var(--mptc-border);
  position: relative;
}

/* ---- HEADER ---- */
.mptc-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 28px 20px;
  border-bottom: 1px solid var(--mptc-border);
  background: linear-gradient(135deg, #0f1823 0%, #101825 100%);
  position: relative;
  overflow: hidden;
}

.mptc-header::before {
  content: 'Minnesota Property Tax Calculator';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--mptc-text);
  white-space: nowrap;
}

.mptc-header::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26,111,255,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.mptc-header-icon { flex-shrink: 0; z-index: 1; }

.mptc-header-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 1;
}

.mptc-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--mptc-accent2);
  background: var(--mptc-accent-glow);
  border: 1px solid rgba(26,111,255,0.3);
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  width: fit-content;
}

.mptc-subtitle {
  font-size: 12px;
  color: var(--mptc-text3);
  font-weight: 400;
}

/* ---- TABS ---- */
.mptc-tabs {
  display: flex;
  background: var(--mptc-surface);
  border-bottom: 1px solid var(--mptc-border);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.mptc-tabs::-webkit-scrollbar { display: none; }

.mptc-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 20px;
  font-family: var(--mptc-font);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--mptc-text3);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--mptc-transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.mptc-tab:hover { color: var(--mptc-text2); background: rgba(255,255,255,0.03); }
.mptc-tab.active { color: var(--mptc-accent2); border-bottom-color: var(--mptc-accent); }
.mptc-tab svg { flex-shrink: 0; }

/* ---- TAB CONTENT ---- */
.mptc-tab-content { display: none; padding: 24px; }
.mptc-tab-content.active { display: block; }

/* ---- GRID ---- */
.mptc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ---- CARD ---- */
.mptc-card {
  background: var(--mptc-surface);
  border: 1px solid var(--mptc-border);
  border-radius: var(--mptc-radius);
  padding: 22px;
}

.mptc-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--mptc-text3);
  margin-bottom: 16px;
}

/* ---- FORM FIELDS ---- */
.mptc-field {
  margin-bottom: 16px;
}

.mptc-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--mptc-text2);
  margin-bottom: 6px;
}

.mptc-req { color: var(--mptc-red); }

.mptc-select-wrap, .mptc-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.mptc-select-wrap select,
.mptc-input-wrap input {
  width: 100%;
  background: var(--mptc-surface2);
  border: 1px solid var(--mptc-border);
  color: var(--mptc-text);
  font-family: var(--mptc-font);
  font-size: 14px;
  padding: 10px 14px;
  border-radius: var(--mptc-radius-sm);
  outline: none;
  transition: border var(--mptc-transition), box-shadow var(--mptc-transition);
  appearance: none;
  -webkit-appearance: none;
}

.mptc-select-wrap select {
  padding-right: 36px;
  cursor: pointer;
}

.mptc-select-wrap select option {
  background: var(--mptc-surface2);
  color: var(--mptc-text);
}

.mptc-select-wrap select:focus,
.mptc-input-wrap input:focus {
  border-color: var(--mptc-accent);
  box-shadow: 0 0 0 3px var(--mptc-accent-glow);
}

.mptc-chevron {
  position: absolute;
  right: 11px;
  color: var(--mptc-text3);
  pointer-events: none;
}

.mptc-prefix, .mptc-suffix {
  position: absolute;
  font-size: 14px;
  color: var(--mptc-text3);
  pointer-events: none;
  font-weight: 500;
  z-index: 1;
}

.mptc-prefix { left: 13px; }
.mptc-suffix { right: 13px; }
.mptc-input-wrap input:first-of-type { padding-left: 28px; }
.mptc-input-wrap input:last-of-type { padding-right: 34px; }

.mptc-hint {
  font-size: 12px;
  color: var(--mptc-accent2);
  margin-top: 5px;
  min-height: 16px;
}

/* ---- TOOLTIP ---- */
.mptc-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--mptc-border);
  color: var(--mptc-text3);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  margin-left: 5px;
  vertical-align: middle;
  position: relative;
}

.mptc-tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e2d42;
  border: 1px solid var(--mptc-border);
  color: var(--mptc-text2);
  font-size: 12px;
  font-weight: 400;
  padding: 8px 12px;
  border-radius: var(--mptc-radius-sm);
  width: 230px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  line-height: 1.5;
}

.mptc-tooltip:hover::after { opacity: 1; visibility: visible; }

/* ---- BUTTONS ---- */
.mptc-btn-primary {
  width: 100%;
  padding: 12px 20px;
  background: var(--mptc-accent);
  color: #fff;
  font-family: var(--mptc-font);
  font-size: 14.5px;
  font-weight: 600;
  border: none;
  border-radius: var(--mptc-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background var(--mptc-transition), transform var(--mptc-transition), box-shadow var(--mptc-transition);
  margin-top: 6px;
  box-shadow: 0 2px 16px rgba(26,111,255,0.3);
}

.mptc-btn-primary:hover {
  background: #2277ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 22px rgba(26,111,255,0.45);
}

.mptc-btn-primary:active { transform: translateY(0); }

.mptc-btn-ghost {
  width: 100%;
  padding: 10px 20px;
  background: transparent;
  color: var(--mptc-text3);
  font-family: var(--mptc-font);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--mptc-border);
  border-radius: var(--mptc-radius-sm);
  cursor: pointer;
  margin-top: 8px;
  transition: all var(--mptc-transition);
}

.mptc-btn-ghost:hover { color: var(--mptc-text); border-color: var(--mptc-text3); }

.mptc-btn-outline {
  padding: 9px 16px;
  background: transparent;
  color: var(--mptc-accent2);
  font-family: var(--mptc-font);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(26,111,255,0.4);
  border-radius: var(--mptc-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  transition: all var(--mptc-transition);
}

.mptc-btn-outline:hover {
  background: var(--mptc-accent-glow);
  border-color: var(--mptc-accent);
}

/* ---- RESULTS ---- */
.mptc-result-hero {
  text-align: center;
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--mptc-border);
  margin-bottom: 16px;
}

.mptc-result-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--mptc-text3);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.mptc-result-value {
  font-size: 42px;
  font-weight: 700;
  color: var(--mptc-accent2);
  letter-spacing: -1.5px;
  line-height: 1;
  text-shadow: 0 0 30px rgba(77,159,255,0.3);
}

.mptc-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 13.5px;
  color: var(--mptc-text2);
  border-bottom: 1px solid var(--mptc-border2);
}

.mptc-result-row strong { color: var(--mptc-text); font-weight: 600; }

.mptc-divider {
  height: 1px;
  background: var(--mptc-border);
  margin: 14px 0;
}

/* ---- STEPS ---- */
.mptc-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.mptc-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--mptc-surface2);
  border: 1px solid var(--mptc-border2);
  border-radius: var(--mptc-radius-sm);
  padding: 12px;
}

.mptc-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--mptc-accent-glow);
  border: 1px solid rgba(26,111,255,0.4);
  color: var(--mptc-accent2);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.mptc-step-body { flex: 1; }
.mptc-step-label { font-size: 13px; font-weight: 600; color: var(--mptc-text); }
.mptc-step-desc { font-size: 11.5px; color: var(--mptc-text3); margin: 2px 0 5px; }
.mptc-step-val { font-size: 15px; font-weight: 700; color: var(--mptc-green); font-family: var(--mptc-mono); }

/* ---- PLACEHOLDER ---- */
.mptc-results-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  border-style: dashed;
  border-color: var(--mptc-border2);
}

.mptc-placeholder-inner {
  text-align: center;
  color: var(--mptc-text3);
}

.mptc-placeholder-inner svg {
  display: block;
  margin: 0 auto 14px;
}

.mptc-placeholder-inner p { font-size: 13.5px; line-height: 1.6; }
.mptc-placeholder-inner strong { color: var(--mptc-text2); }

/* ---- COMPARE TAB ---- */
.mptc-desc { font-size: 13.5px; color: var(--mptc-text2); margin-bottom: 18px; line-height: 1.6; }

.mptc-compare-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 20px;
}

.mptc-compare-inputs .mptc-btn-primary {
  width: auto;
  padding: 10px 18px;
  margin-top: 0;
  white-space: nowrap;
}

.mptc-compare-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  padding: 9px 14px;
  background: var(--mptc-surface2);
  border-radius: var(--mptc-radius-sm) var(--mptc-radius-sm) 0 0;
  border: 1px solid var(--mptc-border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--mptc-text3);
}

#mptc-compare-list {
  border: 1px solid var(--mptc-border);
  border-top: none;
  border-radius: 0 0 var(--mptc-radius-sm) var(--mptc-radius-sm);
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--mptc-border) transparent;
}

.mptc-compare-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  padding: 9px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--mptc-border2);
  transition: background var(--mptc-transition);
  align-items: center;
}

.mptc-compare-row:last-child { border-bottom: none; }
.mptc-compare-row:hover { background: var(--mptc-surface2); }
.mptc-compare-row.best { background: rgba(34,197,94,0.06); }
.mptc-compare-row.worst { background: rgba(239,68,68,0.05); }

.mptc-compare-row span { color: var(--mptc-text2); }
.mptc-compare-row strong { color: var(--mptc-text); font-weight: 600; }
.mptc-compare-row .mptc-green-val { color: var(--mptc-green); font-weight: 600; }
.mptc-compare-row .mptc-red-val { color: var(--mptc-red); font-weight: 600; }

/* ---- RATE TABLE TAB ---- */
.mptc-search-wrap {
  position: relative;
  margin-bottom: 16px;
}

.mptc-search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mptc-text3);
}

.mptc-search-wrap input {
  width: 100%;
  background: var(--mptc-surface2);
  border: 1px solid var(--mptc-border);
  color: var(--mptc-text);
  font-family: var(--mptc-font);
  font-size: 14px;
  padding: 10px 14px 10px 38px;
  border-radius: var(--mptc-radius-sm);
  outline: none;
  transition: border var(--mptc-transition), box-shadow var(--mptc-transition);
}

.mptc-search-wrap input:focus {
  border-color: var(--mptc-accent);
  box-shadow: 0 0 0 3px var(--mptc-accent-glow);
}

.mptc-table-wrap {
  overflow-x: auto;
  border-radius: var(--mptc-radius-sm);
  border: 1px solid var(--mptc-border);
  max-height: 480px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--mptc-border) transparent;
}

.mptc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.mptc-table thead tr {
  background: var(--mptc-surface2);
  position: sticky;
  top: 0;
  z-index: 2;
}

.mptc-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--mptc-text3);
  border-bottom: 1px solid var(--mptc-border);
}

.mptc-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--mptc-border2);
  color: var(--mptc-text2);
}

.mptc-table tbody tr:hover { background: var(--mptc-surface2); }
.mptc-table tbody tr:last-child td { border-bottom: none; }

.mptc-badge-level {
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.mptc-level-low { background: rgba(34,197,94,0.12); color: var(--mptc-green); border: 1px solid rgba(34,197,94,0.25); }
.mptc-level-mid { background: rgba(245,158,11,0.12); color: var(--mptc-orange); border: 1px solid rgba(245,158,11,0.25); }
.mptc-level-high { background: rgba(239,68,68,0.12); color: var(--mptc-red); border: 1px solid rgba(239,68,68,0.25); }

/* ---- GUIDE TAB ---- */
.mptc-formula-box {
  background: var(--mptc-surface2);
  border: 1px solid var(--mptc-border);
  border-left: 3px solid var(--mptc-accent);
  border-radius: var(--mptc-radius-sm);
  padding: 14px 18px;
  margin-bottom: 22px;
}

.mptc-formula-box code {
  font-family: var(--mptc-mono);
  font-size: 13.5px;
  color: var(--mptc-accent2);
  word-break: break-word;
}

.mptc-guide-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mptc-guide-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--mptc-surface2);
  border: 1px solid var(--mptc-border2);
  border-radius: var(--mptc-radius-sm);
  padding: 16px;
}

.mptc-guide-num {
  background: var(--mptc-accent-glow);
  border: 1px solid rgba(26,111,255,0.35);
  color: var(--mptc-accent2);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 20px;
  flex-shrink: 0;
  white-space: nowrap;
  margin-top: 1px;
}

.mptc-guide-body strong { font-size: 14px; color: var(--mptc-text); }
.mptc-guide-body p { font-size: 13px; color: var(--mptc-text2); margin: 5px 0 10px; line-height: 1.6; }
.mptc-guide-body code {
  font-family: var(--mptc-mono);
  font-size: 12.5px;
  color: var(--mptc-green);
  background: rgba(34,197,94,0.08);
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid rgba(34,197,94,0.2);
  display: inline-block;
}

.mptc-disclaimer {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(245,158,11,0.07);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--mptc-radius-sm);
  padding: 12px 14px;
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--mptc-text2);
  line-height: 1.6;
}

.mptc-disclaimer svg { color: var(--mptc-orange); flex-shrink: 0; margin-top: 1px; }

/* ---- FOOTER ---- */
.mptc-footer {
  text-align: center;
  padding: 12px;
  font-size: 11.5px;
  color: var(--mptc-text3);
  border-top: 1px solid var(--mptc-border);
  background: var(--mptc-surface);
}

/* ---- LOADING SPINNER ---- */
.mptc-loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mptc-spin 0.6s linear infinite;
}

@keyframes mptc-spin { to { transform: rotate(360deg); } }

/* ---- ANIMATIONS ---- */
.mptc-fade-in {
  animation: mptc-fadeIn 0.3s ease;
}

@keyframes mptc-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- PRINT STYLES ---- */
@media print {
  #mptc-wrap {
    box-shadow: none;
    border: 1px solid #ccc;
    background: #fff;
    color: #000;
  }
  .mptc-tabs, .mptc-btn-primary, .mptc-btn-ghost, .mptc-btn-outline { display: none !important; }
  .mptc-tab-content { display: block !important; padding: 10px; }
  .mptc-card { background: #f9f9f9; border-color: #ddd; }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .mptc-header::before { font-size: 14px; }

  .mptc-tab-content { padding: 14px; }

  .mptc-grid {
    grid-template-columns: 1fr;
  }

  .mptc-results-placeholder { display: none; }

  .mptc-compare-inputs {
    grid-template-columns: 1fr;
  }

  .mptc-compare-inputs .mptc-btn-primary { width: 100%; }

  .mptc-compare-header,
  .mptc-compare-row {
    grid-template-columns: 2fr 1fr 1.2fr;
  }

  .mptc-compare-header span:last-child,
  .mptc-compare-row span:last-child { display: none; }

  .mptc-result-value { font-size: 34px; }

  .mptc-header { padding: 16px 16px 14px; }
  .mptc-tab { padding: 11px 14px; font-size: 12.5px; }
}

@media (max-width: 480px) {
  .mptc-header::before { font-size: 13px; }
  .mptc-result-value { font-size: 28px; }
  .mptc-card { padding: 16px; }
}
