/* =========================================================
   ShohozCalculator — Calculator UI Framework
   Shared styles for interactive calculator components. Built once,
   reused across every calculator integration per the standard
   calculator framework (session persistence, action buttons, results).
   ========================================================= */

.sc-calc-app {
  border: 1px solid var(--sc-line);
  border-radius: var(--sc-radius-md);
  background: var(--sc-paper-raised);
  overflow: hidden;
}

.sc-calc-app__tabs {
  display: flex;
  border-bottom: 1px solid var(--sc-line);
  background: var(--sc-paper);
}
.sc-calc-tab {
  flex: 1;
  padding: var(--sc-space-4);
  text-align: center;
  font-weight: 600;
  font-size: var(--sc-size-sm);
  color: var(--sc-slate);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--sc-duration) var(--sc-ease), border-color var(--sc-duration) var(--sc-ease);
}
.sc-calc-tab[aria-selected="true"] {
  color: var(--sc-ink);
  border-bottom-color: var(--sc-accent);
  background: var(--sc-paper-raised);
}
.sc-calc-tab:hover { color: var(--sc-ink); }

.sc-calc-app__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
@media (max-width: 760px) {
  .sc-calc-app__body { grid-template-columns: 1fr; }
}

.sc-calc-app__inputs {
  padding: var(--sc-space-6);
  border-right: 1px solid var(--sc-line);
  min-width: 0;
}
@media (max-width: 760px) {
  .sc-calc-app__inputs { border-right: none; border-bottom: 1px solid var(--sc-line); }
}

.sc-calc-app__results {
  padding: var(--sc-space-6);
  min-width: 0;
  background: var(--sc-paper);
}

.sc-calc-field {
  margin-bottom: var(--sc-space-5);
}
.sc-calc-field label {
  display: flex;
  align-items: center;
  gap: var(--sc-space-2);
  font-size: var(--sc-size-sm);
  font-weight: 600;
  color: var(--sc-ink);
  margin-bottom: var(--sc-space-2);
}
.sc-calc-field__hint {
  font-size: var(--sc-size-xs);
  color: var(--sc-slate);
  margin-top: var(--sc-space-2);
}
.sc-calc-field__unit-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--sc-line-strong);
  border-radius: var(--sc-radius-sm);
  background: var(--sc-paper-raised);
  overflow: hidden;
}
.sc-calc-field__unit-wrap:focus-within {
  border-color: var(--sc-accent);
  box-shadow: 0 0 0 3px var(--sc-accent-tint);
}
.sc-calc-field input,
.sc-calc-field select {
  flex: 1;
  min-width: 0;
  padding: var(--sc-space-3);
  border: none;
  background: transparent;
  font-size: var(--sc-size-base);
  color: var(--sc-ink);
  font-variant-numeric: tabular-nums;
}
.sc-calc-field input:focus,
.sc-calc-field select:focus { outline: none; }
.sc-calc-field__unit {
  display: flex;
  align-items: center;
  padding: 0 var(--sc-space-3);
  background: var(--sc-accent-tint);
  color: var(--sc-accent-deep);
  font-size: var(--sc-size-sm);
  font-weight: 600;
  border-left: 1px solid var(--sc-line);
  flex-shrink: 0;
}
.sc-calc-field--error .sc-calc-field__unit-wrap {
  border-color: var(--sc-error);
}
.sc-calc-field__error-msg {
  font-size: var(--sc-size-xs);
  color: var(--sc-error);
  margin-top: var(--sc-space-2);
  display: none;
}
.sc-calc-field--error .sc-calc-field__error-msg { display: block; }

.sc-calc-radio-group {
  display: flex;
  gap: var(--sc-space-2);
  margin-bottom: var(--sc-space-5);
}
.sc-calc-radio-group input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
}
.sc-calc-radio-group label {
  flex: 1;
  text-align: center;
  padding: var(--sc-space-3);
  border: 1px solid var(--sc-line-strong);
  border-radius: var(--sc-radius-sm);
  font-size: var(--sc-size-sm);
  font-weight: 600;
  color: var(--sc-ink-soft);
  cursor: pointer;
  transition: all var(--sc-duration) var(--sc-ease);
  margin: 0;
}
.sc-calc-radio-group input[type="radio"]:checked + label {
  background: var(--sc-ink);
  color: var(--sc-paper);
  border-color: var(--sc-ink);
}
.sc-calc-radio-group input[type="radio"]:focus-visible + label {
  outline: 2px solid var(--sc-accent);
  outline-offset: 2px;
}

.sc-calc-app__actions {
  display: flex;
  gap: var(--sc-space-3);
  margin-top: var(--sc-space-6);
  flex-wrap: wrap;
}

.sc-calc-result-hero {
  text-align: center;
  padding-bottom: var(--sc-space-5);
  margin-bottom: var(--sc-space-5);
  border-bottom: 1px solid var(--sc-line);
}
.sc-calc-result-hero__label {
  display: block;
  font-size: var(--sc-size-xs);
  color: var(--sc-slate);
  font-weight: 600;
  margin-bottom: var(--sc-space-2);
}
.sc-calc-result-hero__value {
  display: block;
  font-family: var(--sc-font-display);
  font-size: var(--sc-size-3xl);
  color: var(--sc-accent-deep);
  line-height: 1.1;
}
.sc-calc-result-hero__sub {
  display: block;
  font-size: var(--sc-size-sm);
  color: var(--sc-slate);
  margin-top: var(--sc-space-2);
}

.sc-calc-empty-state {
  text-align: center;
  color: var(--sc-slate);
  padding: var(--sc-space-7) var(--sc-space-4);
}

.sc-calc-greek-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: var(--sc-space-3);
  margin-bottom: var(--sc-space-5);
}
.sc-calc-greek {
  text-align: center;
  padding: var(--sc-space-3);
  background: var(--sc-paper-raised);
  border: 1px solid var(--sc-line);
  border-radius: var(--sc-radius-sm);
}
.sc-calc-greek__symbol {
  display: block;
  font-family: var(--sc-font-display);
  font-size: var(--sc-size-md);
  color: var(--sc-ink);
}
.sc-calc-greek__label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sc-slate);
  margin-top: 2px;
}

.sc-calc-detail-list {
  border-top: 1px solid var(--sc-line);
}
.sc-calc-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--sc-space-3) 0;
  border-bottom: 1px solid var(--sc-line);
  font-size: var(--sc-size-sm);
}
.sc-calc-detail-row__label { color: var(--sc-slate); }
.sc-calc-detail-row__value { color: var(--sc-ink); font-weight: 500; font-variant-numeric: tabular-nums; }

.sc-calc-notice {
  display: flex;
  gap: var(--sc-space-3);
  padding: var(--sc-space-4);
  border-radius: var(--sc-radius-sm);
  font-size: var(--sc-size-sm);
  margin-bottom: var(--sc-space-4);
}
.sc-calc-notice--info {
  background: var(--sc-accent-tint);
  color: var(--sc-accent-deep);
}
.sc-calc-notice--warn {
  background: var(--sc-warn-tint);
  color: var(--sc-warn);
}
.sc-calc-notice svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }

/* --- Confirmation modal (Reset) --- */
.sc-calc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 32, 58, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: var(--sc-space-4);
}
.sc-calc-modal-backdrop.is-open { display: flex; }
.sc-calc-modal {
  background: var(--sc-paper-raised);
  border-radius: var(--sc-radius-md);
  padding: var(--sc-space-6);
  max-width: 380px;
  width: 100%;
  box-shadow: 0 24px 48px rgba(18,32,58,0.25);
}
.sc-calc-modal h3 { margin-bottom: var(--sc-space-3); }
.sc-calc-modal p { margin-bottom: var(--sc-space-5); color: var(--sc-slate); }
.sc-calc-modal__actions {
  display: flex;
  gap: var(--sc-space-3);
  justify-content: flex-end;
}

/* --- Toast (Copy confirmation) --- */
.sc-calc-toast {
  position: fixed;
  bottom: var(--sc-space-6);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--sc-ink);
  color: var(--sc-paper);
  padding: var(--sc-space-3) var(--sc-space-5);
  border-radius: var(--sc-radius-sm);
  font-size: var(--sc-size-sm);
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--sc-duration) var(--sc-ease), transform var(--sc-duration) var(--sc-ease), visibility var(--sc-duration) var(--sc-ease);
  z-index: 600;
}
.sc-calc-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .sc-calc-toast, .sc-calc-tab, .sc-calc-radio-group label { transition: none; }
}

/* --- Share & Embed section --- */
.sc-share-embed {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sc-space-6);
  padding-top: var(--sc-space-5);
  padding-bottom: var(--sc-space-5);
  border-top: 1px solid var(--sc-line);
  border-bottom: 1px solid var(--sc-line);
}
@media (max-width: 760px) {
  .sc-share-embed { grid-template-columns: 1fr; }
}

.sc-share-row {
  display: flex;
  gap: var(--sc-space-3);
  flex-wrap: wrap;
}
.sc-share-btn {
  width: 42px; height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--sc-line-strong);
  border-radius: 999px;
  background: var(--sc-paper-raised);
  color: var(--sc-ink-soft);
  cursor: pointer;
  transition: border-color var(--sc-duration) var(--sc-ease), color var(--sc-duration) var(--sc-ease), background var(--sc-duration) var(--sc-ease);
  padding: 0;
}
.sc-share-btn svg { width: 18px; height: 18px; }
.sc-share-btn:hover { border-color: var(--sc-accent); color: var(--sc-accent-deep); background: var(--sc-accent-tint); }
.sc-share-btn.is-copied { border-color: var(--sc-accent); color: var(--sc-accent-deep); background: var(--sc-accent-tint); }

.sc-embed-code-wrap { max-width: 100%; }
.sc-embed-code {
  width: 100%;
  font-family: var(--sc-font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--sc-ink-soft);
  background: var(--sc-paper);
  border: 1px solid var(--sc-line-strong);
  border-radius: var(--sc-radius-sm);
  padding: var(--sc-space-3);
  resize: vertical;
  box-sizing: border-box;
}
.sc-embed-code:focus {
  outline: none;
  border-color: var(--sc-accent);
  box-shadow: 0 0 0 3px var(--sc-accent-tint);
}
