/* ============================================
   Rank10 Canadian Tax Calculator v5
   Premium Design — Fixed & Clean
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

.r10-wrap {
  --green:      #1a6b3c;
  --green-lt:   #22a05a;
  --green-pale: #e8f5ee;
  --ink:        #0d1f14;
  --ink-2:      #3a4d41;
  --ink-3:      #7a8f82;
  --border:     #d4e4da;
  --bg:         #f4f9f6;
  --white:      #ffffff;
  --card-sh:    0 2px 16px rgba(26,107,60,.09);
  --radius:     14px;
  --radius-sm:  9px;
  --font:       'Sora', sans-serif;
  --mono:       'DM Mono', monospace;

  font-family: var(--font);
  color: var(--ink);
  max-width: 780px;
  margin: 0 auto;
  padding: 0 0 40px;
  box-sizing: border-box;
}

.r10-wrap *, .r10-wrap *::before, .r10-wrap *::after {
  box-sizing: border-box;
}

/* ---- Header ---- */
.r10-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 32px 0 20px;
}
.r10-header-icon {
  flex-shrink: 0;
  width: 52px; height: 52px;
  background: var(--green-pale);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.r10-title {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
  line-height: 1.2;
}
.r10-subtitle {
  font-size: .85rem;
  color: var(--ink-3);
  margin: 0;
  font-weight: 400;
}

/* ---- Card Base ---- */
.r10-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-sh);
  padding: 24px;
  margin-bottom: 16px;
}

/* ---- Tax Type Card ---- */
.r10-type-card { padding: 20px 24px; }
.r10-type-select {
  width: 100%;
  margin-top: 8px;
  font-size: .98rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--green) !important;
  border-radius: var(--radius-sm) !important;
  padding: 12px 40px 12px 14px !important;
  cursor: pointer;
}
/* Type hint: hidden by default, only shown with JS when needed */
.r10-type-hint {
  margin-top: 10px;
  font-size: .78rem;
  color: var(--ink-3);
  line-height: 1.55;
  padding: 7px 12px;
  background: var(--green-pale);
  border-radius: 6px;
  border-left: 3px solid var(--green);
}
.r10-type-hint-hidden { display: none; }

/* ---- Input Grid ---- */
.r10-inputs { margin-bottom: 0; }
.r10-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}
@media (max-width: 540px) {
  .r10-grid-2 { grid-template-columns: 1fr; }
}

.r10-field { display: flex; flex-direction: column; gap: 6px; }

.r10-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .05em;
  text-transform: uppercase;
}

.r10-input-wrap { position: relative; }

.r10-prefix {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .93rem;
  color: var(--ink-3);
  font-weight: 500;
  pointer-events: none;
  z-index: 1;
}

/* Base input & select */
.r10-input,
.r10-select {
  width: 100%;
  display: block;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 14px 14px 14px;
  font-family: var(--font);
  font-size: .95rem;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.5;
  height: 52px;
  vertical-align: middle;
}

/* Placeholder — fully visible, never clipped */
.r10-input::placeholder {
  color: var(--ink-3);
  opacity: 1;
  font-size: .93rem;
  line-height: 1.5;
}

/* Dollar sign offset */
.r10-input-wrap .r10-input {
  padding-left: 30px;
}

/* Select fixed height match */
.r10-select {
  height: 52px;
  padding-top: 14px;
  padding-bottom: 14px;
}

/* Select arrow */
.r10-select {
  cursor: pointer;
  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='%237a8f82' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

.r10-input:focus,
.r10-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(26,107,60,.10);
  background: var(--white);
}

.r10-input-center { text-align: center; }

/* ---- Calculate Button ---- */
.r10-btn-calc {
  width: 100%;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-lt) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 15px 24px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 14px rgba(26,107,60,.28);
  letter-spacing: .01em;
}
.r10-btn-calc:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 22px rgba(26,107,60,.36);
}
.r10-btn-calc:active { transform: translateY(0); }
.r10-btn-icon { font-size: 1.1rem; }

/* ---- Pay Explainer Card — Luxury ---- */
.r10-pay-explainer {
  background: linear-gradient(160deg, #0d2b1a 0%, #1a6b3c 100%);
  border: none;
  margin-bottom: 16px;
  padding: 28px 24px;
  position: relative;
  overflow: hidden;
}
.r10-pay-explainer::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
  pointer-events: none;
}
.r10-pay-explainer::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 140px; height: 140px;
  background: rgba(255,255,255,.03);
  border-radius: 50%;
  pointer-events: none;
}
.r10-pe-title {
  font-size: .72rem;
  font-weight: 700;
  color: rgba(255,255,255,.55);
  margin-bottom: 20px;
  letter-spacing: .14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.r10-pe-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.12);
}
.r10-pe-lines {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.r10-pe-line {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  font-size: .84rem;
  color: rgba(255,255,255,.65);
  line-height: 1.4;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  background: none;
  border-radius: 0;
  border-left: none;
}
.r10-pe-line:last-child { border-bottom: none; }

.r10-pe-line.r10-pe-highlight {
  background: rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 13px 16px;
  margin: 8px -4px 0;
  border-bottom: none;
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
}
.r10-pe-line.r10-pe-highlight + .r10-pe-line.r10-pe-highlight {
  margin-top: 4px;
}
.r10-pe-label-text {
  color: inherit;
  font-weight: 500;
}
.r10-pe-eq {
  color: rgba(255,255,255,.35);
  font-size: .75rem;
  font-family: var(--mono);
  white-space: nowrap;
}
.r10-pe-result {
  font-family: var(--mono);
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  font-size: .9rem;
  text-align: right;
}
.r10-pe-line.r10-pe-highlight .r10-pe-result {
  color: #7fffb8;
  font-size: 1rem;
}
.r10-pe-line.r10-pe-deduction .r10-pe-result {
  color: #ffb085;
}

/* ---- Hero Result ---- */
.r10-hero-result {
  background: linear-gradient(135deg, #1a6b3c 0%, #0d3d22 100%);
  border-radius: var(--radius);
  padding: 28px 20px 24px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.r10-hero-result::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
  pointer-events: none;
}
.r10-hero-badge {
  display: inline-block;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.85);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 18px;
}
.r10-hero-stats {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
  flex-wrap: wrap;
}
.r10-hero-stat {
  text-align: center;
  flex: 1;
  min-width: 100px;
}
.r10-hero-divider {
  width: 1px;
  height: 48px;
  background: rgba(255,255,255,.18);
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .r10-hero-divider { display: none; }
  .r10-hero-stats { gap: 14px; }
}
.r10-hero-label {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: rgba(255,255,255,.62);
  margin-bottom: 6px;
}
.r10-hero-amount {
  font-family: var(--mono);
  font-size: 2.2rem;
  font-weight: 500;
  color: #fff;
  line-height: 1;
  letter-spacing: -.02em;
}
.r10-hero-sm { font-size: 1.55rem; }
.r10-hero-period {
  font-size: .7rem;
  color: rgba(255,255,255,.5);
  margin-top: 4px;
}

/* ---- Breakdown Cards Grid ---- */
.r10-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 560px) {
  .r10-breakdown-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 340px) {
  .r10-breakdown-grid { grid-template-columns: 1fr; }
}

.r10-breakdown-card {
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  text-align: center;
  border-left: 4px solid transparent;
}
.r10-card-gross { background: #f0faf4; border-color: #22a05a; }
.r10-card-fed   { background: #fef4f0; border-color: #e8622a; }
.r10-card-prov  { background: #fff8f0; border-color: #f0a030; }
.r10-card-cpp   { background: #f0f4ff; border-color: #4a6cf0; }
.r10-card-ei    { background: #f8f0ff; border-color: #9b59b6; }
.r10-card-rate  { background: #f4f4f4; border-color: #999; }

.r10-bc-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  margin-bottom: 7px;
}
.r10-bc-yearly {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 3px;
}
.r10-bc-monthly {
  font-size: .75rem;
  color: var(--ink-3);
}

/* ---- Single Stacked Progress Bar — Luxury ---- */
.r10-bar-section {
  background: var(--white);
  padding: 28px 24px;
}
.r10-bar-title {
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink-3);
  margin-bottom: 22px;
  letter-spacing: .14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}
.r10-bar-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.r10-stacked-bar-wrap {
  margin-bottom: 28px;
}
.r10-stacked-bar {
  display: flex;
  width: 100%;
  height: 36px;
  border-radius: 12px;
  overflow: hidden;
  background: #edf2ef;
  box-shadow: inset 0 1px 4px rgba(0,0,0,.07);
  gap: 2px;
}
.r10-sb-seg {
  height: 100%;
  transition: width .75s cubic-bezier(.4,0,.2,1);
  width: 0%;
  min-width: 0;
  position: relative;
}
.r10-sb-seg:first-child { border-radius: 12px 0 0 12px; }
.r10-sb-seg:last-child  { border-radius: 0 12px 12px 0; }

.r10-sb-net  { background: linear-gradient(135deg, #1a6b3c, #2ecc71); }
.r10-sb-fed  { background: linear-gradient(135deg, #c0392b, #e8622a); }
.r10-sb-prov { background: linear-gradient(135deg, #d68910, #f0a030); }
.r10-sb-cpp  { background: linear-gradient(135deg, #2c3e8c, #4a6cf0); }
.r10-sb-ei   { background: linear-gradient(135deg, #6c3483, #9b59b6); }

/* Legend — luxury rows */
.r10-sb-legend {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.r10-sb-leg-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.r10-sb-leg-item:last-child { border-bottom: none; }

.r10-sb-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.r10-sb-dot-net  { background: linear-gradient(135deg, #1a6b3c, #2ecc71); }
.r10-sb-dot-fed  { background: linear-gradient(135deg, #c0392b, #e8622a); }
.r10-sb-dot-prov { background: linear-gradient(135deg, #d68910, #f0a030); }
.r10-sb-dot-cpp  { background: linear-gradient(135deg, #2c3e8c, #4a6cf0); }
.r10-sb-dot-ei   { background: linear-gradient(135deg, #6c3483, #9b59b6); }

.r10-sb-leg-label {
  color: var(--ink-2);
  font-weight: 600;
  flex: 1;
  font-size: .84rem;
}
.r10-sb-leg-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.r10-sb-leg-amount {
  font-family: var(--mono);
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink);
}
.r10-sb-leg-pct {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--white);
  background: var(--ink-3);
  padding: 2px 8px;
  border-radius: 20px;
  min-width: 46px;
  text-align: center;
  font-weight: 500;
}
.r10-sb-leg-item:nth-child(1) .r10-sb-leg-pct { background: #1a6b3c; }
.r10-sb-leg-item:nth-child(2) .r10-sb-leg-pct { background: #c0392b; }
.r10-sb-leg-item:nth-child(3) .r10-sb-leg-pct { background: #d68910; }
.r10-sb-leg-item:nth-child(4) .r10-sb-leg-pct { background: #2c3e8c; }
.r10-sb-leg-item:nth-child(5) .r10-sb-leg-pct { background: #6c3483; }

/* ---- AI Section ---- */
.r10-ai-section { }
.r10-ai-intro {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.r10-ai-intro-icon { font-size: 1.7rem; line-height: 1; }
.r10-ai-intro-title {
  font-size: .98rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 3px;
}
.r10-ai-intro-sub { font-size: .79rem; color: var(--ink-3); }

.r10-btn-ai {
  width: 100%;
  background: var(--white);
  border: 2px solid var(--green);
  color: var(--green);
  border-radius: var(--radius-sm);
  padding: 13px 24px;
  font-family: var(--font);
  font-size: .96rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .18s;
  letter-spacing: .01em;
  margin-bottom: 18px;
}
.r10-btn-ai:hover { background: var(--green); color: var(--white); }

.r10-ai-result { text-align: left; }
.r10-ai-header { margin-bottom: 12px; }
.r10-ai-badge {
  background: var(--green-pale);
  color: var(--green);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
}
.r10-ai-text {
  font-size: .92rem;
  color: var(--ink-2);
  line-height: 1.85;
  white-space: pre-wrap;
  margin-top: 10px;
}

/* ---- Loading dots ---- */
.r10-ai-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink-3);
  font-size: .87rem;
  padding: 8px 0;
}
.r10-dots { display: flex; gap: 5px; }
.r10-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: r10bounce .9s infinite ease-in-out;
}
.r10-dots span:nth-child(2) { animation-delay: .15s; }
.r10-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes r10bounce {
  0%,80%,100% { transform: scale(.55); opacity:.35; }
  40%          { transform: scale(1);   opacity:1; }
}

/* ---- Results entrance ---- */
.r10-results { animation: r10fadeIn .4s ease; }
@keyframes r10fadeIn {
  from { opacity:0; transform:translateY(10px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ---- Footer ---- */
.r10-footer {
  text-align: center;
  font-size: .74rem;
  color: var(--ink-3);
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.r10-footer a { color: var(--green); text-decoration: none; }
.r10-footer a:hover { text-decoration: underline; }

/* ---- Income Basis Switcher ---- */
.r10-col-span-2 {
  grid-column: 1 / -1;
}

.r10-cond-income {
  animation: r10FadeIn 0.25s ease-in-out forwards;
}

#r10-ai-text br {
  content: "";
  display: block;
  margin: 5px 0;
}

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