/**
 * Amortization Calculator Stylesheet
 * Pixel-perfect Calculator.net clone with responsive layout
 */

/* Container & Layout */
.ac-page-container {
  max-width: 1050px;
  margin: 0 auto;
  padding: 12px 16px 40px;
  font-family: Arial, Helvetica, sans-serif;
  color: #000000;
  box-sizing: border-box;
}

/* Breadcrumbs & Top Bar */
.ac-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.ac-breadcrumbs {
  color: #0844a4;
}

.ac-breadcrumbs a {
  color: #0844a4;
  text-decoration: none;
}

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

.ac-breadcrumbs .sep {
  color: #888888;
  margin: 0 4px;
}

.ac-breadcrumbs .current {
  color: #555555;
}

.ac-top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ac-saved-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #2b5a88;
  background: #f5f7fa;
  border: 1px solid #ccd5df;
  border-radius: 3px;
  padding: 3px 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.ac-saved-btn:hover {
  background: #eaf0f7;
  border-color: #a9b9cb;
}

.ac-print-link {
  font-size: 13px;
  color: #0844a4;
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.ac-print-link:hover {
  color: #05296b;
}

/* Page Title */
.ac-page-title {
  font-size: 26px;
  font-weight: bold;
  color: #0844a4;
  margin: 0 0 16px 0;
  line-height: 1.2;
}

/* Main Two-Column Layout */
.ac-main-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

.ac-content-col {
  flex: 1 1 0%;
  min-width: 0;
}

.ac-sidebar-col {
  width: 250px;
  flex-shrink: 0;
}

/* Top Section: Form on left, Result banner & charts on right */
.ac-top-section {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.ac-form-col {
  width: 255px;
  flex-shrink: 0;
}

.ac-result-col {
  flex: 1 1 0%;
  min-width: 0;
}

/* Form Box */
.ac-form-box {
  background: #f4f6f9;
  border: 1px solid #c7d2de;
  border-radius: 4px;
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ac-form-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ac-form-table td {
  padding: 6px 0;
  vertical-align: middle;
}

.ac-label-cell {
  width: 90px;
  color: #222222;
  font-size: 13px;
  padding-right: 6px;
}

.ac-input-cell {
  color: #222222;
}

.ac-input-text {
  width: 130px;
  padding: 4px 6px;
  border: 1px solid #7f9db9;
  border-radius: 2px;
  font-size: 13px;
  box-sizing: border-box;
  background-color: #ffffff;
}

.ac-input-text:focus {
  outline: none;
  border-color: #0844a4;
  box-shadow: 0 0 2px rgba(8, 68, 164, 0.5);
}

.ac-input-short {
  width: 44px;
  padding: 4px;
  border: 1px solid #7f9db9;
  border-radius: 2px;
  font-size: 13px;
  box-sizing: border-box;
  text-align: center;
}

.ac-input-suffix {
  font-size: 12px;
  color: #333333;
  margin: 0 4px 0 2px;
}

/* Optional Extra Payments Checkbox Row */
.ac-extra-row td {
  padding: 8px 0 6px;
}

.ac-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: bold;
  color: #111111;
  cursor: pointer;
}

.ac-checkbox-label input[type="checkbox"] {
  cursor: pointer;
  margin: 0;
}

/* Extra Payments Drawer */
.ac-extra-drawer {
  background: #ffffff;
  border: 1px solid #d0d7de;
  border-radius: 3px;
  padding: 8px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.ac-extra-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ac-extra-table td {
  padding: 4px 0;
}

/* Button Row */
.ac-btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 6px;
}

.ac-calc-btn {
  background: linear-gradient(to bottom, #5d9732, #477727);
  color: #ffffff;
  border: 1px solid #3d6821;
  border-radius: 3px;
  padding: 5px 14px 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.ac-calc-btn:hover {
  background: linear-gradient(to bottom, #67a637, #4e822b);
}

.ac-calc-btn .ac-play-icon {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid #ffffff;
  display: inline-block;
}

.ac-clear-btn {
  background: linear-gradient(to bottom, #f0f0f0, #d9d9d9);
  color: #333333;
  border: 1px solid #afafaf;
  border-radius: 3px;
  padding: 5px 14px 6px;
  font-size: 13px;
  font-weight: normal;
  cursor: pointer;
}

.ac-clear-btn:hover {
  background: linear-gradient(to bottom, #fafafa, #e4e4e4);
}

/* Result Column Styling */
.ac-monthly-banner {
  background-color: #508432;
  color: #ffffff;
  padding: 7px 12px;
  border-radius: 3px 3px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 17px;
  font-weight: bold;
}

.ac-monthly-banner .ac-save-icon-btn {
  background: #ffffff;
  color: #333333;
  border: 1px solid #3d6821;
  border-radius: 2px;
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: normal;
  text-decoration: none;
}

.ac-monthly-banner .ac-save-icon-btn:hover {
  background: #f0f0f0;
}

/* Donut Chart & Legend Area */
.ac-chart-summary-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px 0 12px;
}

.ac-donut-canvas-wrap {
  position: relative;
  width: 110px;
  height: 110px;
}

.ac-donut-canvas {
  width: 110px;
  height: 110px;
  display: block;
}

.ac-donut-legend {
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ac-donut-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #222222;
}

.ac-donut-legend-color {
  width: 13px;
  height: 13px;
  display: inline-block;
  border-radius: 1px;
}

/* Summary Table (Total payments & total interest) */
.ac-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 6px;
}

.ac-summary-table td {
  padding: 4px 8px;
  border: 1px solid #d4dbe3;
}

.ac-summary-table td:first-child {
  background-color: #f7f9fb;
  color: #333333;
  width: 55%;
}

.ac-summary-table td:last-child {
  background-color: #ffffff;
  font-weight: normal;
  color: #000000;
}

/* Bottom Amortization Schedule Section */
.ac-bottom-section {
  margin-top: 16px;
  padding-top: 8px;
}

.ac-schedule-header-row {
  margin-bottom: 8px;
}

.ac-schedule-title {
  font-size: 20px;
  font-weight: bold;
  color: #0844a4;
  margin: 0 0 10px 0;
}

.ac-schedule-tabs {
  font-size: 14px;
  margin-bottom: 12px;
}

.ac-schedule-tab {
  cursor: pointer;
  margin-right: 18px;
  padding-bottom: 2px;
}

.ac-schedule-tab.active {
  font-weight: bold;
  color: #000000;
  text-decoration: none;
}

.ac-schedule-tab.inactive {
  color: #0844a4;
  text-decoration: underline;
}

.ac-schedule-tab.inactive:hover {
  color: #05296b;
}

/* Schedule Layout: Table on left, Graph on right */
.ac-schedule-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

.ac-table-side {
  flex: 1 1 0%;
  min-width: 0;
  overflow-x: auto;
}

.ac-graph-side {
  width: 250px;
  flex-shrink: 0;
}

/* Schedule Table */
.ac-schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: right;
  border: 1px solid #c7d2de;
}

.ac-schedule-table th {
  background-color: #224b7a;
  color: #ffffff;
  font-weight: bold;
  padding: 6px 8px;
  border: 1px solid #1a3c63;
  text-align: right;
}

.ac-schedule-table th:first-child {
  text-align: center;
}

.ac-schedule-table td {
  padding: 5px 8px;
  border: 1px solid #e0e5eb;
}

.ac-schedule-table td:first-child {
  text-align: center;
  background-color: #f7f9fb;
}

.ac-schedule-table tr:nth-child(even) td:not(:first-child) {
  background-color: #f9fbfd;
}

.ac-schedule-table tr:hover td {
  background-color: #eef4fc;
}

/* Graph Side */
.ac-graph-canvas-wrap {
  position: relative;
  width: 240px;
  height: 200px;
  background: #ffffff;
}

.ac-graph-canvas {
  width: 240px;
  height: 200px;
  display: block;
}

.ac-graph-x-label {
  text-align: center;
  font-size: 12px;
  color: #333333;
  margin-top: 4px;
}

/* Right Sidebar */
.ac-search-box {
  display: flex;
  margin-bottom: 16px;
}

.ac-search-input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #7f9db9;
  border-right: none;
  border-radius: 2px 0 0 2px;
  font-size: 13px;
  outline: none;
}

.ac-search-input:focus {
  border-color: #224b7a;
}

.ac-search-btn {
  background-color: #224b7a;
  color: #ffffff;
  border: 1px solid #1a3c63;
  border-radius: 0 2px 2px 0;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  font-weight: normal;
}

.ac-search-btn:hover {
  background-color: #1a3c63;
}

.ac-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #7f9db9;
  border-top: none;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ac-search-item {
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
}

.ac-search-item:hover {
  background-color: #e8f0fe;
}

/* Sidebar Financial Calculators Card */
.ac-sidebar-card {
  border: 1px solid #a2b7cf;
  border-radius: 3px;
  background: #ffffff;
  margin-bottom: 20px;
  overflow: hidden;
}

.ac-sidebar-header {
  background-color: #224b7a;
  color: #ffffff;
  font-size: 14px;
  font-weight: bold;
  padding: 6px 10px;
}

.ac-sidebar-content {
  padding: 10px;
}

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

.ac-sidebar-links-grid a {
  color: #0844a4;
  text-decoration: none;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.ac-sidebar-more {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #e0e5eb;
  font-size: 12px;
}

.ac-sidebar-more a {
  color: #0844a4;
  text-decoration: none;
}

.ac-sidebar-more a:hover {
  text-decoration: underline;
}

.ac-sidebar-cats {
  background-color: #eef2f7;
  padding: 6px 10px;
  border-top: 1px solid #d4dbe3;
  font-size: 11px;
  color: #333333;
}

.ac-sidebar-cats a {
  color: #0844a4;
  text-decoration: none;
}

.ac-sidebar-cats a:hover {
  text-decoration: underline;
}

.ac-sidebar-cats .sep {
  color: #888888;
  margin: 0 4px;
}

/* Modal for Saved Calculations */
.ac-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.ac-modal-dialog {
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.ac-modal-header {
  background-color: #224b7a;
  color: #ffffff;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 4px 4px 0 0;
}

.ac-modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: bold;
}

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

.ac-modal-body {
  padding: 14px;
  overflow-y: auto;
  font-size: 13px;
}

.ac-scenario-card {
  border: 1px solid #d0d7de;
  border-radius: 3px;
  padding: 10px;
  margin-bottom: 10px;
  background: #f9fbfd;
}

.ac-scenario-card h4 {
  margin: 0 0 4px 0;
  font-size: 13px;
  color: #0844a4;
}

.ac-scenario-meta {
  font-size: 11px;
  color: #666666;
  margin-bottom: 6px;
}

.ac-scenario-actions {
  display: flex;
  gap: 8px;
}

.ac-scenario-btn {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 2px;
  border: 1px solid #ccd5df;
  background: #ffffff;
  cursor: pointer;
}

.ac-scenario-btn.danger {
  color: #cc0000;
  border-color: #f1b3b3;
}

/* Modal sizing & footer */
.ac-modal-dialog-lg {
  max-width: 820px;
  width: 95%;
  max-height: 90vh;
}

.ac-modal-footer {
  background: #f4f6f8;
  border-top: 1px solid #d4dbe0;
  padding: 8px 14px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  border-radius: 0 0 4px 4px;
}

.ac-modal-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 3px;
  border: 1px solid #7f9db9;
  background: #ffffff;
  color: #333333;
}

.ac-modal-btn.primary {
  background: #2b5a88;
  border-color: #1b4570;
  color: #ffffff;
}

.ac-modal-btn.primary:hover {
  background: #1b4570;
}

/* Print Toolbar & Sheet */
.ac-print-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  background-color: #f8fafc;
  padding: 8px 10px;
  border-radius: 3px;
  border: 1px solid #e0e5eb;
}

.ac-print-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #7f9db9;
  padding: 5px 12px;
  font-size: 12px;
  color: #003366;
  font-weight: bold;
  cursor: pointer;
  border-radius: 3px;
  font-family: inherit;
}

.ac-print-action-btn:hover {
  background: #eef3f8;
  border-color: #003366;
}

.ac-print-action-btn.ac-btn-print-now {
  background: #5c9038;
  border-color: #4a752d;
  color: #ffffff;
}

.ac-print-action-btn.ac-btn-print-now:hover {
  background: #4a752d;
}

.ac-print-sheet {
  background: #ffffff;
  padding: 6px 2px;
  color: #111111;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  line-height: 1.45;
}

.ac-print-tip {
  font-size: 11px;
  color: #666666;
  margin-right: auto;
  align-self: center;
}

/* Toast Notification */
.ac-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #222222;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 4px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 2000;
  display: none;
  animation: acFadeIn 0.2s ease;
}

@keyframes acFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Print Styles */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 10pt !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .site-header,
  .site-footer,
  .ac-top-bar,
  .ac-sidebar-col,
  .ac-btn-row,
  .ac-top-actions,
  .ac-toast,
  .ac-print-toolbar,
  .ac-print-tip,
  .ac-modal-footer,
  .ac-modal-close-icon {
    display: none !important;
  }

  /* When printing while modal is open */
  body.ac-printing-modal .ac-page-container {
    display: none !important;
  }

  body.ac-printing-modal .ac-modal-backdrop {
    position: static !important;
    background: transparent !important;
    display: block !important;
    padding: 0 !important;
  }

  body.ac-printing-modal .ac-modal-dialog {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: none !important;
  }

  body.ac-printing-modal .ac-modal-body {
    overflow: visible !important;
    padding: 0 !important;
  }

  .ac-main-layout,
  .ac-top-section,
  .ac-schedule-layout {
    display: block !important;
  }

  .ac-page-container {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .ac-form-box,
  .ac-schedule-table {
    border: 1px solid #000 !important;
  }

  .ac-schedule-table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  .ac-schedule-table th,
  .ac-schedule-table td {
    border: 1px solid #555 !important;
    color: #000 !important;
    padding: 4px 6px !important;
  }

  .ac-schedule-table tr {
    page-break-inside: avoid !important;
  }
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .ac-main-layout {
    flex-direction: column;
  }

  .ac-sidebar-col {
    width: 100%;
  }

  .ac-top-section {
    flex-direction: column;
  }

  .ac-form-col {
    width: 100%;
  }

  .ac-schedule-layout {
    flex-direction: column;
  }

  .ac-graph-side {
    width: 100%;
  }
}
