/* ==========================================================================
   SolopreneurToolkit - Tool & Calculator Specific Stylesheet
   Responsive dual-panel layouts, sliders, stat cards, visual bars, print styles
   ========================================================================== */

/* Tool Layout Container */
.tool-page-wrapper {
  padding: 2.5rem 0 4rem;
}

.tool-header-block {
  margin-bottom: 2.5rem;
}

.tool-header-block .badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.75rem;
}

.tool-header-title {
  font-size: clamp(1.85rem, 3.5vw, 2.75rem);
  font-weight: 800;
  color: var(--secondary);
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
}

.tool-header-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 780px;
  line-height: 1.6;
}

/* 2-Column Calculator Grid */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 992px) {
  .calc-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

/* Left Panel: Inputs Card */
.calc-card-inputs {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.calc-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.calc-presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.btn-preset {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-preset:hover, .btn-preset.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Input Fields with Currency or Percent Prefixes */
.input-with-affix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-affix {
  position: absolute;
  left: 1rem;
  font-weight: 600;
  color: var(--text-subtle);
  pointer-events: none;
  font-size: 0.95rem;
}

.input-affix-right {
  position: absolute;
  right: 1rem;
  font-weight: 600;
  color: var(--text-subtle);
  pointer-events: none;
  font-size: 0.95rem;
}

.calc-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.calc-input.has-prefix {
  padding-left: 2.25rem;
}

.calc-input.has-suffix {
  padding-right: 2.25rem;
}

.calc-input:focus {
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-glow);
  outline: none;
}

.input-help {
  font-size: 0.8rem;
  color: var(--text-subtle);
  margin-top: 0.35rem;
  display: block;
}

/* Range Slider Sync */
.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.range-slider {
  flex-grow: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #cbd5e1;
  border-radius: 3px;
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* Right Panel: Results Card */
.calc-card-results {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 5.5rem;
}

.results-hero-stat {
  text-align: center;
  padding: 1.5rem;
  background: linear-gradient(145deg, #eff6ff, #f8fafc);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.results-hero-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1e40af;
  margin-bottom: 0.4rem;
}

.results-hero-value {
  font-size: clamp(2.2rem, 5vw, 3.25rem);
  font-weight: 800;
  color: #1e3a8a;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.results-hero-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.results-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.925rem;
}

.results-breakdown-table tr {
  border-bottom: 1px solid var(--border-color);
}

.results-breakdown-table tr:last-child {
  border-bottom: none;
}

.results-breakdown-table td {
  padding: 0.75rem 0;
  color: var(--text-muted);
}

.results-breakdown-table td.val {
  text-align: right;
  font-weight: 700;
  color: var(--secondary);
}

.results-breakdown-table tr.highlight td {
  font-weight: 700;
  color: var(--secondary);
  font-size: 1rem;
  border-top: 2px solid var(--border-color);
}

/* Visual Distribution Bar */
.visual-bar-container {
  margin: 1.5rem 0;
}

.visual-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.visual-bar-track {
  height: 12px;
  width: 100%;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  display: flex;
  overflow: hidden;
}

.visual-segment {
  height: 100%;
  transition: width var(--transition-normal);
}

.seg-takehome { background: var(--accent-emerald); }
.seg-taxes { background: var(--accent-amber); }
.seg-expenses { background: var(--primary); }
.seg-savings { background: var(--accent-purple); }

.visual-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.65rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Actions Row (Copy, Export, Reset) */
.calc-actions-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-action-primary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-action-primary:hover {
  background: var(--primary-hover);
}

.btn-action-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-action-secondary:hover {
  background: #e2e8f0;
  color: var(--secondary);
}

/* Tool Guide & Editorial Section */
.tool-guide-section {
  margin-top: 4rem;
  border-top: 1px solid var(--border-color);
  padding-top: 3rem;
  max-width: 860px;
}

.tool-guide-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 1.25rem;
}

.tool-guide-body {
  font-size: 1rem;
  line-height: 1.7;
  color: #334155;
}

.tool-guide-body h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--secondary);
  margin: 2rem 0 0.75rem;
}

.tool-guide-body p {
  margin-bottom: 1.25rem;
}

.formula-box {
  background: #1e293b;
  color: #f8fafc;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  line-height: 1.5;
}

/* FAQ Accordion */
.faq-accordion {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  padding: 1rem 1.25rem;
  background: none;
  border: none;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  color: var(--secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  gap: 1rem;
}

.faq-question:hover {
  color: var(--primary);
}

.faq-chevron {
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.925rem;
  line-height: 1.6;
  display: none;
}

.faq-item.open .faq-answer {
  display: block;
}

/* ==========================================================================
   Specialized Styles: Invoice Generator & Live Sheet
   ========================================================================== */
.invoice-sheet-container {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  color: #1e293b;
  position: relative;
}

.invoice-header-row {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.invoice-meta-box {
  text-align: right;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
}

.invoice-table th {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  padding: 0.75rem 0.5rem;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.invoice-table td {
  border-bottom: 1px solid #f1f5f9;
  padding: 0.75rem 0.5rem;
  vertical-align: top;
}

.invoice-summary-box {
  margin-left: auto;
  max-width: 320px;
}

/* Print Stylesheet for Invoices */
@media print {
  body {
    background: white !important;
    color: black !important;
  }

  .site-header,
  .site-footer,
  .breadcrumbs,
  .calc-card-inputs,
  .tool-guide-section,
  .ad-slot-container,
  .affiliate-recommendation-card,
  .no-print,
  .calc-actions-row,
  .toast-notice {
    display: none !important;
  }

  .calc-grid {
    display: block !important;
  }

  .invoice-sheet-container {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  .tool-page-wrapper {
    padding: 0 !important;
  }
}
