/* ============================================================
   paragraf.tools — Decision Simulator Components (v2)
   Extends tools.css with shared rendering components
   ============================================================ */

/* ── Hero result card ── */
.tool-hero { background: var(--purple-900); border-radius: 14px; padding: clamp(20px, 3vw, 28px); margin: 20px 0; text-align: center; }
.tool-hero__label { font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: rgba(243,239,250,.45); margin-bottom: 4px; }
.tool-hero__value { font-family: var(--font-serif); font-size: clamp(1.5rem, 3.5vw, 2.2rem); font-weight: 700; color: var(--orange-400); line-height: 1.3; }
.tool-hero__context { font-size: .82rem; color: rgba(243,239,250,.55); margin-top: 6px; }
.tool-hero__badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: .72rem; font-weight: 600; margin-top: 8px; }
.tool-hero__badge--safe { background: rgba(74,222,128,.15); color: #4ade80; }
.tool-hero__badge--warn { background: rgba(251,146,60,.15); color: #FB923C; }
.tool-hero__badge--danger { background: rgba(248,113,113,.15); color: #F87171; }
.tool-hero__sub { font-size: .78rem; color: rgba(243,239,250,.5); margin-top: 4px; line-height: 1.5; }

/* ── Breakdown table ── */
.tool-bd { width: 100%; border-collapse: collapse; margin: 12px 0; }
.tool-bd__r td { padding: 5px 0; font-size: .82rem; color: var(--text-dark); }
.tool-bd__k { color: var(--text-dark-dim); padding-right: 12px; }
.tool-bd__v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.tool-bd__p { text-align: right; font-size: .74rem; color: var(--text-dark-dim); padding-left: 8px; white-space: nowrap; width: 50px; }
.tool-bd__r--indent .tool-bd__k { padding-left: 16px; font-size: .78rem; }
.tool-bd__r--hl td { font-weight: 600; color: var(--purple-800); }
.tool-bd__r--neg .tool-bd__v { color: var(--success, #16a34a); }
.tool-bd__r--sh td { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dark-dim); padding-top: 14px; padding-bottom: 4px; }
.tool-bd__sep td { border-top: 1px solid var(--ivory-mid); padding-top: 10px; }
/* Dark variant (inside .rc or .tool-hero) */
.rc .tool-bd__r td, .tool-hero .tool-bd__r td { color: #F3EFFA; }
.rc .tool-bd__k, .tool-hero .tool-bd__k { color: rgba(243,239,250,.6); }
.rc .tool-bd__p, .tool-hero .tool-bd__p { color: rgba(243,239,250,.4); }
.rc .tool-bd__r--hl td, .tool-hero .tool-bd__r--hl td { color: var(--orange-400); }
.rc .tool-bd__sep td, .tool-hero .tool-bd__sep td { border-color: rgba(255,255,255,.08); }

/* ── Waterfall bar ── */
.tool-wf { margin: 16px 0; }
.tool-wf__title { font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dark-dim); margin-bottom: 8px; }
.tool-wf__bar { display: flex; height: 28px; border-radius: 7px; overflow: hidden; }
.tool-wf__seg { display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 600; color: #fff; transition: width .4s ease; min-width: 2px; }
.tool-wf__leg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tool-wf__li { display: flex; align-items: center; gap: 5px; font-size: .76rem; color: var(--text-dark-dim); }
.tool-wf__dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
/* Dark variant */
.rc .tool-wf__title, .tool-hero .tool-wf__title { color: rgba(243,239,250,.4); }
.rc .tool-wf__li, .tool-hero .tool-wf__li { color: rgba(243,239,250,.6); }

/* ── Timeline ── */
.tool-tl { margin: 20px 0; position: relative; }
.tool-tl__track { position: relative; height: 120px; background: var(--neutral-50); border: 1px solid var(--ivory-mid); border-radius: 10px; overflow: visible; }
.tool-tl__zone { position: absolute; top: 0; bottom: 0; border-radius: 10px; }
.tool-tl__zone--safe { background: rgba(74,222,128,.1); }
.tool-tl__zone--warning { background: rgba(251,146,60,.1); }
.tool-tl__zone--danger { background: rgba(248,113,113,.1); }
.tool-tl__zone-label { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); font-size: .68rem; font-weight: 600; white-space: nowrap; color: var(--text-dark-dim); }
.tool-tl__event { position: absolute; top: 10px; transform: translateX(-50%); text-align: center; z-index: 2; }
.tool-tl__marker { width: 14px; height: 14px; border-radius: 50%; margin: 0 auto 4px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.tool-tl__event--start .tool-tl__marker { background: var(--purple-500); }
.tool-tl__event--safe .tool-tl__marker { background: #4ade80; }
.tool-tl__event--warning .tool-tl__marker { background: #FB923C; }
.tool-tl__event--danger .tool-tl__marker { background: #F87171; }
.tool-tl__event--end .tool-tl__marker { background: #F87171; }
.tool-tl__event--normal .tool-tl__marker { background: var(--neutral-400); }
.tool-tl__event--today .tool-tl__marker { background: var(--purple-500); border-color: var(--orange-400); }
.tool-tl__label { font-size: .7rem; font-weight: 600; color: var(--text-dark); white-space: nowrap; max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.tool-tl__sub { font-size: .64rem; color: var(--text-dark-dim); white-space: nowrap; margin-top: 1px; }

/* ── Comparison grid ── */
.tool-cmp { margin: 20px 0; }
.tool-cmp__grid { display: grid; gap: 10px; }
.tool-cmp__col { background: var(--surface); border: 1px solid var(--ivory-mid); border-radius: 10px; padding: 16px; transition: border-color .15s; }
.tool-cmp__col--best { border-color: var(--orange-500); background: rgba(249,115,22,.03); }
.tool-cmp__header { font-size: .82rem; font-weight: 600; color: var(--text-dark); margin-bottom: 10px; text-align: center; }
.tool-cmp__badge { font-size: .68rem; font-weight: 600; color: var(--orange-500); text-align: center; margin: -6px 0 8px; }
.tool-cmp__row { display: flex; justify-content: space-between; padding: 4px 0; font-size: .8rem; border-bottom: 1px solid var(--neutral-100); }
.tool-cmp__row:last-child { border-bottom: none; }
.tool-cmp__k { color: var(--text-dark-dim); }
.tool-cmp__v { font-weight: 500; color: var(--text-dark); font-variant-numeric: tabular-nums; }

/* ── "Co dál" strip ── */
.tool-next { margin: 24px 0; }
.tool-next__title { font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dark-dim); margin-bottom: 10px; }
.tool-next__item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--ivory-mid); border-radius: 8px; margin-bottom: 6px; text-decoration: none; color: var(--text-dark); font-size: .84rem; font-weight: 500; transition: all .15s; cursor: pointer; font-family: var(--font-sans); }
.tool-next__item:hover { border-color: var(--orange-500); background: rgba(249,115,22,.03); transform: translateX(4px); }
.tool-next__icon { font-size: 1.1rem; flex-shrink: 0; }
.tool-next__label { flex: 1; }
.tool-next__pro { font-size: .64rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; background: var(--purple-900); color: var(--orange-400); }
.tool-next__arrow { color: var(--orange-500); font-size: 1rem; flex-shrink: 0; }

/* ── Score bar ── */
.tool-score { margin: 16px 0; }
.tool-score__header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.tool-score__label { font-size: .82rem; font-weight: 500; color: var(--text-dark); }
.tool-score__val { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700; color: var(--text-dark); }
.tool-score__track { height: 10px; background: var(--neutral-100); border-radius: 5px; overflow: hidden; }
.tool-score__bar { height: 100%; border-radius: 5px; transition: width .6s ease; }

/* ── Holidays list ── */
.tool-holidays { margin: 12px 0; }
.tool-holidays__item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: .78rem; color: var(--text-dark-dim); }
.tool-holidays__item--collision { color: var(--danger, #E65100); font-weight: 500; }
.tool-holidays__dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.tool-holidays__dot--collision { background: var(--danger, #E65100); }
.tool-holidays__dot--normal { background: var(--neutral-300); }

/* ── Section divider inside tools ── */
.tool-section { margin: 24px 0; }
.tool-section__title { font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--orange-500); margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--ivory-mid); }

/* ── Warning inline ── */
.tool-warn { display: flex; align-items: flex-start; gap: 8px; padding: 10px 14px; background: rgba(249,115,22,.06); border: 1px solid rgba(249,115,22,.2); border-radius: 8px; margin: 10px 0; font-size: .8rem; color: var(--text-dark); line-height: 1.5; }
.tool-warn__icon { flex-shrink: 0; font-size: 1rem; }

/* -- Business entity decision blocks -- */
.be-signal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.be-signal { background: var(--surface); border: 1px solid var(--ivory-mid); border-radius: 12px; padding: 14px; }
.be-signal--osvc { border-color: rgba(249,115,22,.32); background: rgba(249,115,22,.04); }
.be-signal--sro { border-color: rgba(112,71,176,.24); background: rgba(112,71,176,.05); }
.be-signal--tie { background: var(--neutral-50); }
.be-signal__eyebrow { font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dark-dim); margin-bottom: 8px; }
.be-signal__title { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 700; color: var(--text-dark); }
.be-signal__delta { font-size: .8rem; color: var(--text-dark-dim); margin-top: 6px; line-height: 1.5; min-height: 2.4em; }
.be-signal__meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: .74rem; color: var(--text-dark-dim); }

.be-sweep { display: grid; gap: 12px; }
.be-sweep__row { background: var(--surface); border: 1px solid var(--ivory-mid); border-radius: 12px; padding: 12px 14px; }
.be-sweep__row--current { border-color: var(--orange-500); box-shadow: 0 0 0 1px rgba(249,115,22,.08); background: rgba(249,115,22,.03); }
.be-sweep__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.be-sweep__revenue { font-size: .82rem; font-weight: 700; color: var(--text-dark); }
.be-sweep__winner { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border-radius: 999px; padding: 4px 8px; }
.be-sweep__winner--osvc { background: rgba(249,115,22,.1); color: var(--orange-600); }
.be-sweep__winner--sro { background: rgba(112,71,176,.12); color: var(--purple-700); }
.be-sweep__winner--tie { background: var(--neutral-100); color: var(--text-dark-dim); }
.be-sweep__metric { margin-top: 8px; }
.be-sweep__metric-head { display: flex; justify-content: space-between; gap: 10px; font-size: .76rem; color: var(--text-dark-dim); margin-bottom: 5px; }
.be-sweep__track { height: 10px; background: var(--neutral-100); border-radius: 999px; overflow: hidden; }
.be-sweep__fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.be-sweep__fill--osvc { background: linear-gradient(90deg, var(--orange-400), var(--orange-500)); }
.be-sweep__fill--sro { background: linear-gradient(90deg, var(--purple-500), var(--purple-700)); }

.be-switch { margin-top: 14px; }
.be-switch__labels { display: flex; justify-content: space-between; gap: 16px; font-size: .74rem; color: var(--text-dark-dim); margin-bottom: 8px; }
.be-switch__track { position: relative; height: 54px; border-radius: 14px; overflow: hidden; border: 1px solid var(--ivory-mid); background: var(--neutral-50); }
.be-switch__zone { position: absolute; top: 0; bottom: 0; }
.be-switch__zone--before { left: 0; background: linear-gradient(90deg, rgba(249,115,22,.14), rgba(249,115,22,.06)); }
.be-switch__zone--after { background: linear-gradient(90deg, rgba(112,71,176,.08), rgba(112,71,176,.16)); }
.be-switch__marker { position: absolute; top: 8px; transform: translateX(-50%); text-align: center; z-index: 2; }
.be-switch__marker::before { content: ''; display: block; width: 12px; height: 12px; border-radius: 50%; margin: 0 auto 6px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.be-switch__marker span { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: .68rem; font-weight: 700; background: rgba(255,255,255,.92); color: var(--text-dark); white-space: nowrap; }
.be-switch__marker--switch::before { background: var(--orange-500); }
.be-switch__marker--current::before { background: var(--purple-700); }
.be-switch__meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: .74rem; color: var(--text-dark-dim); }

/* ── Responsive ── */
/* ── Calculation History ── */
.tool-history { margin: 20px 0; border: 1px solid var(--neutral-200); border-radius: 10px; overflow: hidden; }
.tool-history__head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--neutral-50); border-bottom: 1px solid var(--neutral-200); }
.tool-history__title { font-size: .82rem; font-weight: 600; color: var(--text-dark); }
.tool-history__clear { font-size: .72rem; color: var(--neutral-400); background: none; border: none; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.tool-history__clear:hover { color: var(--text-dark); background: var(--neutral-100); }
.tool-history__list { max-height: 280px; overflow-y: auto; }
.tool-history__item { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; width: 100%; padding: 10px 14px; border: none; border-bottom: 1px solid var(--neutral-100); background: #fff; cursor: pointer; text-align: left; font-family: var(--font-sans); font-size: .82rem; transition: background .15s; }
.tool-history__item:hover { background: var(--purple-50); }
.tool-history__item:last-child { border-bottom: none; }
.tool-history__label { color: var(--text-dark); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-history__value { color: var(--orange-600); font-weight: 700; font-size: .85rem; }
.tool-history__date { color: var(--neutral-400); font-size: .7rem; white-space: nowrap; }

/* ── FAQ Accordion (Helpful Content / SEO) ── */
.tool-faq { margin: 24px 0; }
.tool-faq__title { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700; color: var(--purple-900); margin-bottom: 12px; }
.tool-faq__item { border: 1px solid var(--neutral-200); border-radius: 8px; margin-bottom: 6px; overflow: hidden; }
.tool-faq__item[open] { border-color: var(--purple-300); }
.tool-faq__q { padding: 12px 14px; font-size: .88rem; font-weight: 600; color: var(--text-dark); cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.tool-faq__q::before { content: '+'; font-size: 1.1rem; font-weight: 700; color: var(--purple-500); flex-shrink: 0; width: 18px; text-align: center; transition: transform .2s; }
.tool-faq__item[open] .tool-faq__q::before { content: '\2212'; }
.tool-faq__q::-webkit-details-marker { display: none; }
.tool-faq__a { padding: 0 14px 14px; font-size: .84rem; line-height: 1.6; color: var(--neutral-700); }

/* ── E-E-A-T Stamp ── */
.tool-eeat { display: flex; align-items: center; gap: 8px; padding: 10px 14px; margin: 16px 0; border-radius: 8px; background: var(--purple-50); border: 1px solid rgba(112,71,176,.1); font-size: .78rem; color: var(--purple-800); }
.tool-eeat__icon { font-size: 1.1rem; }

/* ── Excel Export Button (Pro tier) ── */
.xls-btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; max-width: 380px; padding: 12px 24px; background: linear-gradient(135deg, #F59E0B, #D97706); color: #fff; border: 2px solid #B45309; border-radius: 10px; box-shadow: 0 2px 8px rgba(217,119,6,.3); font-family: var(--font-sans); font-size: .88rem; font-weight: 700; cursor: pointer; transition: all .15s; }
.xls-btn:hover { background: linear-gradient(135deg, #D97706, #B45309); transform: translateY(-2px); box-shadow: 0 4px 14px rgba(217,119,6,.4); }
.xls-btn:disabled { opacity: .5; cursor: wait; transform: none; }
.xls-btn svg { vertical-align: middle; margin-right: 6px; flex-shrink: 0; }
.xls-hint { margin: 6px 0 0; font-size: .74rem; color: var(--neutral-400); }

@media (max-width: 600px) {
  .tool-cmp__grid { grid-template-columns: 1fr !important; }
  .tool-tl__track { height: 100px; }
  .tool-tl__label { font-size: .64rem; max-width: 60px; }
  .tool-next__item { padding: 10px 12px; font-size: .8rem; }
  .tool-history__item { grid-template-columns: 1fr auto; }
  .tool-history__date { display: none; }
  .be-signal-grid { grid-template-columns: 1fr; }
  .be-signal__meta, .be-switch__labels, .be-switch__meta, .be-sweep__head { flex-direction: column; align-items: flex-start; }
  .be-switch__track { height: 62px; }
}

/* ── Auth Modal + Pro Upgrade Modal ── */
.pt-modal { position: fixed; inset: 0; z-index: 9000; display: none; align-items: center; justify-content: center; }
.pt-modal.open { display: flex; }
.pt-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(4px); }
.pt-modal__box { position: relative; background: var(--surface, #fff); border-radius: 14px; padding: clamp(20px, 3vw, 28px); max-width: 400px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.2); z-index: 1; max-height: 90vh; overflow-y: auto; }
.pt-modal__close { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--neutral-400, #999); padding: 4px; }
.pt-modal__close:hover { color: var(--text-dark, #1a1a1a); }
.pt-modal__title { font-family: var(--font-serif, Georgia, serif); font-size: 1.2rem; font-weight: 700; color: var(--text-dark, #1a1a1a); margin-bottom: 16px; text-align: center; }

/* ── Pro Badge (small, inline with buttons) ── */
.pro-badge-sm { display: inline-block; padding: 1px 6px; border-radius: 4px; background: var(--purple-900, #2D1B4E); color: var(--orange-400, #FB923C); font-size: .64rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; vertical-align: middle; margin-left: 4px; }

