/* ==========================================================================
   NOTARIA-41 — BIBLIOTECA DE COMPONENTES REUTILIZABLES
   FASE 2.1 del PLAN_EJECUCION
   Compatible con temas: Light / Dark / Custom
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. NOTARY CARD — Reemplazo de AdminLTE .box
   -------------------------------------------------------------------------- */
.notary-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 14px;
  box-shadow: var(--app-card-shadow, 0 8px 22px rgba(31, 45, 58, 0.07));
  overflow: hidden;
  margin-bottom: 20px;
  transition: box-shadow 180ms ease;
}
.notary-card:hover {
  box-shadow: var(--app-elevated-shadow, 0 14px 34px rgba(31, 45, 58, 0.10));
}
.notary-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--app-surface-2);
  border-bottom: 1px solid var(--app-border);
  min-height: 52px;
  gap: 12px;
}
.notary-card-header h3,
.notary-card-header .notary-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--app-text);
  letter-spacing: -0.2px;
}
.notary-card-header .notary-card-subtitle {
  font-size: 0.8rem;
  color: var(--app-muted);
  font-weight: 500;
}
.notary-card-body {
  padding: 20px;
  color: var(--app-text);
}
.notary-card-footer {
  padding: 12px 20px;
  background: var(--app-surface-2);
  border-top: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Variantes de borde superior por color semántico */
.notary-card--primary { border-top: 4px solid var(--app-primary); }
.notary-card--success { border-top: 4px solid var(--app-success-solid); }
.notary-card--warning { border-top: 4px solid var(--app-warning-solid); }
.notary-card--danger  { border-top: 4px solid var(--app-danger-solid); }
.notary-card--info    { border-top: 4px solid var(--app-info-solid); }


/* --------------------------------------------------------------------------
   2. NOTARY TABLE — Tablas consistentes con temas
   -------------------------------------------------------------------------- */
.notary-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 0;
}
.notary-table thead th {
  background: var(--app-table-head);
  color: var(--app-text);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  border-bottom: 2px solid var(--app-border);
  vertical-align: middle;
  white-space: nowrap;
}
.notary-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--app-border);
  color: var(--app-text);
  vertical-align: middle;
}
.notary-table tbody tr {
  transition: background-color 140ms ease;
}
.notary-table tbody tr:hover {
  background-color: var(--app-table-hover);
}
.notary-table tbody tr:nth-child(even) {
  background-color: var(--app-table-row-alt, var(--app-surface-2));
}
.notary-table tbody tr:nth-child(even):hover {
  background-color: var(--app-table-hover);
}
.notary-table--sm thead th,
.notary-table--sm tbody td {
  padding: 6px 10px;
  font-size: 0.82rem;
}
.notary-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--app-border);
  background: var(--app-surface);
}


/* --------------------------------------------------------------------------
   3. NOTARY FORM — Formularios unificados
   -------------------------------------------------------------------------- */
.notary-form-group {
  margin-bottom: 16px;
}
.notary-form-label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--app-text);
  margin-bottom: 5px;
}
.notary-form-label--required::after {
  content: " *";
  color: var(--app-danger-solid);
  font-weight: 700;
}
.notary-form-control {
  display: block;
  width: 100%;
  padding: 9px 13px;
  font-size: 0.92rem;
  color: var(--app-input-text);
  background-color: var(--app-input-bg);
  border: 1.5px solid var(--app-border);
  border-radius: 10px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.notary-form-control:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px var(--app-focus-ring);
  outline: none;
}
.notary-form-control::placeholder {
  color: var(--app-input-placeholder);
}
.notary-form-control.is-valid {
  border-color: var(--app-success-solid);
}
.notary-form-control.is-invalid {
  border-color: var(--app-danger-solid);
}
.notary-form-control.is-loading {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8'%3E%3Ccircle cx='12' cy='12' r='10' stroke-width='2'/%3E%3Cpath d='M12 2a10 10 0 0 1 10 10' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}

/* Textarea */
.notary-form-textarea {
  resize: vertical;
  min-height: 90px;
}

/* Select */
.notary-form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2394a3b8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Checkbox & Radio */
.notary-form-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: var(--app-text);
  font-size: 0.9rem;
}


/* --------------------------------------------------------------------------
   4. NOTARY MODAL — Modales unificados
   -------------------------------------------------------------------------- */
.notary-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.notary-modal {
  background: var(--app-surface);
  border-radius: 16px;
  box-shadow: var(--app-elevated-shadow);
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--app-border);
}
.notary-modal--sm { max-width: 400px; }
.notary-modal--lg { max-width: 780px; }
.notary-modal--xl { max-width: 960px; }

.notary-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: var(--app-surface-2);
  border-bottom: 1px solid var(--app-border);
}
.notary-modal-header h4 {
  margin: 0;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--app-text);
}
.notary-modal-close {
  background: transparent;
  border: 0;
  font-size: 1.4rem;
  color: var(--app-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  line-height: 1;
  transition: background-color 140ms ease, color 140ms ease;
}
.notary-modal-close:hover {
  background: var(--app-surface-3, var(--app-active-bg));
  color: var(--app-text);
}
.notary-modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
  color: var(--app-text);
}
.notary-modal-footer {
  padding: 12px 22px;
  background: var(--app-surface-2);
  border-top: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}


/* --------------------------------------------------------------------------
   5. NOTARY KPI — Indicadores numéricos
   -------------------------------------------------------------------------- */
.notary-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.notary-kpi {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--app-card-shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.notary-kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--app-elevated-shadow);
}
.notary-kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--app-muted);
  margin-bottom: 6px;
}
.notary-kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--app-text);
  letter-spacing: -0.5px;
}
.notary-kpi-change {
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 4px;
}
.notary-kpi-change--up   { color: var(--app-success-solid); }
.notary-kpi-change--down { color: var(--app-danger-solid); }
.notary-kpi-icon {
  float: right;
  font-size: 2.2rem;
  opacity: 0.18;
  color: var(--app-primary);
  margin-top: -36px;
}


/* --------------------------------------------------------------------------
   6. NOTARY BADGE — Etiquetas / estados
   -------------------------------------------------------------------------- */
.notary-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.notary-badge--primary {
  background: var(--app-info-bg);
  color: var(--app-info-text);
}
.notary-badge--success {
  background: var(--app-success-bg);
  color: var(--app-success-text);
}
.notary-badge--warning {
  background: var(--app-warning-bg);
  color: var(--app-warning-text);
}
.notary-badge--danger {
  background: var(--app-danger-bg);
  color: var(--app-danger-text);
}
.notary-badge--solid-primary {
  background: var(--app-primary);
  color: #ffffff;
}
.notary-badge--solid-success {
  background: var(--app-success-solid);
  color: #ffffff;
}
.notary-badge--solid-danger {
  background: var(--app-danger-solid);
  color: #ffffff;
}
.notary-badge--solid-warning {
  background: var(--app-warning-solid);
  color: #ffffff;
}


/* --------------------------------------------------------------------------
   7. NOTARY EMPTY STATE — Estado vacío reutilizable
   -------------------------------------------------------------------------- */
.notary-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--app-muted);
  min-height: 240px;
}
.notary-empty-state-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.4;
  color: var(--app-muted);
}
.notary-empty-state-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--app-text);
  margin-bottom: 6px;
}
.notary-empty-state-message {
  font-size: 0.9rem;
  color: var(--app-muted);
  max-width: 360px;
  margin-bottom: 18px;
  line-height: 1.5;
}
.notary-empty-state-action {
  margin-top: 4px;
}


/* --------------------------------------------------------------------------
   8. NOTARY SKELETON — Placeholder de carga
   -------------------------------------------------------------------------- */
.notary-skeleton {
  background: linear-gradient(90deg,
    var(--app-surface-2) 25%,
    var(--app-surface-3, var(--app-border)) 50%,
    var(--app-surface-2) 75%
  );
  background-size: 200% 100%;
  animation: notary-skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes notary-skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.notary-skeleton-row {
  height: 16px;
  margin-bottom: 10px;
}
.notary-skeleton-row--sm { width: 40%; }
.notary-skeleton-row--md { width: 70%; }
.notary-skeleton-row--lg { width: 90%; }

.notary-skeleton-card {
  min-height: 160px;
  border-radius: 14px;
  margin-bottom: 16px;
}
.notary-skeleton-table {
  width: 100%;
}
.notary-skeleton-table .notary-skeleton-row {
  height: 40px;
  border-radius: 6px;
}


/* --------------------------------------------------------------------------
   9. NOTARY BTN — Botones unificados (complemento a .btn de AdminLTE)
   -------------------------------------------------------------------------- */
.notary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 160ms ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.notary-btn--primary {
  background: var(--app-primary);
  color: #ffffff;
  border-color: var(--app-primary);
}
.notary-btn--primary:hover {
  background: var(--app-primary-hover);
  border-color: var(--app-primary-hover);
}
.notary-btn--success {
  background: var(--app-success-solid);
  color: #ffffff;
  border-color: var(--app-success-solid);
}
.notary-btn--success:hover {
  filter: brightness(0.9);
}
.notary-btn--danger {
  background: var(--app-danger-solid);
  color: #ffffff;
  border-color: var(--app-danger-solid);
}
.notary-btn--danger:hover {
  filter: brightness(0.9);
}
.notary-btn--warning {
  background: var(--app-warning-solid);
  color: #ffffff;
  border-color: var(--app-warning-solid);
}
.notary-btn--warning:hover {
  filter: brightness(0.9);
}
.notary-btn--outline {
  background: transparent;
  color: var(--app-text);
  border-color: var(--app-border);
}
.notary-btn--outline:hover {
  background: var(--app-surface-2);
  border-color: var(--app-primary);
  color: var(--app-primary);
}
.notary-btn--ghost {
  background: transparent;
  color: var(--app-text);
  border-color: transparent;
}
.notary-btn--ghost:hover {
  background: var(--app-surface-2);
}
.notary-btn:disabled,
.notary-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.notary-btn--sm { padding: 5px 12px; font-size: 0.8rem; border-radius: 8px; }
.notary-btn--lg { padding: 11px 24px; font-size: 1rem; border-radius: 12px; }

/* Botón con ícono circular */
.notary-btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
}
.notary-btn-icon.notary-btn--sm { width: 30px; height: 30px; }
.notary-btn-icon.notary-btn--lg { width: 46px; height: 46px; }


/* --------------------------------------------------------------------------
   10. NOTARY PAGE HEADER — Encabezado de página consistente
   -------------------------------------------------------------------------- */
.notary-page-header {
  margin-bottom: 22px;
}
.notary-page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--app-text);
  letter-spacing: -0.3px;
  margin: 0 0 4px;
}
.notary-page-subtitle {
  font-size: 0.88rem;
  color: var(--app-muted);
  font-weight: 500;
}


/* --------------------------------------------------------------------------
   11. NOTARY SEPARATOR / DIVIDER
   -------------------------------------------------------------------------- */
.notary-divider {
  border: 0;
  height: 1px;
  background: var(--app-border);
  margin: 18px 0;
}
.notary-divider--dashed {
  border-top: 1.5px dashed var(--app-border);
  background: transparent;
}


/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .notary-card-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
  }
  .notary-card-body {
    padding: 14px;
  }
  .notary-kpi-grid {
    grid-template-columns: 1fr;
  }
  .notary-modal {
    max-width: 95vw;
    border-radius: 12px;
  }
}