/* Estilos personalizados para el Portal de Proveedores CFDI */

:root {
  --primary-color: #0d6efd;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --info-color: #0dcaf0;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --light-color: #f8f9fa;
  --dark-color: #212529;
}

body {
  --navbar-offset: 64px; /* fallback por defecto */
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fa;
  padding-top: var(--navbar-offset);
}

/* Solo animar el offset cuando realmente cambia (controlado por JS) */
body.navbar-offset-anim {
  transition: padding-top 150ms ease-in-out;
}

@media (max-width: 991.98px) {
  body { --navbar-offset: 56px; }
}

/* Accesibilidad: respetar usuarios con reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  body, body.navbar-offset-anim { transition: none !important; }
}

/* Offset utilidades y transiciones para elementos vinculados a la navbar */
html { scroll-padding-top: var(--navbar-offset); }
.pt-navbar { padding-top: var(--navbar-offset) !important; }
.mt-navbar { margin-top: var(--navbar-offset) !important; }
.sticky-under-navbar { position: sticky; top: var(--navbar-offset); z-index: 100; }
.transition-offset { transition: margin-top 150ms ease-in-out, padding-top 150ms ease-in-out, top 150ms ease-in-out; }

/* Navbar */
.navbar {
  box-shadow: 0 2px 4px rgba(0,0,0,.06);
}

.navbar-modern .navbar-brand {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.navbar-modern .brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, rgba(255,255,255,.25), rgba(255,255,255,.15));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), 0 2px 6px rgba(0,0,0,.12);
}

.navbar-modern--dark .navbar-brand,
.navbar-modern--dark .nav-link {
  color: rgba(255,255,255,.9);
}

.navbar-modern--dark .nav-link:hover,
.navbar-modern--dark .nav-link:focus {
  color: #fff;
  background-color: rgba(255,255,255,.1);
  border-radius: .375rem;
}

.navbar-modern--dark .nav-link.active {
  color: #fff;
  font-weight: 600;
  position: relative;
}

.navbar-modern--dark .nav-link.active::after {
  content: '';
  position: absolute;
  left: .6rem;
  right: .6rem;
  bottom: .2rem;
  height: 2px;
  background: rgba(255,255,255,.9);
  border-radius: 2px;
}

.avatar-initial {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255,255,255,.2);
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
}

.badge-notify {
  min-width: 18px;
  height: 18px;
  line-height: 14px;
  font-size: .65rem;
}

/* Optimización de composición para navbars fijas */
.navbar.fixed-top {
  will-change: transform;
  transform: translateZ(0);
}

/* Cards */
.card {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  border: 1px solid rgba(0, 0, 0, 0.125);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
  font-weight: 600;
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

/* Tablas */
.table th {
  border-top: 0;
  font-weight: 600;
}

.table-hover tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Badges */
.badge {
  font-size: 0.75em;
  font-weight: 600;
}

/* Botones */
.btn {
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: #0b5ed7;
  border-color: #0a58ca;
}

/* Formularios */
.form-control, .form-select {
  border-radius: 0.375rem;
  border: 1px solid #ced4da;
}

.form-control:focus, .form-select:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Alertas */
.alert {
  border: none;
  border-radius: 0.375rem;
}

.alert-dismissible .btn-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  z-index: 2;
}

/* Paginación */
.page-link {
  border-radius: 0.375rem !important;
  margin: 0 0.125rem;
}

.page-item.active .page-link {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* Timeline */
.timeline {
  position: relative;
  padding: 1rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: #e9ecef;
  left: 20px;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
}

.timeline-badge {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  z-index: 1;
}

.timeline-content {
  margin-left: 60px;
}

/* Progress bar */
.progress {
  border-radius: 0.375rem;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }
  
  .table-responsive {
    font-size: 0.875rem;
  }
  
  .card {
    margin-bottom: 1rem;
  }
  
  .timeline::before {
    left: 15px;
  }
  
  .timeline-badge {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
  }
  
  .timeline-content {
    margin-left: 45px;
  }
}
