/* ==========================================================================
   GestIA · Vacaciones: periodos vacacionales
   Las animaciones quedan neutralizadas por el bloque prefers-reduced-motion de base.css.
   ========================================================================== */

/* ---------- Periodos vacacionales ---------- */
.periods { display: grid; min-width: 0; }
.periods-head { flex-wrap: wrap; }
.periods-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.periods .chip { height: auto; min-height: 28px; padding-block: 4px; white-space: normal; line-height: 1.3; }
.periods-body { display: grid; gap: 12px; padding: 14px 22px 16px; }

.period-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.period-stat {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 11px 14px 11px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  animation: rise .4s var(--ease) backwards;
  animation-delay: calc(min(var(--i, 0), 6) * 40ms);
  transition: transform .25s var(--ease);
}
.period-stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--tone); }
.period-stat:hover { transform: translateY(-2px); }
.period-stat .icon-tile { width: 32px; height: 32px; border-radius: 10px; }
.period-stat .icon-tile .i { width: 16px; height: 16px; }
.period-stat-text { display: grid; gap: 1px; min-width: 0; }
.period-stat-text > span { font-size: 12px; font-weight: 650; color: var(--ink-2); }
.period-stat-text strong { display: flex; align-items: baseline; gap: 5px; color: var(--tone-ink); }
.period-stat-text strong b { font-size: 24px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.period-stat-text strong small { font-size: 12.5px; font-weight: 650; }
.period-stat-text > small { font-size: 11.5px; line-height: 1.4; color: var(--ink-2); }

.period-alerts { display: grid; gap: 6px; }
.period-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 10px 8px 12px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--tone-ink);
  background: var(--tone-soft);
  box-shadow: inset 3px 0 0 var(--tone);
  animation: pop .35s var(--spring) both;
}
.period-alert > .i { flex: none; width: 16px; height: 16px; }
.period-alert > span { flex: 1 1 240px; min-width: 0; }
.period-alert b { font-weight: 800; }
.period-sell { margin-left: auto; }
.period-sell:disabled { cursor: not-allowed; opacity: .8; }
.period-soon { margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 750; color: var(--ink-2); background: var(--line-soft); }

.period-timeline { display: grid; }
.period-list { display: grid; margin: 0; padding: 0; list-style: none; }
.period {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  animation: period-in .4s var(--spring) both;
  animation-delay: calc(min(var(--i, 0), 8) * 35ms);
}
.period::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.period-list:first-child .period:first-child::before { top: 15px; }
.period:last-child::before { bottom: auto; height: 15px; }
.period-list:first-child .period:only-child::before { display: none; }
.period-list:has(+ .is-older:not([hidden])) .period:last-child::before { display: block; bottom: 0; height: auto; }
.period-dot { position: relative; z-index: 1; width: 18px; height: 18px; margin-top: 6px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 5px var(--tone); }
.period.tone-slate .period-dot { box-shadow: inset 0 0 0 2px var(--tone); }
.period-body { min-width: 0; padding: 5px 10px; border-radius: var(--r-sm); }
.period:hover .period-body { background: var(--surface-2); }
.period-top { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.period-top strong { font-size: 13.5px; font-weight: 750; }
.period-top .badge { margin-left: auto; }
.period-range { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.period-detail { margin-top: 1px; font-size: 12.5px; line-height: 1.4; color: var(--ink-2); }
.period.tone-slate .period-top strong { color: var(--ink-2); }
.period.is-settled .period-detail { font-style: italic; }
.period .meter { max-width: 320px; margin-top: 6px; }
.period-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; }
.period-tags .chip { min-height: 24px; font-size: 11.5px; }
.period-late { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.period-late .i { width: 13px; height: 13px; }
.period-more { justify-self: start; margin-left: 18px; }
.period-more .i { transition: transform .25s var(--ease); }
.period-more[aria-expanded="true"] .i { transform: rotate(180deg); }
@keyframes period-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

.periods-foot { display: grid; gap: 8px; padding: 6px 22px 8px; border-top: 1px solid var(--line-soft); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.periods-explain summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  list-style: none;
  cursor: pointer;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 750;
  color: var(--ink-2);
  transition: color .2s var(--ease);
}
.periods-explain summary::-webkit-details-marker { display: none; }
.periods-explain summary:hover { color: var(--ink); }
.periods-explain summary:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }
.periods-explain summary .i { width: 15px; height: 15px; }
.periods-explain summary .i:last-child { margin-left: auto; transition: transform .25s var(--ease); }
.periods-explain[open] summary .i:last-child { transform: rotate(180deg); }
.periods-explain-body { display: grid; gap: 8px; padding-bottom: 8px; animation: fade .25s var(--ease) both; }
.periods-explain ul { display: grid; gap: 4px; margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.periods-loaded { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.periods-loaded .i { width: 14px; height: 14px; }

.periods-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 16px 22px 22px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  color: var(--tone-ink);
  background: var(--tone-soft);
  animation: pop .3s var(--spring) both;
}
.periods-error > .i { width: 20px; height: 20px; }
.periods-error strong { display: block; font-size: 13.5px; }
.periods-error p { font-size: 13px; color: var(--ink-2); }
.periods-loading { display: grid; gap: 14px; padding: 20px 22px 22px; }
.periods-loading .sk-line { height: 44px; max-width: 380px; }
.periods-sk-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.periods-sk-stats .sk { height: 84px; }
.periods-loading .sk-block { height: 180px; }

/* Variante compacta para la ficha del colaborador */
.periods.is-compact .periods-meta { display: grid; gap: 8px; padding: 14px 16px 0; }
.periods.is-compact .periods-meta p { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.periods.is-compact .periods-body { gap: 12px; padding: 12px 16px 14px; }
.periods.is-compact .period-stats { gap: 8px; }
.periods.is-compact .period-stat { padding: 10px 10px 10px 14px; }
.periods.is-compact .period-stat .icon-tile { display: none; }
.periods.is-compact .period-stat-text strong b { font-size: 22px; }
.periods.is-compact .periods-foot { padding: 10px 16px 12px; }
.periods.is-compact .periods-error { margin: 14px 16px; }
.periods-loading.is-compact { padding: 14px 16px 16px; }
.periods-loading.is-compact .sk-block { height: 120px; }

@media (max-width: 720px) {
  .periods:not(.is-compact) .period-stats, .periods-loading:not(.is-compact) .periods-sk-stats { grid-template-columns: 1fr; }
  .periods-body { padding: 14px 16px; }
  .periods-foot { padding: 6px 16px 8px; }
  .periods-error { margin: 14px 16px 16px; }
  .period-top .badge { margin-left: 0; }
  .period-sell { margin-left: 0; }
}
@media (max-width: 420px) {
  .periods.is-compact .period-stats { grid-template-columns: 1fr; }
}
