/* ==========================================================================
   Enhanced Mortgage Calculator - Additional Styles
   ========================================================================== */

/* Result Grid for Multiple Cards */
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.result-card-mini {
  background-color: var(--bg-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border-color);
}

.result-label-mini {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.result-value-mini {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* Overpayment Section */
.overpayment-section {
  background-color: var(--bg-light);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
}

/* Savings Highlight */
#overpaymentSavings {
  margin: 1.5rem 0;
}

.savings-highlight {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 1.5rem;
  border-radius: var(--radius-md);
}

.savings-highlight h4 {
  color: white;
  margin-bottom: 1rem;
}

.savings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.saving-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.saving-label {
  font-size: 0.75rem;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.saving-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.saving-value.green {
  color: var(--success-light, #6EE7B7);
}

/* Chart Tabs */
.chart-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1.5rem 0 1rem 0;
  border-bottom: 2px solid var(--border-color);
}

.chart-tab {
  background: none;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 0.938rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  font-family: var(--font-primary);
}

.chart-tab:hover {
  color: var(--primary-color);
}

.chart-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* Payment Schedule Section */
.payment-schedule-section {
  background-color: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-md);
}

.schedule-controls {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.schedule-table-container {
  overflow-x: auto;
  margin-top: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.schedule-table thead {
  background-color: var(--primary-color);
  color: white;
}

.schedule-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.schedule-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.schedule-table tbody tr:hover {
  background-color: var(--bg-light);
}

.schedule-table tbody tr:last-child td {
  border-bottom: none;
}

.schedule-table .highlight-row {
  background-color: rgba(251, 191, 36, 0.15) !important;
  font-weight: 600;
}

/* Jargon Buster Section */
.jargon-buster-section {
  background-color: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-md);
}

.jargon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.jargon-card {
  background-color: var(--bg-light);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
}

.jargon-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.jargon-card.active {
  border-color: var(--primary-color);
  background-color: var(--bg-card, #16161F);
}

.jargon-term {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  user-select: none;
}

.jargon-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.jargon-title {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.938rem;
}

.jargon-toggle {
  color: var(--primary-color);
  font-size: 0.875rem;
  transition: var(--transition);
}

.jargon-card.active .jargon-toggle {
  transform: rotate(180deg);
}

.jargon-definition {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-top: 0;
}

.jargon-card.active .jargon-definition {
  max-height: 300px;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* Modal for Email Capture */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background-color: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s;
  position: relative;
}

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

.modal-close {
  position: absolute;
  right: 1.5rem;
  top: 1.5rem;
  font-size: 2rem;
  font-weight: 300;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.email-form {
  margin-top: 1.5rem;
}

.email-form input[type="email"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.email-form input[type="checkbox"] {
  margin-right: 0.5rem;
  cursor: pointer;
}

.email-form label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* Progress Indicator */
.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  transition: width 0.3s ease;
}

/* Comparison View */
.comparison-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
  padding: 1.5rem;
  background-color: var(--bg-light);
  border-radius: var(--radius-md);
}

.comparison-column {
  text-align: center;
}

.comparison-column h4 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.comparison-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
  font-family: var(--font-mono);
  margin: 0.5rem 0;
}

.comparison-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Loading State */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Tooltips Enhancement */
.tooltip-extended {
  position: relative;
}

.tooltip-extended:hover::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--text-primary);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 10;
  box-shadow: var(--shadow-md);
}

.tooltip-extended:hover::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--text-primary);
  z-index: 10;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .result-grid {
    grid-template-columns: 1fr;
  }
  
  .savings-grid {
    grid-template-columns: 1fr;
  }
  
  .chart-tabs {
    flex-wrap: wrap;
  }
  
  .chart-tab {
    flex: 1;
    min-width: 120px;
  }
  
  .jargon-grid {
    grid-template-columns: 1fr;
  }
  
  .schedule-table {
    font-size: 0.75rem;
  }
  
  .schedule-table th,
  .schedule-table td {
    padding: 0.5rem;
  }
  
  .comparison-view {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .schedule-controls {
    flex-direction: column;
  }
  
  .schedule-controls .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .modal-content {
    padding: 1.5rem;
    width: 95%;
  }
  
  .savings-highlight {
    padding: 1rem;
  }
  
  .saving-value {
    font-size: 1.25rem;
  }
}

/* Print Styles for PDF */
@media print {
  .header,
  .footer,
  .calculator-inputs,
  .btn,
  .chart-tabs,
  .schedule-controls,
  .breadcrumb,
  .modal {
    display: none !important;
  }
  
  .calculator-results {
    width: 100%;
    max-width: none;
  }
  
  .chart-container {
    page-break-inside: avoid;
  }
  
  .jargon-card {
    page-break-inside: avoid;
  }
}


/* ============================================================
   DARK THEME: Jargon Card Overrides
   ============================================================ */

.jargon-buster-section {
  background-color: #16161F !important;
  border: 1px solid #27272A;
}

.jargon-card {
  background-color: #1A1A25 !important;
  border-color: #27272A !important;
}

.jargon-card:hover {
  border-color: #818CF8 !important;
}

.jargon-card.active {
  background-color: #1E1E2A !important;
  border-color: #818CF8 !important;
}

.jargon-title {
  color: #FFFFFF !important;
}

.jargon-toggle {
  color: #818CF8 !important;
}

.jargon-definition {
  color: #B4B4BC !important;
}

.jargon-definition strong {
  color: #FFFFFF !important;
}

.jargon-card.active .jargon-definition {
  border-top-color: #27272A !important;
}
