/* ================================================================
   fichaje.css v5 — Design system naranja / Sora
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

[x-cloak] { display: none !important; }

/* ── Design tokens (mismo sistema que /app y /gestion) ── */
:root {
  --bg:        #F7F4F1;
  --surface:   #FFFFFF;
  --surface-2: #FBF8F5;
  --border:    #E8E2DA;
  --border-2:  #D4CBBD;

  --text-1: #1C1714;
  --text-2: #4A4039;
  --text-3: #8C7E72;
  --text-4: #B5A99E;

  --accent:        #E07038;
  --accent-hover:  #C85E28;
  --accent-subtle: rgba(224,112,56,0.08);
  --accent-ring:   rgba(224,112,56,0.20);

  --green:         #2D9E5F;
  --green-subtle:  rgba(45,158,95,0.09);
  --green-ring:    rgba(45,158,95,0.25);

  --blue:          #2563EB;
  --blue-subtle:   rgba(37,99,235,0.08);
  --blue-ring:     rgba(37,99,235,0.20);

  --red:           #C8402F;
  --red-subtle:    rgba(200,64,47,0.08);
  --red-border:    rgba(200,64,47,0.25);

  --amber:         #C88C10;

  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:    cubic-bezier(0, 0, 0.2, 1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; overflow-x: hidden; }

/* ── Body ── */
body {
  font-family: 'Sora', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(1rem, 4vw, 2rem);
  -webkit-font-smoothing: antialiased;
}

/* ── Dev info ── */
.dev-info {
  position: fixed;
  top: 8px;
  left: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-4);
  line-height: 1.7;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 1px;
  pointer-events: none;
}

/* ── Maintenance banner ── */
.maintenance-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: #FFF8E8;
  border-bottom: 1px solid rgba(200,140,16,0.35);
  color: var(--amber);
  padding: 8px 20px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  z-index: 100;
}

/* ── Fichaje wrap ── */
.fichaje-wrap {
  width: 100%;
  max-width: 420px;
  animation: slideUp 0.45s var(--ease-out) both;
}

/* ── Card ── */
.fichaje-card {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow:
    0 1px 3px rgba(28,20,14,0.07),
    0 20px 60px rgba(28,20,14,0.08),
    0 4px 16px rgba(28,20,14,0.04);
  overflow: hidden;
}

/* ── Card header ── */
.card-header {
  padding: 1.5rem 1.75rem 1.1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.card-header-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-1);
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.card-subtitle {
  font-size: 0.78rem;
  color: var(--text-3);
  margin: 0;
  line-height: 1.5;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}

/* ── Steps area ── */
.steps-area {
  padding: 1.1rem 1.75rem 0.4rem;
}

/* ── Step block ── */
.step-block {
  transition: opacity 0.25s var(--ease);
}

.step-block.step-inactive { opacity: 0.4; }
.step-block.step-done    { opacity: 1; }
.step-block.step-active  { opacity: 1; }

/* ── Step row ── */
.step-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

/* ── Step badge ── */
.step-badge {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.badge-active   { background: var(--accent); color: #fff; }
.badge-done     { background: var(--green);  color: #fff; }
.badge-inactive {
  background: var(--surface-2);
  color: var(--text-4);
  border: 1.5px solid var(--border-2);
}

/* ── Step info ── */
.step-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.step-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
}

.step-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}

/* ── Dots row ── */
.dots-row {
  display: flex;
  gap: 8px;
  padding-left: 40px;
  margin-bottom: 4px;
}

.dots-row--pin { gap: 14px; }

/* ── Dot ── */
.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  background: transparent;
  transition:
    background 0.2s var(--ease-spring),
    border-color 0.2s var(--ease-spring),
    transform 0.25s var(--ease-spring),
    box-shadow 0.2s var(--ease);
}

.dot.dot-filled {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.2);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.dot--lg {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

/* ── Step connector ── */
.step-connector {
  width: 2px;
  height: 14px;
  background: var(--border);
  margin: 4px 0 4px 13px;
  border-radius: 2px;
  transition: background 0.3s var(--ease);
}

.step-connector.connector-active {
  background: var(--green);
}

/* ── Keypad ── */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 1rem 1.5rem 1.5rem;
}

/* ── Key button ── */
.key {
  font-family: 'Sora', sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  aspect-ratio: 1;
  width: 100%;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.12s var(--ease),
    border-color 0.12s var(--ease),
    color 0.12s var(--ease),
    transform 0.1s var(--ease),
    box-shadow 0.12s var(--ease);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  letter-spacing: -0.01em;
  box-shadow: 0 1px 3px rgba(28,20,14,0.05), 0 1px 0 var(--border);
}

.key:hover {
  background: var(--accent-subtle);
  border-color: rgba(224,112,56,0.3);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring), 0 2px 8px rgba(224,112,56,0.10);
}

.key:active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: scale(0.93);
  box-shadow: none;
}

/* C — clear */
.key-clear {
  font-size: 1rem;
  font-weight: 800;
  color: var(--red);
  letter-spacing: 0.05em;
}

.key-clear:hover {
  background: var(--red-subtle);
  border-color: var(--red-border);
  color: var(--red);
  box-shadow: 0 0 0 3px var(--red-border), 0 2px 8px rgba(200,64,47,0.08);
}

.key-clear:active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  transform: scale(0.93);
  box-shadow: none;
}

/* ⌫ — backspace */
.key-back {
  font-size: 1.25rem;
  color: var(--text-3);
}

.key-back:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: var(--text-2);
  box-shadow: 0 1px 4px rgba(28,20,14,0.07);
}

.key-back:active {
  background: var(--border);
  color: var(--text-1);
  transform: scale(0.93);
  box-shadow: none;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: clamp(1.5rem, 5vw, 2.5rem);
  left: 50%;
  transform: translateX(-50%);
  min-width: min(340px, calc(100vw - 32px));
  max-width: min(400px, calc(100vw - 32px));
  border-radius: 16px;
  padding: 18px 22px;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(28,20,14,0.18), 0 2px 8px rgba(28,20,14,0.10);
  text-align: center;
  pointer-events: none;
}

.toast-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 3px;
}

.toast-sub {
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0.85;
  margin-bottom: 10px;
}

.toast-type {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  opacity: 0.75;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.toast-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* Toast variants */
.toast-entrada {
  background: var(--green);
  color: #fff;
}

.toast-salida {
  background: var(--blue);
  color: #fff;
}

.toast-error {
  background: var(--surface);
  border: 1px solid var(--red-border);
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 20px;
  box-shadow: 0 4px 16px rgba(200,64,47,0.18);
}

.toast-error-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}

.toast-error-msg {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--red);
  text-align: left;
  line-height: 1.4;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28,20,14,0.50);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-container {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  width: 100%;
  max-width: 380px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(28,20,14,0.18), 0 4px 16px rgba(28,20,14,0.10);
  animation: modalIn 0.2s var(--ease) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

/* Modal header — entrada / salida */
.modal-header {
  padding: 14px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header.entrada {
  background: var(--green);
  color: #fff;
}

.modal-header.salida {
  background: var(--blue);
  color: #fff;
}

.modal-clock-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.15s;
}
.modal-clock-btn:hover { background: rgba(255,255,255,0.35); }

/* Modal body */
.modal-body {
  padding: 20px 22px 14px;
}

.modal-user-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  line-height: 1.2;
}

.modal-last-registro {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-last-registro-tipo {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.modal-last-registro-hora {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  text-align: right;
  line-height: 1.5;
}

.modal-sin-registros {
  font-size: 0.8rem;
  color: var(--text-4);
  font-style: italic;
  text-align: center;
  padding: 8px 0;
}

/* Modal actions */
.modal-actions {
  display: flex;
  gap: 8px;
  padding: 0 22px 16px;
}

.modal-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font-family: 'Sora', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.15s var(--ease);
}

.modal-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.modal-btn-cancel {
  background: var(--surface-2);
  color: var(--text-3);
  border: 1px solid var(--border);
}
.modal-btn-cancel:hover:not(:disabled) { background: var(--border); color: var(--text-2); }

.modal-btn-confirm {
  background: var(--green);
  color: #fff;
}
.modal-btn-confirm:hover:not(:disabled) { background: #239150; box-shadow: 0 4px 12px rgba(45,158,95,0.30); }

.modal-btn-confirm.salida {
  background: var(--blue);
}
.modal-btn-confirm.salida:hover:not(:disabled) { background: #1D4ED8; box-shadow: 0 4px 12px rgba(37,99,235,0.30); }

/* Modal remember */
.modal-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 22px 18px;
}

.modal-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.modal-remember label {
  font-size: 0.75rem;
  color: var(--text-3);
  font-weight: 500;
  cursor: pointer;
  line-height: 1.4;
}

/* ── Animations ── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0);    }
}
