/* ============================================================
   SYJ - Estilos Principales
   ============================================================ */

:root {
  --syj-primary:    #1a3c5e;
  --syj-secondary:  #2980b9;
  --syj-accent:     #f39c12;
  --syj-sidebar-w:  260px;
  --syj-bg:         #f0f2f5;
  --syj-card:       #ffffff;
  --syj-text:       #2c3e50;
  --syj-border:     #dee2e6;
  --syj-hover:      #2a4f82;
}

/* ---- Base ---- */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--syj-bg);
  color: var(--syj-text);
  min-height: 100vh;
}

/* ---- Login ---- */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--syj-primary) 0%, var(--syj-secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 420px;
  border: none;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  width: 72px;
  height: 72px;
  background: var(--syj-primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--syj-accent);
  margin: 0 auto 1rem;
  letter-spacing: -1px;
}

/* Logo imagen en login */
.login-logo-img {
  max-height: 180px;
  width: auto;
  display: block;
  margin: 0 auto;
}

/* ---- Layout principal ---- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
#sidebar {
  width: var(--syj-sidebar-w);
  min-height: 100vh;
  background: var(--syj-primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Logo en el sidebar */
.sidebar-logo {
  max-height: 104px;
  width: auto;
  background: #fff;
  border-radius: 10px;
  padding: 5px 10px;
  display: block;
}


.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.sidebar-section-title {
  padding: 0.75rem 1.5rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.5rem;
  color: rgba(255,255,255,0.75);
  font-size: 0.88rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-left-color: var(--syj-accent);
}

.sidebar-nav .nav-link i {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
}

/* ---- Contenido principal ---- */
#main-content {
  margin-left: var(--syj-sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--syj-border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--syj-primary);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--syj-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
}

/* ---- Page content ---- */
.page-content {
  padding: 1.5rem;
  flex: 1;
}

.page-header {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.page-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--syj-primary);
  margin: 0;
}

/* ---- Cards ---- */
.card {
  border: none;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.card-header-syj {
  background: var(--syj-primary);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 10px 10px 0 0 !important;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header-sub {
  background: #f8f9fa;
  color: var(--syj-primary);
  padding: 0.6rem 1rem;
  border-bottom: 2px solid var(--syj-accent);
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---- Stats cards ---- */
.stat-card {
  border-radius: 10px;
  padding: 1.25rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.stat-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-card-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.stat-card-label {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-top: 0.2rem;
}

/* ---- Tablas ---- */
.table-syj thead th {
  background: #f8f9fa;
  color: var(--syj-primary);
  font-weight: 600;
  font-size: 0.82rem;
  border-bottom: 2px solid var(--syj-border);
  white-space: nowrap;
}

.table-syj tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

.table-syj tbody tr:hover {
  background: #e8f4fd;
}

.table-syj tbody tr.selected {
  background: #d0e8f8 !important;
  border-left: 3px solid var(--syj-secondary);
}

.table-syj td {
  font-size: 0.85rem;
  vertical-align: middle;
}

/* ---- Paneles de detalle ---- */
.detail-panel {
  display: none;
  margin-top: 1rem;
  border-top: 3px solid var(--syj-accent);
}

.detail-panel.show {
  display: block;
}

/* ---- Botones ---- */
.btn-syj-primary {
  background: var(--syj-primary);
  color: #fff;
  border: none;
}
.btn-syj-primary:hover {
  background: var(--syj-hover);
  color: #fff;
}

.btn-action {
  padding: 0.2rem 0.45rem;
  font-size: 0.78rem;
}

/* ---- Formularios ---- */
.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.3rem;
}

.form-control, .form-select {
  font-size: 0.88rem;
  border-color: #ced4da;
}

.form-control:focus, .form-select:focus {
  border-color: var(--syj-secondary);
  box-shadow: 0 0 0 0.2rem rgba(41,128,185,0.15);
}

/* Select2 personalizado */
.select2-container--bootstrap-5 .select2-selection {
  font-size: 0.88rem;
  border-color: #ced4da;
}

/* ---- Modales ---- */
.modal-header {
  background: var(--syj-primary);
  color: #fff;
}

.modal-header .btn-close {
  filter: invert(1);
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
}

/* ---- DataTables personalizados ---- */
.dataTables_wrapper .dataTables_filter input {
  font-size: 0.85rem;
  border: 1px solid #ced4da;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
}

.dataTables_wrapper .dataTables_length select {
  font-size: 0.85rem;
  border: 1px solid #ced4da;
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
}

.dataTables_wrapper .dataTables_info {
  font-size: 0.8rem;
  color: #6c757d;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.show {
    transform: translateX(0);
  }
  #main-content {
    margin-left: 0;
  }
  .page-content {
    padding: 1rem;
  }
}

/* ---- Utilidades ---- */
.border-left-accent {
  border-left: 4px solid var(--syj-accent) !important;
}

.text-syj {
  color: var(--syj-primary) !important;
}

.bg-syj {
  background: var(--syj-primary) !important;
}

.badge-rol-admin    { background: #6f42c1; }
.badge-rol-contador { background: #0d6efd; }
.badge-rol-cliente  { background: #198754; }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Indicador de fila seleccionada en el panel maestro */
.row-selected-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--syj-accent);
  margin-right: 4px;
}
