/* ===================================================
   NEXO NÓMINA · Calculator Components
   Requires style.css Acctual tokens — not standalone
   =================================================== */

/* ── Disable scroll snap on tool page ── */
html { scroll-snap-type: none; }

/* ── Page layout ── */
.page-main {
  padding: calc(var(--nav-height) + 2.5rem) 0 5rem;
  min-height: 100vh;
}

/* ── Form components (not in style.css) ── */
.form-label {
  display: block;
  font-size: var(--text-body-sm);
  font-weight: var(--fw-medium);
  color: var(--color-graphite);
  margin-bottom: var(--sp-8);
}
.form-input,
.form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-input);
  font-size: var(--text-body-sm);
  font-family: var(--font-primary);
  color: var(--color-graphite);
  background: var(--color-canvas-white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: var(--leading-body);
}
.form-input::placeholder { color: var(--color-ash-gray); }
.form-input:focus,
.form-select:focus {
  border-color: var(--color-sky-teal);
  box-shadow: 0 0 0 3px rgba(0, 152, 242, 0.1);
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%238d8d8d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
input[type="date"].form-input { cursor: pointer; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.input-prefix { position: relative; }
.input-prefix::before {
  content: attr(data-prefix);
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--text-body-sm);
  color: var(--color-ash-gray);
  pointer-events: none;
  font-weight: var(--fw-medium);
}
.input-prefix .form-input { padding-left: 1.5rem; }

/* ── Cards ── */
.card {
  background: var(--color-canvas-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-cards);
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-subtle-cream);
}
.card-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.9375rem;
  font-weight: var(--fw-semibold);
  color: var(--color-ink-black);
  letter-spacing: -0.01em;
}
.card-title .material-symbols-outlined {
  font-size: 17px;
  color: var(--color-sky-teal);
  background: rgba(0, 152, 242, 0.08);
  padding: 4px;
  border-radius: var(--radius-icon);
}
.card-body { padding: 1.5rem; }

/* ── Btn-sm override for card-header ── */
.card-header .btn {
  border-radius: var(--radius-buttons);
  padding: 5px 12px;
  font-size: 0.8125rem;
  gap: 4px;
}
.card-header .btn .material-symbols-outlined { font-size: 15px; }
.card-header .btn-ghost { color: var(--color-sky-teal); }

/* ── Segmented control (diario / mensual) ── */
.segmented {
  display: flex;
  background: var(--color-subtle-cream);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  padding: 3px;
  gap: 2px;
}
.segmented label { flex: 1; cursor: pointer; }
.segmented input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented-option {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4375rem 0.75rem;
  border-radius: calc(var(--radius-input) - 2px);
  font-size: 0.8125rem;
  font-weight: var(--fw-medium);
  color: var(--color-ash-gray);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  text-align: center;
  user-select: none;
}
.segmented input:checked + .segmented-option {
  background: var(--color-canvas-white);
  color: var(--color-ink-black);
  box-shadow: var(--shadow-subtle);
  font-weight: var(--fw-semibold);
}

/* ── Toggle switch ── */
.toggle-wrapper {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  gap: 0.5rem;
  user-select: none;
}
.toggle-input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 99px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 99px;
  top: 3px;
  left: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s;
}
.toggle-input:checked + .toggle-track { background: var(--color-sky-teal); }
.toggle-input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle-label {
  font-size: 0.875rem;
  font-weight: var(--fw-medium);
  color: var(--color-deep-slate);
}

/* ── Checkbox card item ── */
.check-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  background: var(--color-canvas-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.check-item:hover {
  border-color: var(--color-sky-teal);
  box-shadow: 0 0 0 3px rgba(0, 152, 242, 0.1);
}
.check-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--color-sky-teal);
  flex-shrink: 0;
}
.check-item-label {
  font-size: 0.8125rem;
  font-weight: var(--fw-medium);
  color: var(--color-deep-slate);
}

/* ── Results panel ── */
.results-panel {
  position: sticky;
  top: calc(var(--nav-height) + 1.25rem);
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.results-hero {
  background: transparent;
  border: 1.5px solid var(--color-sky-teal);
  border-radius: var(--radius-cards);
  padding: 1.5rem;
  color: var(--color-graphite);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 4px rgba(0, 152, 242, 0.06), var(--shadow-card);
}
.results-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-sky-teal);
  margin-bottom: 0.375rem;
}
.results-value {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--color-graphite);
  font-variant-numeric: tabular-nums;
}
.results-currency {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-ash-gray);
  margin-left: 0.25rem;
}
.results-divider {
  height: 1px;
  background: rgba(0, 152, 242, 0.15);
  margin: 1rem 0;
}
.results-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
.results-row-label {
  font-size: 0.8125rem;
  color: var(--color-ash-gray);
  font-weight: 400;
}
.results-row-value {
  font-size: 0.9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-graphite);
}
.results-row-value.is-danger  { color: #dc2626; }
.results-row-value.is-success { color: #16a34a; }

.btn-calcular {
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.6875rem 1rem;
  background: var(--color-button-black);
  color: #fff;
  border: none;
  border-radius: var(--radius-buttons);
  font-size: 0.9375rem;
  font-weight: var(--fw-semibold);
  font-family: var(--font-primary);
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-btn);
}
.btn-calcular:hover {
  opacity: 0.82;
  transform: translateY(-1px);
}
.btn-calcular:active { transform: scale(0.98); }

/* ── Info card ── */
.info-card {
  background: var(--color-canvas-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-cards);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-subtle);
}
.info-card-title {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: var(--fw-semibold);
  color: var(--color-ink-black);
  margin-bottom: 0.375rem;
}
.info-card-title .material-symbols-outlined {
  font-size: 15px;
  color: var(--color-sky-teal);
}
.info-card-text {
  font-size: 0.8125rem;
  color: var(--color-ash-gray);
  line-height: var(--leading-body);
}

/* ── Prestaciones table ── */
.prestaciones-table {
  width: 100%;
  border-collapse: collapse;
}
.prestaciones-table thead th {
  padding: 0.5rem 0.875rem;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-ash-gray);
  border-bottom: 1px solid var(--color-border);
}
.prestaciones-table tfoot tr td {
  border-top: 2px solid var(--color-border);
  padding-top: 0.625rem;
}
#tabla_prestaciones tr td,
#tabla_prestaciones_sdi tr td {
  padding: 0.5rem 0.875rem;
  vertical-align: middle;
}
#tabla_prestaciones tr + tr td,
#tabla_prestaciones_sdi tr + tr td {
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}
#tabla_prestaciones .concepto,
#tabla_prestaciones_sdi .concepto {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-input);
  padding: 0.375rem 1.5rem 0.375rem 0.625rem;
  font-size: var(--text-body-sm);
  font-family: var(--font-primary);
  color: var(--color-graphite);
  background: var(--color-canvas-white);
  outline: none;
  cursor: pointer;
  min-width: 165px;
  transition: border-color 0.15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%238d8d8d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
#tabla_prestaciones .concepto:focus,
#tabla_prestaciones_sdi .concepto:focus {
  border-color: var(--color-sky-teal);
  box-shadow: 0 0 0 3px rgba(0, 152, 242, 0.1);
}
#tabla_prestaciones .cantidad,
#tabla_prestaciones_sdi .cantidad {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-input);
  padding: 0.375rem 0.625rem;
  font-size: var(--text-body-sm);
  font-family: 'ui-monospace', 'Fira Code', monospace;
  font-weight: 500;
  color: var(--color-graphite);
  width: 88px;
  outline: none;
  transition: border-color 0.15s;
}
#tabla_prestaciones .cantidad:focus,
#tabla_prestaciones_sdi .cantidad:focus {
  border-color: var(--color-sky-teal);
  box-shadow: 0 0 0 3px rgba(0, 152, 242, 0.1);
}
#tabla_prestaciones .dias_vacaciones_prima {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.75rem;
  font-family: 'ui-monospace', monospace;
  color: var(--color-graphite);
  width: 56px;
  outline: none;
}
#tabla_prestaciones .btn_del,
#tabla_prestaciones_sdi .btn_del {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9375rem;
  color: var(--color-ash-gray);
  padding: 5px;
  border-radius: var(--radius-icon);
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
#tabla_prestaciones .btn_del:hover,
#tabla_prestaciones_sdi .btn_del:hover {
  color: #dc2626;
  background: #fef2f2;
}
#tabla_prestaciones td small,
#tabla_prestaciones_sdi td small {
  display: block;
  font-size: 0.6875rem;
  color: var(--color-ash-gray);
  margin-top: 2px;
}
#tabla_prestaciones_sdi .concepto[disabled],
#tabla_prestaciones_sdi .cantidad[disabled] {
  background: var(--color-subtle-cream);
  color: var(--color-ash-gray);
  cursor: not-allowed;
  border-color: transparent;
}
.advertencias-prestaciones {
  color: #d97706;
  margin-top: 0.625rem;
  font-size: 0.8125rem;
  line-height: var(--leading-body);
}

/* ── Animations ── */
@keyframes calc-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-up {
  animation: calc-fade-up 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.10s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.20s; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .card-body   { padding: 1rem; }
  .card-header { padding: 0.875rem 1rem; }
  .page-main   { padding-top: calc(var(--nav-height) + 1.5rem); }
}
