/* ============================================================
   APR RiskPerception 360° — Estilos Globales
   apr.novahseq.com | v2.0 | 2026
   ============================================================ */

:root {
  --apr-primary:      #8B1A1A;
  --apr-secondary:    #C0392B;
  --apr-accent:       #E74C3C;
  --apr-dark:         #1a0a0a;
  --apr-bg:           #f4f6f8;
  --apr-card-bg:      #ffffff;
  --apr-border:       #e8eaed;
  --apr-text:         #2c3e50;
  --apr-text-muted:   #6c757d;
  --apr-shadow-sm:    0 1px 4px rgba(0,0,0,.07);
  --apr-shadow:       0 4px 16px rgba(0,0,0,.09);
  --apr-shadow-lg:    0 8px 32px rgba(0,0,0,.12);
  --apr-radius:       .75rem;
  --apr-radius-sm:    .5rem;
  --apr-navbar-h:     64px;
}

/* ── Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--apr-bg);
  color: var(--apr-text);
  font-size: .9375rem;
  line-height: 1.6;
}

a { color: var(--apr-primary); text-decoration: none; }
a:hover { color: var(--apr-secondary); }

/* ── Navbar ────────────────────────────────────────────────── */
.apr-navbar {
  background: linear-gradient(135deg, var(--apr-primary) 0%, color-mix(in srgb, var(--apr-primary) 70%, #000) 100%);
  box-shadow: 0 2px 12px rgba(139,26,26,.3);
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: var(--apr-navbar-h);
}

.apr-navbar .navbar-brand,
.apr-navbar .nav-link,
.apr-navbar .dropdown-toggle { color: #fff !important; }

.apr-navbar .nav-link:hover,
.apr-navbar .nav-link.active {
  color: #fff !important;
  background: rgba(255,255,255,.12);
  border-radius: var(--apr-radius-sm);
}
.apr-navbar .dropdown-menu { border: none; box-shadow: var(--apr-shadow); }

/* ── Brand ─────────────────────────────────────────────────── */
.apr-brand-main { font-size: 1.05rem; font-weight: 700; color: #fff; }
.apr-brand-sub  { font-size: .68rem; color: rgba(255,255,255,.7); margin-top: -2px; }

.apr-logo-icon {
  width: 40px; height: 40px; border-radius: var(--apr-radius-sm);
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem;
}
.apr-logo-icon-sm {
  width: 32px; height: 32px; border-radius: 6px;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .9rem;
}

/* ── Main content ──────────────────────────────────────────── */
.apr-main { padding: 0; min-height: calc(100vh - var(--apr-navbar-h) - 56px); }

/* ── Footer ────────────────────────────────────────────────── */
.apr-footer {
  background: #fff;
  border-top: 1px solid var(--apr-border);
  padding: 1rem 1.5rem;
  font-size: .82rem;
  color: var(--apr-text-muted);
}

/* ── Page header ───────────────────────────────────────────── */
.apr-page-title { font-size: 1.6rem; font-weight: 700; margin-bottom: .25rem; }
.apr-page-header { padding-bottom: 1rem; border-bottom: 1px solid var(--apr-border); }

/* ── Cards ─────────────────────────────────────────────────── */
.apr-card {
  background: var(--apr-card-bg);
  border-radius: var(--apr-radius);
  border: 1px solid var(--apr-border);
  box-shadow: var(--apr-shadow-sm);
  overflow: hidden;
}
.apr-card-header {
  padding: .875rem 1.25rem;
  font-weight: 600;
  font-size: .925rem;
  background: #fafafa;
  border-bottom: 1px solid var(--apr-border);
  display: flex;
  align-items: center;
}
.apr-card-body { padding: 1.25rem; }

/* ── Stat cards ─────────────────────────────────────────────── */
.apr-stat-card {
  background: #fff;
  border-radius: var(--apr-radius);
  border: 1px solid var(--apr-border);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: .875rem;
  box-shadow: var(--apr-shadow-sm);
  transition: box-shadow .15s, transform .15s;
}
.apr-stat-card:hover, .apr-stat-card-link:hover { box-shadow: var(--apr-shadow); transform: translateY(-1px); }
.apr-stat-icon {
  width: 48px; height: 48px; border-radius: .625rem;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0;
}
.apr-stat-number { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.apr-stat-label  { font-size: .75rem; color: var(--apr-text-muted); margin-top: .1rem; }

/* ── Buttons ───────────────────────────────────────────────── */
.apr-btn-primary {
  background: var(--apr-primary);
  color: #fff;
  border: none;
  border-radius: var(--apr-radius-sm);
  padding: .5rem 1.25rem;
  font-weight: 600;
  transition: background .15s, box-shadow .15s, transform .1s;
}
.apr-btn-primary:hover {
  background: var(--apr-secondary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(139,26,26,.3);
}
.apr-btn-outline {
  color: var(--apr-primary);
  border: 1.5px solid var(--apr-primary);
  border-radius: var(--apr-radius-sm);
  padding: .5rem 1.25rem;
  font-weight: 600;
  background: transparent;
  transition: all .15s;
}
.apr-btn-outline:hover { background: var(--apr-primary); color: #fff; }

/* ── Tables ─────────────────────────────────────────────────── */
.apr-table { font-size: .875rem; }
.apr-table thead th {
  background: #fafafa;
  border-bottom: 2px solid var(--apr-border);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: .75rem 1rem;
  white-space: nowrap;
}
.apr-table tbody td { padding: .75rem 1rem; vertical-align: middle; }
.apr-table tbody tr:hover { background: #fafbfc; }

/* ── Progress bars ──────────────────────────────────────────── */
.apr-progress    { height: 8px;  border-radius: 99px; background: #edf0f3; }
.apr-progress-sm { height: 6px;  border-radius: 99px; background: #edf0f3; }
.apr-progress-xs { height: 4px;  border-radius: 99px; background: #edf0f3; }
.apr-progress .progress-bar,
.apr-progress-sm .progress-bar,
.apr-progress-xs .progress-bar { border-radius: 99px; transition: width .6s ease; }

/* ── Badges de nivel ────────────────────────────────────────── */
.badge-critico    { background: #C0392B; color: #fff; }
.badge-basico     { background: #E67E22; color: #fff; }
.badge-preventivo { background: #D68910; color: #fff; }
.badge-avanzado   { background: #2E86C1; color: #fff; }
.badge-lider      { background: #1E8449; color: #fff; }

/* ── Avatars ────────────────────────────────────────────────── */
.apr-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .875rem; flex-shrink: 0;
}
.apr-avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--apr-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.apr-avatar-xl {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--apr-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.75rem;
}

/* ── Indicator cards ────────────────────────────────────────── */
.apr-ind-card {
  padding: .875rem;
  border: 1px solid var(--apr-border);
  border-radius: var(--apr-radius-sm);
  background: #fafafa;
}
.apr-ind-card-header {
  display: flex; align-items: center; gap: .5rem;
  font-size: .82rem; flex-wrap: wrap; margin-bottom: .35rem;
}
.apr-indicator-row { display: flex; align-items: center; gap: .875rem; }
.apr-indicator-icon { width: 32px; font-size: 1.1rem; text-align: center; flex-shrink: 0; }
.apr-indicator-info {}
.apr-indicator-label { font-size: .8rem; font-weight: 600; }

/* ── Dimension rows ─────────────────────────────────────────── */
.apr-dim-row { }

/* ── Login page ─────────────────────────────────────────────── */
.apr-login-body { margin: 0; padding: 0; }
.apr-login-wrapper { display: flex; min-height: 100vh; }

.apr-login-hero {
  flex: 0 0 42%;
  background: linear-gradient(160deg, var(--apr-primary) 0%, color-mix(in srgb, var(--apr-primary) 50%, #000) 100%);
  display: flex; align-items: center; justify-content: center; padding: 3rem;
  position: sticky; top: 0; height: 100vh;
}
@media (max-width: 768px) {
  .apr-login-wrapper { flex-direction: column; }
  .apr-login-hero { flex: none; height: auto; padding: 2.5rem 1.5rem; }
}
.apr-login-hero-content { max-width: 380px; }
.apr-login-title    { font-size: 2rem; font-weight: 800; color: #fff; margin-bottom: .5rem; }
.apr-login-subtitle { color: rgba(255,255,255,.75); font-size: 1rem; }
.apr-login-logo     { color: #fff; opacity: .9; }
.apr-feature-item {
  display: flex; align-items: center; gap: .75rem;
  color: rgba(255,255,255,.85); font-size: .9rem; margin-bottom: .75rem;
}
.apr-feature-item i { width: 20px; opacity: .8; }

.apr-login-form-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.apr-login-form-box   { width: 100%; max-width: 420px; }

.apr-empresa-logo-lg { max-height: 70px; max-width: 200px; object-fit: contain; }

/* ── Test page ──────────────────────────────────────────────── */
.apr-test-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: linear-gradient(135deg, var(--apr-primary), color-mix(in srgb, var(--apr-primary) 70%, #000));
  box-shadow: 0 2px 8px rgba(139,26,26,.3);
  color: #fff;
}
.apr-test-header * { color: #fff; }
.apr-test-progress-bar { width: 120px; height: 6px; border-radius: 99px; background: rgba(255,255,255,.2); }

.apr-question-row {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--apr-border);
  transition: background .15s;
}
.apr-question-row:last-child { border-bottom: none; }
.apr-question-answered { background: rgba(39,174,96,.04); }
.apr-question-text { font-size: .95rem; margin-bottom: .875rem; }
.apr-question-num  { font-weight: 700; color: var(--apr-primary); margin-right: .5rem; }

.apr-likert-group  { display: flex; gap: .5rem; flex-wrap: wrap; }
.apr-likert-option { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.apr-likert-radio  { display: none; }
.apr-likert-btn {
  width: 44px; height: 44px; border-radius: var(--apr-radius-sm);
  border: 2px solid var(--apr-border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; transition: all .12s; color: var(--apr-text-muted);
}
.apr-likert-radio:checked + .apr-likert-btn {
  background: var(--apr-primary); border-color: var(--apr-primary); color: #fff;
  box-shadow: 0 2px 8px rgba(139,26,26,.3);
}
.apr-likert-option:hover .apr-likert-btn { border-color: var(--apr-primary); color: var(--apr-primary); }
.apr-likert-label { font-size: .65rem; color: var(--apr-text-muted); margin-top: .2rem; }

/* ── Action cards ───────────────────────────────────────────── */
.apr-action-card {
  padding: 1rem;
  border-radius: var(--apr-radius-sm);
  border-left: 4px solid;
}
.apr-action-alta   { background: #fdf2f2; border-color: #C0392B; }
.apr-action-media  { background: #fefaf0; border-color: #E67E22; }
.apr-action-baja   { background: #f0f9ff; border-color: #2E86C1; }

/* ── Certificate card ───────────────────────────────────────── */
.apr-cert-card { transition: box-shadow .15s; }
.apr-cert-card:hover { box-shadow: var(--apr-shadow); }
.apr-cert-code {
  font-family: 'Courier New', monospace;
  font-size: .8rem;
  background: #f8f9fa;
  padding: .3rem .75rem;
  border-radius: 99px;
  border: 1px solid var(--apr-border);
  display: inline-block;
  letter-spacing: .05em;
}

/* ── Result emoji ───────────────────────────────────────────── */
.apr-result-emoji { font-size: 4rem; line-height: 1; }

/* ── Sedes/areas empty states ───────────────────────────────── */
.apr-empty-state { text-align: center; padding: 4rem 2rem; }
.apr-empty-state i { font-size: 3rem; opacity: .2; margin-bottom: 1rem; display: block; }

/* ── Utilities ──────────────────────────────────────────────── */
.tracking-wide { letter-spacing: .08em; }
.gap-2 { gap: .5rem; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 576px) {
  .apr-page-title { font-size: 1.25rem; }
  .apr-stat-number { font-size: 1.4rem; }
  .apr-likert-btn  { width: 38px; height: 38px; font-size: .8rem; }
  .apr-card-body   { padding: 1rem; }
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.25); }

/* ── Empresas sedes/areas ───────────────────────────────────── */
.apr-worker-select-box {}

/* ── Directorio page ────────────────────────────────────────── */
.apr-dir-card {
  border: 1px solid var(--apr-border);
  border-radius: var(--apr-radius);
  padding: 1.5rem;
  background: #fff;
  transition: box-shadow .15s, transform .15s;
  cursor: pointer;
}
.apr-dir-card:hover { box-shadow: var(--apr-shadow); transform: translateY(-2px); }
