/* ==========================================================================
   HYPERCALC.NET - Calculator Widget Components & Layouts
   ========================================================================== */

.calc-page-wrapper {
  padding: 2.5rem 0 4rem;
}

.calc-container-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: start;
  margin-bottom: 3.5rem;
}

/* Calculator Card Box */
.calc-card-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.calc-header {
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1.25rem;
}

.calc-header h1, .calc-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.calc-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}

/* Form Groups & Inputs */
.calc-form-group {
  margin-bottom: 1.35rem;
}

.calc-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.calc-label-hint {
  font-size: 0.75rem;
  font-weight: normal;
  color: var(--text-muted);
}

.input-affix-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-affix {
  position: absolute;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
  pointer-events: none;
}

.input-prefix {
  left: 1rem;
}

.input-suffix {
  right: 1rem;
}

.calc-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
}

.calc-input:focus {
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.has-prefix {
  padding-left: 2.25rem;
}

.has-suffix {
  padding-right: 2.75rem;
}

/* Segmented Control (Toggle switch buttons) */
.segmented-control {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  gap: 0.25rem;
  margin-bottom: 1.5rem;
}

.segment-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.segment-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Range Sliders */
.calc-range {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  outline: none;
  margin-top: 0.65rem;
  -webkit-appearance: none;
  appearance: none;
}

.calc-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 8px var(--primary-glow);
  transition: transform 0.15s ease;
}

.calc-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Result Panel */
.calc-result-panel {
  position: sticky;
  top: 5.5rem;
  background: linear-gradient(145deg, var(--bg-surface), var(--bg-surface-alt));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.result-hero-box {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.result-hero-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
}

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

.result-value-hero {
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.result-subtext {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Breakdown List */
.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9375rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border-subtle);
}

.breakdown-item:last-child {
  border-bottom: none;
}

.breakdown-item-name {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.breakdown-item-val {
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Progress Bar Visualizer */
.progress-bar-container {
  height: 12px;
  background: var(--bg-surface-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-subtle);
}

.progress-segment {
  height: 100%;
  transition: width 0.3s ease;
}

/* Actions Row */
.calc-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.calc-btn-secondary {
  flex: 1;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.calc-btn-secondary:hover {
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Amortization / Year Table */
.schedule-table-wrap {
  margin-top: 2rem;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

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

.schedule-table th {
  position: sticky;
  top: 0;
  background: var(--bg-surface-alt);
  padding: 0.75rem 1rem;
  text-align: right;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.schedule-table th:first-child,
.schedule-table td:first-child {
  text-align: left;
}

.schedule-table td {
  padding: 0.65rem 1rem;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  font-variant-numeric: tabular-nums;
}

.schedule-table tr:hover {
  background: var(--bg-surface-alt);
}

/* Responsive adjustment */
@media (max-width: 880px) {
  .calc-container-layout {
    grid-template-columns: 1fr;
  }
  .calc-result-panel {
    position: static;
  }
}
