/* finance.css - Stylesheet for Finance Calculator (TVM 5-Key Clone) */

:root {
  --fc-navy-dark: #244a75;
  --fc-navy-med: #3568a0;
  --fc-navy-hover: #1e3d62;
  --fc-green-btn: #5b8f22;
  --fc-green-btn-hover: #4d7a1c;
  --fc-green-hdr: #467928;
  --fc-green-bg: #eef6e8;
  --fc-gray-btn: #888888;
  --fc-gray-btn-hover: #777777;
  --fc-border: #cbd5e1;
  --fc-input-border: #94a3b8;
  --fc-text-dark: #1e293b;
  --fc-text-muted: #475569;
  --fc-link-blue: #0844a4;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fc-text-dark);
  background-color: #f1f5f9;
  line-height: 1.5;
}

.finance-page-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px 20px 48px;
}

/* Top bar */
.finance-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.finance-breadcrumbs {
  font-size: 13px;
  color: #64748b;
}

.finance-breadcrumbs a {
  color: var(--fc-link-blue);
  text-decoration: none;
}

.finance-breadcrumbs a:hover {
  text-decoration: underline;
}

.finance-breadcrumbs .sep {
  margin: 0 5px;
  color: #94a3b8;
}

.finance-breadcrumbs .current {
  color: #334155;
  font-weight: 500;
}

.finance-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-print-link {
  color: var(--fc-link-blue);
  text-decoration: underline;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.top-print-link:hover {
  color: #052c6e;
}

.finance-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.finance-top-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.finance-top-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.finance-badge {
  background: #2563eb;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
}

/* Page title and intro */
.finance-page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--fc-link-blue);
  margin: 0 0 10px 0;
}

.finance-intro-desc {
  font-size: 13.5px;
  color: #334155;
  line-height: 1.6;
  margin: 0 0 20px 0;
  max-width: 820px;
}

/* Main 2-column layout */
.finance-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: start;
}

.finance-main-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.finance-sidebar-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* TVM Tabs */
.tvm-tabs-wrapper {
  display: flex;
  gap: 3px;
  margin-bottom: 0;
}

.tvm-tab-btn {
  background: var(--fc-navy-med);
  color: #ffffff;
  border: none;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  transition: background 0.15s ease;
  letter-spacing: 0.5px;
}

.tvm-tab-btn:hover {
  background: #2a5585;
}

.tvm-tab-btn.active {
  background: var(--fc-navy-dark);
  box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
}

/* TVM Calculator Card Container */
.tvm-calc-container {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  background: #ffffff;
  border: 1px solid #c2d1df;
  padding: 16px;
  border-radius: 0 4px 4px 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* Left Form Box */
.tvm-form-box {
  background: #f8fafc;
  border: 1px solid #d8e2eb;
  padding: 14px;
  border-radius: 4px;
}

.tvm-input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
}

.tvm-label {
  font-size: 12.5px;
  color: #1e293b;
  font-weight: 500;
  flex: 1;
}

.tvm-input-wrap {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--fc-input-border);
  border-radius: 3px;
  padding: 3px 6px;
  width: 120px;
}

.tvm-input-wrap:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb;
}

.tvm-input-prefix, .tvm-input-suffix {
  font-size: 12px;
  color: #64748b;
  user-select: none;
}

.tvm-input-prefix {
  margin-right: 4px;
}

.tvm-input-suffix {
  margin-left: 4px;
}

.tvm-input-field {
  width: 100%;
  border: none;
  outline: none;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  background: transparent;
  text-align: left;
}

/* Settings Toggle */
.tvm-settings-toggle {
  display: inline-block;
  color: var(--fc-link-blue);
  font-size: 12.5px;
  text-decoration: underline;
  cursor: pointer;
  margin: 6px 0 12px 0;
  font-weight: 600;
}

.tvm-settings-drawer {
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 12px;
  display: none;
}

.tvm-settings-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 12px;
}

.tvm-settings-row:last-child {
  margin-bottom: 0;
}

.tvm-select {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #ffffff;
  color: #1e293b;
}

/* Button Row */
.tvm-btn-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn-calc {
  background: var(--fc-green-btn);
  color: #ffffff;
  border: 1px solid #4a7719;
  border-radius: 3px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-calc:hover {
  background: var(--fc-green-btn-hover);
}

.btn-clear {
  background: var(--fc-gray-btn);
  color: #ffffff;
  border: 1px solid #6b7280;
  border-radius: 3px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-clear:hover {
  background: var(--fc-gray-btn-hover);
}

/* Results Box */
.tvm-results-box {
  display: flex;
  flex-direction: column;
}

.tvm-results-header {
  background: var(--fc-green-hdr);
  color: #ffffff;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 14px;
  border-radius: 4px 4px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.save-scenario-btn {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  padding: 0;
  opacity: 0.9;
}

.save-scenario-btn:hover {
  opacity: 1;
}

.tvm-results-body {
  background: #ffffff;
  border: 1px solid #d1e7be;
  border-top: none;
  padding: 16px;
  border-radius: 0 0 4px 4px;
}

.tvm-primary-result {
  font-size: 20px;
  font-weight: 700;
  color: #2e6815;
  margin-bottom: 12px;
}

.tvm-stat-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px dotted #e2e8f0;
}

.tvm-stat-line:last-child {
  border-bottom: none;
}

.tvm-stat-label {
  color: #475569;
}

.tvm-stat-val {
  font-weight: 600;
  color: #0f172a;
}

/* Chart Container */
.chart-container-card {
  background: #ffffff;
  border: 1px solid #c2d1df;
  border-radius: 4px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.chart-header-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
  margin-bottom: 12px;
}

.chart-svg-wrapper {
  position: relative;
  width: 100%;
  overflow-x: auto;
}

/* Schedule Table */
.schedule-card {
  background: #ffffff;
  border: 1px solid #c2d1df;
  border-radius: 4px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.schedule-header-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--fc-link-blue);
  margin: 0 0 14px 0;
}

.schedule-table-wrap {
  overflow-x: auto;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.schedule-table th {
  background: var(--fc-navy-dark);
  color: #ffffff;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--fc-navy-dark);
}

.schedule-table td {
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  color: #1e293b;
}

.schedule-table tr:nth-child(even) td {
  background: #f8fafc;
}

.schedule-table tr:hover td {
  background: #f1f5f9;
}

/* Fraction Arithmetic Section */
.fraction-card {
  background: #ffffff;
  border: 1px solid #c2d1df;
  border-radius: 4px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.fraction-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px 0;
}

.fraction-desc {
  font-size: 13px;
  color: #475569;
  margin: 0 0 16px 0;
}

.fraction-formula-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  flex-wrap: wrap;
}

.fraction-input-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 65px;
}

.fraction-input-block input {
  width: 100%;
  text-align: center;
  padding: 5px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
}

.fraction-bar-divider {
  width: 100%;
  height: 2px;
  background: #334155;
  margin: 4px 0;
}

.fraction-op-select {
  padding: 6px 10px;
  font-size: 16px;
  font-weight: 700;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
}

.fraction-equals-symbol {
  font-size: 20px;
  font-weight: 700;
  color: #334155;
}

.fraction-result-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 2px solid #2563eb;
  padding: 6px 14px;
  border-radius: 6px;
}

.fraction-res-vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 800;
  font-size: 15px;
  color: #1e3a8a;
  min-width: 30px;
}

.fraction-res-bar {
  width: 100%;
  height: 2px;
  background: #1e3a8a;
  margin: 2px 0;
}

.fraction-res-decimal {
  font-size: 14px;
  font-weight: 700;
  color: #059669;
}

/* Fraction Visualizations */
.fraction-vis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.fraction-vis-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px;
  text-align: center;
}

.fraction-vis-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

/* Educational SEO Section */
.finance-article-section {
  background: #ffffff;
  border: 1px solid #c2d1df;
  border-radius: 4px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.finance-article-section h2 {
  font-size: 20px;
  color: #0f172a;
  margin: 20px 0 10px 0;
  font-weight: 700;
}

.finance-article-section h2:first-child {
  margin-top: 0;
}

.finance-article-section h3 {
  font-size: 16px;
  color: var(--fc-link-blue);
  margin: 16px 0 8px 0;
}

.finance-article-section p {
  font-size: 13.5px;
  color: #334155;
  line-height: 1.65;
  margin: 0 0 12px 0;
}

.finance-article-section ul {
  font-size: 13.5px;
  color: #334155;
  line-height: 1.65;
  margin: 0 0 16px 0;
  padding-left: 20px;
}

.finance-formula-callout {
  background: #f1f5f9;
  border-left: 4px solid var(--fc-navy-med);
  padding: 12px 16px;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  color: #0f172a;
  margin: 14px 0;
  border-radius: 0 4px 4px 0;
}

.faq-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 12px;
}

.faq-q {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.faq-a {
  font-size: 13px;
  color: #475569;
  line-height: 1.6;
}

/* Sidebar Styles */
.sidebar-search-box {
  position: relative;
}

.sidebar-search-form {
  display: flex;
  gap: 4px;
}

.sidebar-search-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid #0844a4;
  border-radius: 3px;
  outline: none;
  background: #ffffff;
}

.sidebar-search-btn {
  background: #0844a4;
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 3px;
  cursor: pointer;
}

.sidebar-search-btn:hover {
  background: #052c6e;
}

.sidebar-dropdown-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-top: 4px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.sidebar-dropdown-item {
  padding: 8px 12px;
  font-size: 12.5px;
  color: #1e293b;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  display: block;
  text-decoration: none;
}

.sidebar-dropdown-item:hover {
  background: #f1f5f9;
  color: #0844a4;
}

/* Financial Calculators Card */
.sidebar-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.sidebar-card-header {
  background: #2b5a8f;
  color: #ffffff;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13.5px;
}

.sidebar-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 10px 12px;
  gap: 4px 12px;
  font-size: 12px;
}

.sidebar-links-grid a {
  color: var(--fc-link-blue);
  text-decoration: none;
  padding: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-links-grid a:hover {
  text-decoration: underline;
}

.sidebar-more-link {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
}

.sidebar-footer-nav {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 8px 12px;
  font-size: 11px;
  color: #64748b;
  text-align: center;
}

.sidebar-footer-nav a {
  color: var(--fc-link-blue);
  text-decoration: none;
}

.sidebar-footer-nav a:hover {
  text-decoration: underline;
}

/* Modals */
.finance-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.finance-modal-box {
  background: #ffffff;
  border-radius: 6px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.finance-modal-header {
  background: var(--fc-navy-dark);
  color: #ffffff;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.finance-modal-close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.finance-modal-body {
  padding: 20px 22px;
}

.instant-input-group {
  margin-bottom: 14px;
}

.instant-input-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 6px;
}

.instant-input-field {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  color: #0f172a;
}

.instant-input-field:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb;
}

.btn-instant-compute {
  background: #2b5a8f;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s ease;
}

.btn-instant-compute:hover {
  background: #1e3d62;
}

.instant-results-box {
  margin-top: 16px;
  background: #f1f8ed;
  border: 1px solid #c2e0b3;
  padding: 12px 14px;
  border-radius: 4px;
  display: none;
}

/* Print Overrides */
@media print {
  .site-header, .finance-top-actions, .finance-sidebar-col, .site-footer, .tvm-btn-row, .top-print-link, #btn_frac_calculate {
    display: none !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .finance-page-container {
    max-width: 100% !important;
    padding: 0 !important;
  }
  .finance-layout-grid {
    grid-template-columns: 1fr !important;
  }
  .tvm-calc-container, .chart-container-card, .schedule-card, .fraction-card, .finance-article-section {
    box-shadow: none !important;
    border: 1px solid #666 !important;
    page-break-inside: avoid;
  }
}

/* Mobile Responsive */
@media (max-width: 860px) {
  .finance-layout-grid {
    grid-template-columns: 1fr;
  }
  .tvm-calc-container {
    grid-template-columns: 1fr;
  }
}
