/**
 * Zenith GST Calculator - Calculator Component Styles
 * Centered two-column desktop layout & responsive design.
 */

.calculator-section {
  padding: 1rem 0 3rem 0;
}

.calc-container {
  max-width: 1100px;
  margin: 0 auto;
}

.calc-card-wrapper {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  overflow: hidden;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

/* Left Panel: Inputs & Controls */
.calc-inputs-panel {
  padding: 2.25rem;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.panel-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.label-hint {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-light);
}

/* Currency Input Field */
.input-currency-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-symbol {
  position: absolute;
  left: 1rem;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-light);
  pointer-events: none;
}

.form-control-amount {
  width: 100%;
  height: 54px;
  padding: 0 3rem 0 2.5rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  background-color: var(--bg-card-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
  font-variant-numeric: tabular-nums;
}

.form-control-amount:focus {
  border-color: var(--border-color-focus);
  background-color: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control-amount.has-error {
  border-color: var(--danger);
  background-color: var(--danger-light);
}

.btn-clear-amount {
  position: absolute;
  right: 0.85rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-light);
  background-color: transparent;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.btn-clear-amount:hover {
  color: var(--text-main);
  background-color: var(--bg-card-hover);
}

.input-error-msg {
  font-size: 0.82rem;
  color: var(--danger);
  font-weight: 500;
  min-height: 1.1rem;
  display: none;
}

.input-error-msg.visible {
  display: block;
}

/* Preset Amount Chips */
.presets-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.2rem;
}

.preset-btn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.preset-btn:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

/* Segmented Mode Control */
.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background-color: var(--bg-card-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.segmented-option {
  position: relative;
  display: flex;
}

.segmented-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.segmented-label {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.segmented-sub {
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.85;
}

.segmented-option input[type="radio"]:checked + .segmented-label {
  background-color: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

[data-theme="dark"] .segmented-option input[type="radio"]:checked + .segmented-label {
  background-color: var(--primary-light);
  color: var(--primary-hover);
}

/* Rate Chips Grid */
.rate-chips-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.rate-chip {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.rate-chip:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--primary-border);
}

.rate-chip.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(29, 78, 216, 0.25);
}

/* Custom Rate Input Field */
.custom-rate-wrapper {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all var(--transition-normal);
}

.custom-rate-wrapper.hidden {
  display: none;
}

.custom-rate-inner {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 200px;
}

.custom-rate-input {
  width: 100%;
  height: 44px;
  padding: 0 2.25rem 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  background-color: var(--bg-card-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
}

.custom-rate-input:focus {
  border-color: var(--border-color-focus);
  background-color: var(--bg-card);
}

.custom-rate-suffix {
  position: absolute;
  right: 1rem;
  font-weight: 700;
  color: var(--text-light);
  pointer-events: none;
}

/* Tax Type Selector (Intra-state vs Inter-state) */
.tax-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.tax-type-option {
  position: relative;
  display: flex;
}

.tax-type-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tax-type-label {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-card-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: all var(--transition-fast);
}

.tax-type-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.tax-type-desc {
  font-size: 0.76rem;
  color: var(--text-light);
}

.tax-type-option input[type="radio"]:checked + .tax-type-label {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.tax-type-option input[type="radio"]:checked + .tax-type-label .tax-type-title {
  color: var(--primary);
}

/* Right Panel: Calculation Results */
.calc-results-panel {
  background-color: var(--bg-card-subtle);
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.results-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Breakdown List */
.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.breakdown-label {
  color: var(--text-muted);
  font-weight: 500;
}

.breakdown-value {
  color: var(--text-main);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.breakdown-row.tax-sub-row {
  padding-left: 0.85rem;
  border-left: 2px solid var(--border-color);
  font-size: 0.9rem;
}

.breakdown-row.tax-sub-row .breakdown-label {
  color: var(--text-light);
}

.breakdown-row.tax-sub-row .breakdown-value {
  color: var(--text-muted);
}

.breakdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 0.25rem 0;
}

/* Highlighted Final Amount Card */
.final-amount-card {
  background-color: var(--bg-card);
  border: 1.5px solid var(--primary-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.final-amount-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(to bottom, var(--primary), #6366f1);
}

.final-amount-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.final-amount-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* Distribution Progress Bar */
.distribution-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.distribution-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-light);
}

.distribution-bar-track {
  height: 8px;
  background-color: var(--bg-card-hover);
  border-radius: var(--radius-full);
  display: flex;
  overflow: hidden;
}

.bar-segment-original {
  background-color: var(--primary);
  height: 100%;
  transition: width var(--transition-normal);
}

.bar-segment-gst {
  background-color: var(--warning);
  height: 100%;
  transition: width var(--transition-normal);
}

/* Results Actions Buttons */
.calc-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-primary {
  flex: 2;
  background-color: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3);
}

.btn-secondary {
  flex: 1;
  background-color: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
}
