:root {
  --primary-dark-spruce: #234326;
  --secondary-honeydew: #F1FFF5;
  --beige: #F5F5DC;
  --grey: #D3D3D3;
  --slate-grey: #6B7280;
  --onyx-headings: #141414;
  --carbon-body-text: #1F1F1F;
  --indigo-cta: #6A0DAD;
  --carbon-overlay: #262626;
}

/* removed body margin for WP */

table { 
  width: 100%; 
  border-collapse: collapse; 
  margin-top: 10px;
}

th, td { 
  border: 1px solid var(--grey); 
  padding: 6px; 
  text-align: center;
}

th { 
  background: var(--secondary-honeydew); 
  color: var(--onyx-headings);
  font-weight: bold;
}

input[type="text"], 
input[type="number"], 
input[type="date"], 
select { 
  padding: 4px; 
  border: 1px solid var(--grey);
  box-sizing: border-box;
  color: var(--carbon-body-text);
  background: white;
}

.calculate-btn { 
  background-color: var(--primary-dark-spruce);
  color: white;
  border: 1px solid var(--primary-dark-spruce);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.clear-btn {
  background-color: var(--slate-grey);
  color: white;
  border: 1px solid var(--slate-grey);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.amort-btn {
  background-color: var(--onyx-headings);
  color: white;
  border: 1px solid var(--carbon-overlay);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.add-payment-btn {
  background-color: var(--primary-dark-spruce);
  color: white;
  border: 1px solid var(--primary-dark-spruce);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  margin-top: 13px;
}

.add-payment-btn::before {
  content: "+";
  color: white;
  margin-right: 4px;
  font-weight: bold;
}

.recalc { 
  background-color: #ff9800;
  color: white; 
  font-weight: bold; 
  font-size: 1em; 
  display: none;
  padding: 6px 12px;
  border: 2px solid #e68900;
  border-radius: 4px;
  margin-left: 4px;
  cursor: pointer;
  transition: all 0.3s;
  align-items: center;
  gap: 6px;
}

.recalc:hover {
  background-color: #e68900;
  transform: scale(1.05);
}

.top-controls-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.top-controls-row > div {
  display: flex;
  align-items: center;
  gap: 5px;
}

.rates-section {
  display: inline-block;
  position: relative;
}

.chevron { 
  cursor: pointer; 
  color: var(--indigo-cta); 
  font-weight: bold; 
  padding: 4px 8px;
  border-radius: 3px;
  display: inline-block;
  white-space: nowrap;
  margin-left: 0;
}

.chevron:hover {
  background-color: rgba(106, 13, 173, 0.1);
}

.chevron-content { 
  display: none; 
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 5px;
  padding: 8px;
  background-color: var(--beige);
  color: var(--carbon-body-text);
  z-index: 100;
  min-width: 200px;
  white-space: nowrap;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  border: 1px solid var(--grey);
  border-radius: 4px;
}

.chevron-content div {
  margin: 3px 0;
  font-size: 0.9em;
}

.chevron-content p {
  margin: 5px 0;
  font-size: 0.9em;
  white-space: normal;
  max-width: 400px;
}

.chevron-content strong {
  display: inline;
  margin-bottom: 0;
}

/* Rates dropdown - fit content to match padding of other dropdowns */
#chevronContent {
  min-width: auto;
  width: fit-content;
}

.coa-input { 
  width: 50px; 
  background: var(--grey) !important;
  color: var(--carbon-body-text);
  border: 1px solid #B0B0B0 !important;
  pointer-events: none;
  text-align: center;
  -moz-appearance: textfield;
} 

.coa-input.editable {
  background: white !important; 
  color: var(--carbon-body-text);
  pointer-events: auto;
  border: 1px solid var(--grey) !important;
}

.coa-input::-webkit-outer-spin-button,
.coa-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.periods-input { 
  width: 60px; 
  background: var(--grey); 
  border: 1px solid #B0B0B0; 
  pointer-events: none; 
  color: var(--carbon-body-text);
}

.periods-input:not([disabled]) {
  background: white;
  pointer-events: auto;
  border: 1px solid var(--grey);
}

.num-payments-input { 
  width: 56px; 
  border: 1px solid var(--grey); 
}

.amount-input { 
  width: 150px; 
  border: 1px solid var(--grey); 
}

.purchase-price { 
  width: 150px; 
  font-size: 1em; 
  border: 1px solid var(--grey); 
}

.aggregate-field {
  width: 150px;
  font-size: 1em;
  border: 1px solid var(--grey);
  background-color: #f0f0f0;
  color: var(--carbon-body-text);
  cursor: text;
}

#nomRate { 
  width: 70px; 
  border: 1px solid var(--grey); 
}

#valDate { 
  border: 1px solid var(--grey); 
}

.flash {
  background-color: #fff59d !important;
  transition: background-color 1s ease;
}

.delete-btn { 
  cursor: pointer; 
  color: #999999;
  font-size: 1.1em; 
  background: none; 
  border: none; 
  padding: 2px 6px;
}

.delete-btn:hover {
  background-color: rgba(153, 153, 153, 0.1);
  border-radius: 3px;
}

.colaPopup {
  background: #fff59d;
  border: 1px solid var(--slate-grey);
  padding: 6px;
  font-size: 0.9em;
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 3px;
}

.reset-cola-btn {
  font-size: 0.8em;
  padding: 4px 8px;
  margin-left: 4px;
  background-color: var(--slate-grey);
  color: white;
  border: none;
  border-radius: 2px;
  cursor: pointer;
}

.reset-cola-btn:hover {
  background-color: #5a6268;
}

.amortization-container {
  margin-top: 20px;
  border-top: 2px solid var(--grey);
  padding-top: 10px;
  display: none;
}

.amortization-container h3 {
  margin-bottom: 10px;
  color: var(--onyx-headings);
}

.amortization-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 5px;
  font-size: 0.9em;
}

.amortization-table th, 
.amortization-table td {
  border: 1px solid var(--grey);
  padding: 4px;
  text-align: right;
  color: var(--carbon-body-text);
}

.amortization-table th {
  background: var(--secondary-honeydew);
  text-align: center;
  color: var(--onyx-headings);
  font-weight: bold;
}

.amortization-table .date-col {
  text-align: center;
  min-width: 90px;
}

.amortization-table .line-num-col {
  text-align: center;
  min-width: 30px;
  font-weight: bold;
}

.year-band {
  background-color: rgba(245, 245, 220, 0.3);
}

.year-separator {
  height: 10px;
  background-color: var(--grey);
}

.year-total-row {
  background-color: var(--secondary-honeydew) !important;
  font-weight: bold;
  border-top: 2px solid var(--slate-grey) !important;
  border-bottom: 2px solid var(--slate-grey) !important;
  border-left: 2px solid var(--slate-grey) !important;
  border-right: 2px solid var(--slate-grey) !important;
}

.required-highlight {
    background-color: #fff59d !important;
    border: 2px solid #ff9800 !important;
}

select {
    padding: 4px 8px;
    border: 1px solid var(--grey);
    border-radius: 3px;
    background-color: white;
    min-width: 120px;
    color: var(--carbon-body-text);
}

.date-error {
    border: 2px solid #e74c3c !important;
    background-color: #ffe6e6 !important;
}

.error-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.error-modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 450px;
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.error-modal h3 {
    margin-top: 0;
    color: var(--primary-dark-spruce);
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-dark-spruce);
    font-size: 20px;
    margin-bottom: 15px;
}

.error-modal p {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 25px;
    color: var(--carbon-overlay);
}

.error-modal-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.error-modal-ok {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-width: 80px;
    transition: all 0.2s;
    background-color: var(--primary-dark-spruce);
    color: white;
}

.error-modal-ok:hover {
    background-color: #1a351d;
}

.powered-by {
    text-align: center;
    margin-top: 15px;
    font-size: 0.85em;
    color: var(--carbon-body-text);
}

.powered-by a {
    color: var(--indigo-cta);
    text-decoration: none;
    font-weight: 500;
}

.powered-by a:hover {
    text-decoration: underline;
}

.icon-svg {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  display: inline-block;
}


/* Mobile responsive styles */
@media screen and (max-width: 768px) {
  h2 {
    font-size: 1.3em;
  }
  
  h3 {
    font-size: 1.1em;
    margin-top: 25px;
  }
  
  .top-controls-row {
    flex-direction: column;
    gap: 10px !important;
    align-items: stretch !important;
  }
  
  .top-controls-row > div {
    width: 100%;
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px !important;
  }
  
  .top-controls-row > div > * {
    width: 100%;
  }
  
  .purchase-price,
  #nomRate,
  #valDate,
  .aggregate-field {
    width: 100% !important;
  }
  
  .top-controls-row button {
    width: 100%;
    justify-content: center;
  }
  
  .rates-section {
    margin-left: 0 !important;
    width: 100%;
  }
  
  .chevron {
    display: block;
    width: 100%;
    text-align: left;
  }
  
  .chevron-content {
    position: static;
    width: 100%;
    margin-top: 5px;
    margin-bottom: 10px;
  }
  
  /* Card layout for table on mobile */
  #cashFlowTable {
    margin-top: 25px;
  }
  
  #cashFlowTable thead {
    display: none;
  }
  
  #cashFlowTable,
  #cashFlowTable tbody,
  #cashFlowTable tr {
    display: block;
    width: 100%;
  }
  
  #cashFlowTable tr {
    margin-bottom: 15px;
    border: 2px solid var(--grey);
    border-radius: 8px;
    padding: 12px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  
  #cashFlowTable td {
    display: block;
    width: 100%;
    border: none;
    padding: 8px 0;
    text-align: left !important;
  }
  
  #cashFlowTable td * {
    text-align: left !important;
  }
  
  #cashFlowTable td:first-child {
    font-weight: bold;
    font-size: 1.1em;
    color: var(--primary-dark-spruce);
    border-bottom: 1px solid var(--grey);
    margin-bottom: 8px;
  }
  
  #cashFlowTable td:first-child::before {
    content: "Payment #";
  }
  
  #cashFlowTable td:last-child {
    text-align: center !important;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--grey);
  }
  
  #cashFlowTable td:not(:first-child):not(:last-child)::before {
    content: attr(data-label);
    font-weight: bold;
    display: inline-block;
    width: 140px;
    color: var(--onyx-headings);
  }
  
  #cashFlowTable td:nth-child(2)::before { content: "Type: "; }
  #cashFlowTable td:nth-child(3)::before { content: "Start Date: "; }
  #cashFlowTable td:nth-child(4)::before { content: "Amount: "; }
  #cashFlowTable td:nth-child(5)::before { content: "# Payments: "; }
  #cashFlowTable td:nth-child(6)::before { content: "COLA %: "; }
  #cashFlowTable td:nth-child(7)::before { content: "# of Periods: "; }
  #cashFlowTable td:nth-child(8)::before { content: "End Date: "; }
  
  .add-payment-btn {
    width: 100%;
    margin-top: 20px;
  }
  
  /* Amortization table - horizontal scroll */
  .amortization-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .amortization-table {
    min-width: 600px;
  }
}

/* Print styles */
@media print {
  .top-controls-row,
  .add-payment-btn,
  .powered-by,
  button {
    display: none !important;
  }
  
  /* Hide Delete column */
  #cashFlowTable th:last-child,
  #cashFlowTable td:last-child {
    display: none !important;
  }
  
  #cashFlowTable td,
  #cashFlowTable th {
    vertical-align: middle !important;
  }
  
  #cashFlowTable input,
  #cashFlowTable select {
    vertical-align: middle !important;
    margin: 0 !important;
  }

  
  #amortizationContainer {
    display: block !important;
  }
  
  .amortization-table {
    width: 100%;
    page-break-inside: avoid;
  }
  
  .amortization-table thead {
    background-color: var(--secondary-honeydew) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .valuation-row {
    background-color: var(--secondary-honeydew) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .year-total-row {
    background-color: var(--secondary-honeydew) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .diagonal-stripe {
    background: repeating-linear-gradient(
      45deg,
      var(--grey),
      var(--grey) 2px,
      transparent 2px,
      transparent 6px
    ) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  h2, h3 {
    page-break-after: avoid;
  }
  
  body {
    background: white;
  }
}

  /* Diagonal stripes for N/A cells */
  .diagonal-stripe {
    background: repeating-linear-gradient(
      45deg,
      var(--secondary-honeydew),
      var(--secondary-honeydew) 8px,
      #d8e8d8 8px,
      #d8e8d8 16px
    ) !important;
  }

  /* Remove first column separator for YEARS TOTAL rows */
  tr.year-total-row td:first-child {
    border-right: none !important;
  }
  tr.year-total-row td:nth-child(2) {
    border-left: none !important;
  }

/* WordPress plugin overrides */
.ss-calc-wrapper {
    text-align: left !important;
    max-width: none !important;
    margin: 0 !important;
}
.ss-calc-wrapper .powered-by a {
    color: #4f46e5 !important;
}
