/**
 * Commission Calculator - Stylesheet
 * Exact clone matching Calculator.net financial suite & reference images
 */

/* ==========================================================================
   Page Layout & Typography
   ========================================================================== */
.commission-page-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 20px 40px;
  font-family: Arial, Helvetica, sans-serif;
  color: #333333;
}

.commission-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 10px;
}

.commission-breadcrumbs {
  font-size: 13px;
  color: #006699;
}

.commission-breadcrumbs a {
  color: #006699;
  text-decoration: none;
}

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

.commission-breadcrumbs .sep {
  margin: 0 4px;
  color: #666;
}

.commission-breadcrumbs .current {
  color: #006699;
  font-weight: normal;
}

.commission-top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

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

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

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

.commission-badge {
  background: #0844a4;
  color: #ffffff;
  font-size: 10px;
  font-weight: bold;
  padding: 1px 5px;
  border-radius: 10px;
  margin-left: 3px;
}

.commission-page-title {
  font-size: 26px;
  font-weight: bold;
  color: #0844a4;
  margin: 0 0 10px 0;
}

/* ==========================================================================
   Instruction Banner
   ========================================================================== */
.instruction-banner {
  background-color: #d1e7dd;
  border-left: 4px solid #0f5132;
  color: #0f5132;
  padding: 8px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  border-radius: 2px;
}

/* ==========================================================================
   Main Grid Layout (Left Content + Right Sidebar)
   ========================================================================== */
.commission-layout-grid {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.commission-main-col {
  flex: 1;
  min-width: 0;
}

.commission-sidebar-col {
  width: 300px;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .commission-layout-grid {
    flex-direction: column;
  }
  .commission-sidebar-col {
    width: 100%;
  }
}

/* ==========================================================================
   Calculator Cards
   ========================================================================== */
.calc-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 18px 20px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.calc-card-title {
  font-size: 20px;
  font-weight: bold;
  color: #0844a4;
  margin: 0 0 6px 0;
}

.calc-card-desc {
  font-size: 13px;
  line-height: 1.5;
  color: #475569;
  margin: 0 0 16px 0;
}

.calc-inner-columns {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.calc-form-box {
  flex: 1 1 340px;
  min-width: 300px;
}

.calc-result-box {
  flex: 1 1 300px;
  min-width: 280px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 16px;
  position: relative;
}

/* ==========================================================================
   Form Tables & Inputs
   ========================================================================== */
.calc-table-form {
  width: 100%;
  border-collapse: collapse;
}

.calc-table-form td {
  padding: 6px 4px;
  font-size: 13px;
  vertical-align: middle;
}

.calc-label-cell {
  width: 140px;
  color: #1e293b;
  font-weight: normal;
}

.calc-label-cell .tip-icon {
  display: inline-block;
  cursor: help;
  color: #64748b;
  font-size: 12px;
  font-weight: bold;
  margin-left: 3px;
}

.calc-input-wrapper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #94a3b8;
  border-radius: 2px;
  background: #ffffff;
  padding: 2px 6px;
  width: 150px;
}

.calc-input-wrapper:focus-within {
  border-color: #0844a4;
  box-shadow: 0 0 0 1px #0844a4;
}

.calc-prefix, .calc-suffix {
  font-size: 13px;
  color: #475569;
  user-select: none;
}

.calc-prefix {
  margin-right: 4px;
}

.calc-suffix {
  margin-left: 4px;
}

.calc-input {
  border: none;
  outline: none;
  font-size: 13px;
  color: #0f172a;
  width: 100%;
  background: transparent;
  padding: 2px 0;
}

.calc-input-full {
  width: 130px;
}

.calc-radio-group {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}

.calc-radio-group label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.calc-button-row {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-calculate {
  background-color: #5b8f22;
  color: #ffffff;
  font-size: 13px;
  font-weight: bold;
  border: 1px solid #4a751c;
  border-radius: 3px;
  padding: 6px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s ease;
}

.btn-calculate:hover {
  background-color: #4c771d;
}

.play-icon {
  font-size: 10px;
}

.btn-clear {
  background-color: #888888;
  color: #ffffff;
  font-size: 13px;
  border: 1px solid #777777;
  border-radius: 3px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-clear:hover {
  background-color: #666666;
}

/* ==========================================================================
   Tiered Table Form
   ========================================================================== */
.tiered-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  margin-bottom: 12px;
}

.tiered-table th {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: bold;
  color: #334155;
  text-align: left;
}

.tiered-table td {
  border: 1px solid #e2e8f0;
  padding: 4px 8px;
  vertical-align: middle;
}

.tier-cell-input {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  padding: 2px 4px;
  border-radius: 2px;
  width: 100px;
}

.tier-cell-input input {
  border: none;
  outline: none;
  font-size: 12px;
  width: 100%;
  padding: 1px 0;
}

.tier-comm-input-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tier-comm-input-group .tier-cell-input {
  width: 65px;
}

.tier-unit-select {
  border: 1px solid #cbd5e1;
  border-radius: 2px;
  font-size: 12px;
  padding: 2px 4px;
  background: #ffffff;
  color: #334155;
  outline: none;
}

/* ==========================================================================
   Results Display Box
   ========================================================================== */
.result-header {
  font-size: 16px;
  font-weight: bold;
  color: #0844a4;
  margin: 0 0 10px 0;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.save-scenario-icon {
  cursor: pointer;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid transparent;
}

.save-scenario-icon:hover {
  background: #e2e8f0;
  color: #0844a4;
  border-color: #cbd5e1;
}

.result-main-value {
  font-size: 26px;
  font-weight: bold;
  color: #2e7d32;
  margin-bottom: 8px;
}

.result-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dashed #e2e8f0;
}

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

.result-stat-val {
  font-weight: bold;
  color: #0f172a;
}

/* Co-agent split table */
.split-scenarios-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 12px;
}

.split-scenarios-table th {
  background: #e2e8f0;
  padding: 4px 6px;
  text-align: left;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.split-scenarios-table td {
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  color: #1e293b;
}

/* ==========================================================================
   Charts & Graphs
   ========================================================================== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 14px;
}

.chart-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 14px;
}

.chart-title {
  font-size: 14px;
  font-weight: bold;
  color: #0844a4;
  margin-bottom: 10px;
  text-align: center;
}

.chart-svg-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* ==========================================================================
   Fraction Arithmetic Solver Box
   ========================================================================== */
.fraction-box-container {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 16px;
  margin-top: 14px;
}

.fraction-formula-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 16px 0;
}

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

.fraction-input-block input {
  width: 54px;
  text-align: center;
  padding: 4px 0;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  font-size: 14px;
  font-weight: bold;
}

.fraction-bar-divider {
  width: 58px;
  height: 2px;
  background: #334155;
  margin: 5px 0;
}

.fraction-op-select {
  padding: 5px 8px;
  font-size: 16px;
  font-weight: bold;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  background: #ffffff;
  color: #0844a4;
  cursor: pointer;
}

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

.fraction-result-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  padding: 8px 16px;
}

.fraction-res-vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 15px;
  font-weight: bold;
  color: #0844a4;
}

.fraction-res-bar {
  width: 44px;
  height: 2px;
  background: #0844a4;
  margin: 3px 0;
}

.fraction-res-decimal {
  font-size: 14px;
  color: #475569;
}

/* ==========================================================================
   Sidebar: Search & Financial Calculators Card
   ========================================================================== */
.sidebar-search-box {
  margin-bottom: 16px;
  position: relative;
}

.sidebar-search-form {
  display: flex;
  width: 100%;
}

.sidebar-search-input {
  flex: 1;
  border: 1px solid #94a3b8;
  border-right: none;
  border-radius: 3px 0 0 3px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
}

.sidebar-search-input:focus {
  border-color: #0844a4;
}

.sidebar-search-btn {
  background: #2b5a8f;
  color: #ffffff;
  border: 1px solid #2b5a8f;
  border-radius: 0 3px 3px 0;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sidebar-search-btn:hover {
  background: #1e3f66;
}

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

.sidebar-card {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
  background: #ffffff;
}

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

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

.sidebar-links-grid a {
  color: #006699;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.sidebar-more-link {
  grid-column: span 2;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #f1f5f9;
}

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

.sidebar-footer-nav a {
  color: #006699;
  text-decoration: none;
}

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

/* ==========================================================================
   Educational / SEO Article Section
   ========================================================================== */
.commission-article-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 24px 26px;
  margin-top: 24px;
  font-size: 14px;
  line-height: 1.65;
  color: #334155;
}

.commission-article-section h2 {
  font-size: 20px;
  color: #0844a4;
  margin: 20px 0 10px 0;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 6px;
}

.commission-article-section h2:first-of-type {
  margin-top: 0;
}

.commission-article-section h3 {
  font-size: 16px;
  color: #1e293b;
  margin: 16px 0 6px 0;
}

.commission-article-section p {
  margin: 0 0 12px 0;
}

.formula-box {
  background: #f8fafc;
  border-left: 4px solid #0844a4;
  padding: 10px 16px;
  margin: 14px 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  font-weight: bold;
  color: #0f172a;
}

.faq-card {
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: #fafafa;
}

.faq-question {
  font-weight: bold;
  color: #0844a4;
  font-size: 14px;
  margin-bottom: 6px;
}

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

/* ==========================================================================
   Modals
   ========================================================================== */
.commission-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 20px;
}

.commission-modal-box {
  background: #ffffff;
  border-radius: 6px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 25px -5px 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); }
}

.commission-modal-header {
  background: #f8fafc;
  border-bottom: 1px solid #cbd5e1;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: bold;
  color: #0844a4;
}

.commission-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 0;
}

.commission-modal-close:hover {
  color: #0f172a;
}

.commission-modal-body {
  padding: 18px;
}

/* Instant Tool Modal Styles (Matches image 1) */
.instant-input-group {
  margin-bottom: 14px;
}

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

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

.instant-input-field:focus {
  border-color: #0844a4;
  box-shadow: 0 0 0 1px #0844a4;
}

.btn-instant-compute {
  width: 100%;
  background-color: #255285;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 10px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 6px;
  margin-bottom: 14px;
  transition: background-color 0.15s ease;
}

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

.instant-results-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 4px;
  padding: 12px;
  display: none;
}

/* ==========================================================================
   Print Stylesheet
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .site-header,
  .site-footer,
  .commission-top-actions,
  .instruction-banner,
  .commission-sidebar-col,
  .btn-calculate,
  .btn-clear,
  .commission-modal-backdrop {
    display: none !important;
  }
  .commission-page-container {
    max-width: 100% !important;
    padding: 0 !important;
  }
  .calc-card, .chart-card {
    border: 1px solid #000000 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
}

/* ==========================================================================
   RTL Styles for Arabic
   ========================================================================== */
[dir="rtl"] {
  text-align: right;
}
[dir="rtl"] .instruction-banner {
  border-left: none;
  border-right: 4px solid #0f5132;
}
[dir="rtl"] .calc-prefix {
  margin-right: 0;
  margin-left: 4px;
}
[dir="rtl"] .calc-suffix {
  margin-left: 0;
  margin-right: 4px;
}
[dir="rtl"] .formula-box {
  border-left: none;
  border-right: 4px solid #0844a4;
}
[dir="rtl"] .sidebar-search-input {
  border-right: 1px solid #94a3b8;
  border-left: none;
  border-radius: 0 3px 3px 0;
}
[dir="rtl"] .sidebar-search-btn {
  border-radius: 3px 0 0 3px;
}
