/* ==========================================================================
   NOTARIA-41 — DASHBOARD MODERNO
   FASE 4 del PLAN_EJECUCION
   Migración AdminLTE Box → Notary Card
   Empty States, Skeleton Loading, KPI Grid, Hero Stats
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. GRID DE KPIs (reemplaza small-box de AdminLTE)
   -------------------------------------------------------------------------- */
.notary-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.notary-kpi {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 14px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease;
  box-shadow: var(--app-card-shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notary-kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--app-elevated-shadow);
}

/* Acento lateral en vez de full background */
.notary-kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}
.notary-kpi--primary::before   { background: var(--app-primary); }
.notary-kpi--success::before   { background: #28a745; }
.notary-kpi--warning::before   { background: #f39c12; }
.notary-kpi--danger::before    { background: #dc3545; }
.notary-kpi--info::before      { background: #17a2b8; }

.notary-kpi__value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--app-text);
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.notary-kpi__label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--app-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.notary-kpi__icon {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 3rem;
  color: var(--app-primary);
  opacity: 0.10;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.notary-kpi:hover .notary-kpi__icon {
  opacity: 0.18;
}
.notary-kpi__trend {
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.notary-kpi__trend--up    { color: #28a745; }
.notary-kpi__trend--down  { color: #dc3545; }
.notary-kpi__trend--flat  { color: var(--app-muted); }

.notary-kpi__footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--app-border);
  font-size: 0.78rem;
}
.notary-kpi__footer a {
  color: var(--app-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 140ms ease;
}
.notary-kpi__footer a:hover {
  color: var(--app-primary);
}

/* --------------------------------------------------------------------------
   2. HERO STAT (destacado principal)
   -------------------------------------------------------------------------- */
.notary-hero-stat {
  background: linear-gradient(135deg, var(--app-primary), var(--app-primary-hover, #3a5f80));
  color: #ffffff;
  border-radius: 14px;
  padding: 28px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: 0 4px 18px rgba(44, 62, 80, 0.30);
  margin-bottom: 20px;
}
.notary-hero-stat__value {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}
.notary-hero-stat__label {
  font-size: 1rem;
  font-weight: 600;
  opacity: 0.90;
  margin-top: 4px;
}
.notary-hero-stat__icon {
  font-size: 4rem;
  opacity: 0.25;
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   3. NOTARY CARD (reemplaza .box de AdminLTE)
   -------------------------------------------------------------------------- */
.notary-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 14px;
  box-shadow: var(--app-card-shadow);
  margin-bottom: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Variantes de borde superior (reemplaza .box.box-primary etc.) */
.notary-card--primary { border-top: 3px solid var(--app-primary); }
.notary-card--success { border-top: 3px solid #28a745; }
.notary-card--warning { border-top: 3px solid #f39c12; }
.notary-card--danger  { border-top: 3px solid #dc3545; }
.notary-card--info    { border-top: 3px solid #17a2b8; }

.notary-card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--app-surface-2, transparent);
}
.notary-card-header--transparent {
  background: transparent;
}

.notary-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--app-text);
  letter-spacing: -0.2px;
}
.notary-card-title small {
  font-weight: 500;
  color: var(--app-muted);
  margin-left: 8px;
}

.notary-card-tools {
  display: flex;
  gap: 6px;
  align-items: center;
}
.notary-card-tools .btn {
  padding: 4px 8px;
  font-size: 0.82rem;
}
.notary-card-tools .btn-box-tool {
  background: transparent;
  border: 0;
  color: var(--app-muted);
  font-size: 1rem;
  padding: 4px;
  cursor: pointer;
  transition: color 140ms ease;
}
.notary-card-tools .btn-box-tool:hover {
  color: var(--app-text);
}

.notary-card-body {
  padding: 18px;
  color: var(--app-text);
  flex: 1;
}
.notary-card-body--no-padding {
  padding: 0;
}
.notary-card-body--scroll {
  max-height: 400px;
  overflow-y: auto;
}

.notary-card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--app-border);
  background: var(--app-surface-2);
  font-size: 0.82rem;
  color: var(--app-muted);
}

/* Colapsable */
.notary-card--collapsed .notary-card-body,
.notary-card--collapsed .notary-card-footer {
  display: none;
}

/* Cargando */
.notary-card--loading {
  position: relative;
  pointer-events: none;
  min-height: 120px;
}
.notary-card--loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--app-surface);
  opacity: 0.6;
  z-index: 5;
  border-radius: 14px;
}

/* --------------------------------------------------------------------------
   4. SKELETON LOADING
   -------------------------------------------------------------------------- */
.notary-skeleton {
  background: linear-gradient(
    90deg,
    var(--app-surface-2) 25%,
    var(--app-surface-3) 50%,
    var(--app-surface-2) 75%
  );
  background-size: 200% 100%;
  animation: notary-skeleton-shimmer 1.6s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes notary-skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.notary-skeleton--text {
  height: 14px;
  margin-bottom: 8px;
  width: 100%;
}
.notary-skeleton--text-sm  { width: 60%; }
.notary-skeleton--text-md  { width: 80%; }
.notary-skeleton--text-lg  { width: 100%; }

.notary-skeleton--title {
  height: 20px;
  width: 45%;
  margin-bottom: 14px;
  border-radius: 6px;
}

.notary-skeleton--avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.notary-skeleton--kpi {
  height: 90px;
  width: 100%;
  border-radius: 12px;
}

.notary-skeleton--chart {
  height: 200px;
  width: 100%;
  border-radius: 12px;
}

.notary-skeleton--table-row {
  height: 40px;
  margin-bottom: 6px;
  border-radius: 6px;
}

.notary-skeleton--button {
  height: 36px;
  width: 100px;
  border-radius: 8px;
  display: inline-block;
}

/* Grid de skeletons */
.notary-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

/* --------------------------------------------------------------------------
   5. EMPTY STATE
   -------------------------------------------------------------------------- */
.notary-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--app-muted);
}
.notary-empty-state__icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.35;
  color: var(--app-muted);
}
.notary-empty-state__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--app-text);
  margin: 0 0 6px;
}
.notary-empty-state__description {
  font-size: 0.88rem;
  max-width: 380px;
  line-height: 1.5;
  margin-bottom: 18px;
  color: var(--app-muted);
}
.notary-empty-state__action {
  margin-top: 4px;
}

/* Tamaño compacto */
.notary-empty-state--sm {
  padding: 28px 18px;
}
.notary-empty-state--sm .notary-empty-state__icon {
  font-size: 2.5rem;
}

/* --------------------------------------------------------------------------
   6. GRID DE CARDS (2 columnas base)
   -------------------------------------------------------------------------- */
.notary-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 991px) {
  .notary-card-grid {
    grid-template-columns: 1fr;
  }
  .notary-kpi-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}
@media (max-width: 767px) {
  .notary-kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .notary-kpi {
    padding: 14px 16px;
  }
  .notary-kpi__value {
    font-size: 1.5rem;
  }
  .notary-hero-stat {
    padding: 20px;
    flex-direction: column;
    text-align: center;
  }
  .notary-hero-stat__icon {
    margin-left: 0;
    font-size: 3rem;
  }
}

/* --------------------------------------------------------------------------
   7. ASIDE / PANEL LATERAL (Info boxes, listados rápidos)
   -------------------------------------------------------------------------- */
.notary-info-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.notary-info-list > li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--app-border);
  font-size: 0.88rem;
}
.notary-info-list > li:last-child {
  border-bottom: 0;
}
.notary-info-list__label {
  color: var(--app-muted);
  font-weight: 500;
}
.notary-info-list__value {
  color: var(--app-text);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   8. CHART CONTAINER DENTRO DE NOTARY CARD
   -------------------------------------------------------------------------- */
.notary-chart-container {
  width: 100%;
  position: relative;
}
.notary-chart-container canvas {
  width: 100% !important;
}

/* --------------------------------------------------------------------------
   9. MIGRATION HELPERS — Compatibilidad AdminLTE → Notary
   Estas clases se aplican sobre elementos AdminLTE existentes para
   adoptar el look Notary sin romper funcionalidad.
   -------------------------------------------------------------------------- */

/* Convierte un .box de AdminLTE en .notary-card visualmente */
.box.notary-migrated {
  border-radius: 14px !important;
  border: 1px solid var(--app-border) !important;
  box-shadow: var(--app-card-shadow) !important;
}
.box.notary-migrated .box-header {
  border-radius: 14px 14px 0 0 !important;
  border-bottom: 1px solid var(--app-border) !important;
}

/* Convierte un .small-box en .notary-kpi */
.small-box.notary-migrated {
  border-radius: 14px !important;
  border: 1px solid var(--app-border) !important;
  box-shadow: var(--app-card-shadow) !important;
}

/* --------------------------------------------------------------------------
   10. WIDGET DE ACTIVIDAD RECIENTE
   -------------------------------------------------------------------------- */
.notary-activity-feed {
  list-style: none;
  padding: 0;
  margin: 0;
}
.notary-activity-feed > li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--app-border);
  align-items: flex-start;
}
.notary-activity-feed > li:last-child {
  border-bottom: 0;
}
.notary-activity-feed__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
  background: var(--app-primary);
}
.notary-activity-feed__content {
  flex: 1;
  min-width: 0;
}
.notary-activity-feed__title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--app-text);
  margin: 0 0 2px;
}
.notary-activity-feed__time {
  font-size: 0.75rem;
  color: var(--app-muted);
}

/* --------------------------------------------------------------------------
   11. QUICK ACTION BUTTONS (Acciones rápidas del dashboard)
   -------------------------------------------------------------------------- */
.notary-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.notary-quick-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 12px;
  color: var(--app-text);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  transition: all 140ms ease;
  box-shadow: var(--app-card-shadow);
}
.notary-quick-action:hover {
  background: var(--app-surface-2);
  border-color: var(--app-primary);
  color: var(--app-primary);
  transform: translateY(-1px);
  box-shadow: var(--app-elevated-shadow);
  text-decoration: none;
}
.notary-quick-action .fa,
.notary-quick-action .ion {
  font-size: 1.1rem;
  color: var(--app-primary);
}