/* Calculator styles: unit-converter */

/* ====================================
   Unit Converter - Studio Layout
   "Command Center" design with Control Deck + Multi-View
   ==================================== */

/* Panel base styles */
.unit-converter-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Left Panel: Control Deck (Inputs) */
.unit-converter-panel--input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 16px;
}

.unit-converter-section {
  min-width: 0;
  gap: 12px;
}

.unit-converter-section--conversion,
.unit-converter-action {
  grid-column: 1 / -1;
}

/* Right Panel: Multi-View (Results) */
.unit-converter-panel--result {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Category Selector (Context Switch) - prominent at top */
.unit-converter-category {
  margin-bottom: 0;
  min-width: 0;
}

.unit-converter-category__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sc-label-text, var(--sc-card-text, #111827));
  margin-bottom: 8px;
}

.unit-converter-category__select {
  width: 100%;
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 16px;
  border: 2px solid var(--sc-accent, #3b82f6);
  border-radius: var(--sc-radius, 8px);
  background: var(--sc-input-bg, #ffffff);
  color: var(--sc-input-text, #111827);
  cursor: pointer;
  transition: all 0.2s ease;
}

.unit-converter-category__select:hover {
  border-color: var(--sc-button-hover, #2563eb);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.unit-converter-category__select:focus {
  outline: none;
  border-color: var(--sc-accent, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Value Input (The Variable - larger text) */
.unit-converter-value {
  margin-bottom: 0;
  min-width: 0;
}

.unit-converter-value label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--sc-label-text, var(--sc-card-text, #111827));
}

.unit-converter-value__input {
  width: 100%;
  font-size: 1.25rem;
  font-weight: 600;
  padding: 14px 16px;
  border: 1px solid var(--sc-input-border, #d1d5db);
  border-radius: var(--sc-radius, 8px);
  background: var(--sc-input-bg, #ffffff);
  color: var(--sc-input-text, #111827);
  transition: all 0.2s ease;
}

.unit-converter-value__input:focus {
  outline: none;
  border-color: var(--sc-accent, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.unit-converter-value__input::placeholder {
  color: var(--sc-placeholder, #9ca3af);
  font-weight: 400;
}

/* Unit Sandwich: [From] — [Swap] — [To] */
.unit-converter-units {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: flex-end;
}

.unit-converter-units__field {
  min-width: 0;
}

.unit-converter-units__field label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sc-label-text, var(--sc-card-text, #111827));
}

.unit-converter-units__field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--sc-input-border, #d1d5db);
  border-radius: var(--sc-radius, 8px);
  background: var(--sc-input-bg, #ffffff);
  color: var(--sc-input-text, #111827);
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.unit-converter-units__field select:focus {
  outline: none;
  border-color: var(--sc-accent, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Swap Button (between From/To) */
.unit-converter-units__swap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  justify-self: center;
  align-self: center;
  width: 44px;
  height: 44px;
  padding: 0 12px;
  margin-top: 15px;
  margin-bottom: 0;
  border: 1px solid var(--sc-input-border, #d1d5db);
  background: var(--sc-input-bg, #ffffff);
  color: var(--sc-accent, #3b82f6);
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.1);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  overflow: hidden;
}

.unit-converter-units__swap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--sc-accent, #3b82f6);
  opacity: 0.08;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.unit-converter-units__swap:hover {
  border-color: var(--sc-accent, #3b82f6);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.14);
  transform: translateY(-1px);
}

.unit-converter-units__swap:hover::before {
  opacity: 0.16;
}

.unit-converter-units__swap:focus-visible {
  outline: none;
  border-color: var(--sc-accent, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22), 0 8px 16px rgba(15, 23, 42, 0.14);
}

.unit-converter-units__swap:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.unit-converter-units__swap-icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
  width: 18px;
  height: 18px;
  line-height: 0;
  transition: transform 0.28s ease;
}

.unit-converter-units__swap-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.unit-converter-units__swap-text {
  position: relative;
  z-index: 1;
  display: none;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.unit-converter-units__swap.is-animating .unit-converter-units__swap-icon {
  transform: rotate(180deg);
}

/* Convert Button */
.unit-converter-action {
  width: 100%;
  margin-top: 8px;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
}

/* Result Panel Styles */
.unit-converter-result {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 200px;
  padding: var(--sc-card-padding);
  background: var(--sc-result-bg, linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%));
  border-radius: var(--sc-radius, 12px);
  border: 1px solid var(--sc-result-border, rgba(59, 130, 246, 0.2));
}

/* Empty state */
.unit-converter-result__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  color: var(--sc-muted, #6b7280);
}

.unit-converter-result__empty-icon {
  font-size: 48px;
  opacity: 0.4;
  line-height: 1;
}

.unit-converter-result__empty-text {
  font-size: 0.9375rem;
  opacity: 0.7;
}

/* Hide empty state when result is shown */
.unit-converter-result.has-result .unit-converter-result__empty {
  display: none;
}

/* Primary Result Section */
.unit-converter-result__primary {
  text-align: center;
  margin-bottom: 20px;
}

.unit-converter-result__main {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--sc-accent, #3b82f6);
  line-height: 1.2;
  margin-bottom: 8px;
  word-break: break-word;
}

.unit-converter-result__unit {
  font-size: 1.5rem;
  font-weight: 600;
  opacity: 0.85;
}

.unit-converter-result__formula {
  font-size: 0.9375rem;
  color: var(--sc-text-secondary, #64748b);
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  display: inline-block;
}

/* Dark theme adjustments */
.vareoncalc-root.theme-dark .unit-converter-result,
.vareoncalc-root[data-theme="dark"] .unit-converter-result {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(30, 64, 175, 0.15) 100%);
  border-color: rgba(59, 130, 246, 0.3);
}

.vareoncalc-root.theme-dark .unit-converter-result__formula,
.vareoncalc-root[data-theme="dark"] .unit-converter-result__formula {
  background: rgba(0, 0, 0, 0.2);
}

.vareoncalc-root.theme-dark .unit-converter-units__swap,
.vareoncalc-root[data-theme="dark"] .unit-converter-units__swap {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(59, 130, 246, 0.48);
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.45);
}

.vareoncalc-root.theme-dark .unit-converter-units__swap::before,
.vareoncalc-root[data-theme="dark"] .unit-converter-units__swap::before {
  opacity: 0.18;
}

/* Responsive: tighten results on mobile */
@media (max-width: 768px) {
  .unit-converter-panel--input {
    grid-template-columns: 1fr;
  }

  .unit-converter-section--conversion,
  .unit-converter-action {
    grid-column: 1;
  }

  .unit-converter-units,
  .unit-converter-action {
    grid-column: 1;
  }

  .unit-converter-result {
    min-height: 160px;
    padding: var(--sc-card-padding);
  }

  .unit-converter-result__main {
    font-size: 1.75rem;
  }

  .unit-converter-result__unit {
    font-size: 1.125rem;
  }

}

/* Small screens: adjust unit sandwich */
@media (max-width: 480px) {
  .unit-converter-units {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .unit-converter-units__swap {
    order: 1;
    width: 100%;
    min-height: 42px;
    margin-bottom: 0;
    border-radius: var(--sc-radius, 8px);
    padding: 0 14px;
    justify-content: center;
  }

  .unit-converter-units__swap-icon {
    width: 16px;
    height: 16px;
  }

  .unit-converter-units__swap-text {
    display: inline-flex;
    font-size: 0.8125rem;
  }

  .unit-converter-units__field:first-child {
    order: 0;
  }

  .unit-converter-units__field:last-child {
    order: 2;
  }

  .unit-converter-value__input {
    font-size: 1.125rem;
    padding: 12px 14px;
  }

  .unit-converter-category__select {
    padding: 10px 14px;
    font-size: 0.9375rem;
  }
}

/* ====================================
  Unit Converter Refinement Overrides
  ==================================== */

.unit-converter-panel--input {
  align-items: start;
  align-content: start;
  gap: 16px;
}

.unit-converter-section--category,
.unit-converter-section--value {
  height: auto;
  align-self: stretch;
  gap: 0;
  padding-top: 10px;
}

.unit-converter-section--category .vareoncalc-section__header,
.unit-converter-section--value .vareoncalc-section__header {
  display: none;
}

.unit-converter-category {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.unit-converter-category__label {
  margin-bottom: 0;
  color: var(--sc-label-text, var(--sc-card-text, #111827));
}

.unit-converter-category__select {
  border-width: 2px;
  font-weight: 700;
}

.unit-converter-category__hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--sc-muted-text, #64748b);
}

.unit-converter-value {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.unit-converter-value__label {
  display: block;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sc-label-text, var(--sc-card-text, #111827));
}

.unit-converter-units__field label.vareoncalc-label--truncate,
.unit-converter-value__label .vareoncalc-tooltip,
.unit-converter-category__label .vareoncalc-tooltip {
  color: var(--sc-label-text, var(--sc-card-text, #111827));
}

.unit-converter-value > .vareoncalc-input-adorned {
  width: 100%;
}

.unit-converter-value > .vareoncalc-input-adorned.vareoncalc-input-adorned--suffix-rail {
  --sc-suffix-rail-min-width: 34px;
  --sc-suffix-rail-max-width: 58px;
  --sc-suffix-rail-fluid-width: 30%;
}

.unit-converter-value__input {
  border-width: 2px;
  font-size: 1.25rem;
  font-weight: 700;
}

.unit-converter-value__hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--sc-muted-text, #64748b);
}

.unit-converter-action {
  border-radius: 10px;
}

.unit-converter-result {
  gap: 18px;
  min-height: 220px;
  background: var(--sc-card-bg, #ffffff);
  border-color: var(--sc-card-border, #d1d5db);
}

.unit-converter-result__context {
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sc-muted-text, #64748b);
  letter-spacing: 0.01em;
}

.unit-converter-result__primary {
  margin-bottom: 0;
}

.unit-converter-result__main {
  letter-spacing: -0.01em;
}

.unit-converter-result__formula {
  border: 1px dashed color-mix(in srgb, var(--sc-card-border, #d1d5db) 72%, var(--sc-accent, #3b82f6) 28%);
}

.unit-converter-result.is-updated .unit-converter-result__main {
  animation: unitConverterResultPop 220ms ease;
}

@keyframes unitConverterResultPop {
  0% {
    opacity: 0.5;
    transform: translateY(4px) scale(0.99);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.vareoncalc-root.theme-dark .unit-converter-result,
.vareoncalc-root[data-theme="dark"] .unit-converter-result {
  background: var(--sc-card-bg, rgba(15, 23, 42, 0.9));
  border-color: var(--sc-card-border, rgba(71, 85, 105, 0.6));
}

@media (max-width: 768px) {
  .unit-converter-section--category,
  .unit-converter-section--value {
    height: auto;
    padding-top: 8px;
  }
}

@media (max-width: 480px) {
  .unit-converter-value > .vareoncalc-input-adorned.vareoncalc-input-adorned--suffix-rail {
    --sc-suffix-rail-min-width: 32px;
    --sc-suffix-rail-max-width: 52px;
    --sc-suffix-rail-fluid-width: 26%;
  }
}

@media (max-width: 560px) {
  .unit-converter-result__formula {
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .unit-converter-result__main {
    word-break: normal;
    overflow-wrap: break-word;
  }
}

@container vareoncalc (max-width: 560px) {
  .unit-converter-result__formula {
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .unit-converter-result__main {
    word-break: normal;
    overflow-wrap: break-word;
  }
}

@media (prefers-reduced-motion: reduce) {
  .unit-converter-result.is-updated .unit-converter-result__main {
    transition: none;
    animation: none;
  }
}

@media (max-width: 410px) {
  .unit-converter-panel--input,
  .unit-converter-units {
    grid-template-columns: 1fr;
  }

  .unit-converter-panel--input {
    gap: 12px;
  }

  .unit-converter-units__swap {
    width: 100%;
    height: 40px;
    margin-top: 0;
  }
}

@media (max-width: 360px) {
  .unit-converter-category__select,
  .unit-converter-value__input {
    padding: 12px 14px;
    font-size: 1rem;
  }
}

@container vareoncalc (max-width: 410px) {
  .unit-converter-panel--input,
  .unit-converter-units {
    grid-template-columns: 1fr;
  }

  .unit-converter-panel--input {
    gap: 12px;
  }

  .unit-converter-units__swap {
    width: 100%;
    height: 40px;
    margin-top: 0;
  }
}

@container vareoncalc (max-width: 360px) {
  .unit-converter-category__select,
  .unit-converter-value__input {
    padding: 12px 14px;
    font-size: 1rem;
  }
}

