/* =====================================================================
   trabajosenmexico.mx – admin.css  (rediseño profesional)
   ===================================================================== */

:root {
  --mx-green:    #006847;
  --mx-green2:   #00845a;
  --sidebar-bg:  #0f1923;
  --sidebar-w:   260px;
  --topbar-h:    60px;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #ffffff;
  --sidebar-active-bg: rgba(0,104,71,.35);
  --sidebar-active-border: #00d98b;
  --sidebar-section: #4b5563;
  --topbar-bg:   #ffffff;
  --body-bg:     #f0f4f8;
}

/* =====================================================================
   BASE
   ===================================================================== */
* { box-sizing: border-box; }
body.admin-body { background: var(--body-bg); font-family: 'Inter', sans-serif; margin: 0; }

/* =====================================================================
   TOPBAR
   ===================================================================== */
.admin-topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 1030;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}
.topbar-left  { display: flex; align-items: center; gap: .75rem; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }

.btn-toggle {
  width: 38px; height: 38px; border: none; border-radius: 10px;
  background: #f3f4f6; color: #374151;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem;
  transition: background .15s, color .15s;
}
.btn-toggle:hover { background: #e5e7eb; color: var(--mx-green); }

.topbar-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--mx-green);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .85rem;
}
.topbar-brand {
  display: flex; align-items: center; gap: .5rem;
  text-decoration: none; font-weight: 800; font-size: .95rem;
  color: #111827; letter-spacing: -.3px;
}
.topbar-brand:hover { color: var(--mx-green); }
.topbar-brand .text-warning { color: #f59e0b !important; }

.topbar-action {
  display: flex; align-items: center; gap: .4rem;
  color: #6b7280; font-size: .85rem; text-decoration: none;
  padding: .35rem .75rem; border-radius: 8px;
  border: 1px solid #e5e7eb; transition: all .15s;
}
.topbar-action:hover { color: var(--mx-green); border-color: var(--mx-green); background: #f0fdf4; }
.topbar-divider { width: 1px; height: 24px; background: #e5e7eb; }

.topbar-user {
  display: flex; align-items: center; gap: .6rem;
  background: none; border: none; cursor: pointer;
  padding: .35rem .6rem; border-radius: 10px;
  transition: background .15s;
}
.topbar-user:hover { background: #f3f4f6; }
.topbar-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--mx-green), #00d98b);
  color: #fff; font-weight: 800; font-size: .95rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.topbar-user-name { font-size: .85rem; font-weight: 600; color: #111827; line-height: 1.2; }
.topbar-user-role { font-size: .72rem; color: #9ca3af; line-height: 1; }

/* =====================================================================
   LAYOUT
   ===================================================================== */
.admin-layout { display: flex; padding-top: var(--topbar-h); min-height: 100vh; }

/* =====================================================================
   SIDEBAR
   ===================================================================== */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  z-index: 1020;
  scrollbar-width: thin;
  scrollbar-color: #374151 transparent;
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: #374151; border-radius: 2px; }

.admin-sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }
@media (max-width: 991px) {
  .admin-sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .admin-sidebar.open { transform: translateX(0); }
}

/* Panel de usuario */
.sidebar-user-panel {
  display: flex; align-items: center; gap: .85rem;
  padding: 1.25rem 1.1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  margin-bottom: .5rem;
}
.sup-avatar {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--mx-green), #00d98b);
  color: #fff; font-weight: 800; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,104,71,.4);
}
.sup-name { font-size: .88rem; font-weight: 700; color: #f1f5f9; line-height: 1.2; }
.sup-role { font-size: .7rem; color: #00d98b; font-weight: 500; margin-top: 2px; }

/* Nav */
.sidebar-nav { flex: 1; padding: .25rem 0 1rem; }
.nav-section-label {
  padding: 1.1rem 1.25rem .35rem;
  font-size: .65rem; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--sidebar-section);
}
.nav-link-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1.1rem; margin: 2px .7rem;
  border-radius: 10px;
  color: var(--sidebar-text);
  text-decoration: none; font-size: .875rem; font-weight: 500;
  transition: background .18s, color .18s;
  position: relative;
}
.nav-link-item:hover { background: rgba(255,255,255,.07); color: var(--sidebar-text-hover); }
.nav-link-item.active { background: var(--sidebar-active-bg); color: #fff; font-weight: 600; }
.nav-link-item.active::before {
  content: ''; position: absolute; left: -0.7rem;
  top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--sidebar-active-border);
  border-radius: 0 3px 3px 0;
}
.nli-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; background: rgba(255,255,255,.06); flex-shrink: 0;
  transition: background .18s;
}
.nav-link-item:hover .nli-icon { background: rgba(255,255,255,.12); }
.nav-link-item.active .nli-icon { background: rgba(0,217,139,.2); color: #00d98b; }
.nli-label { flex: 1; }
.nli-badge {
  background: #ef4444; color: #fff;
  font-size: .65rem; font-weight: 700;
  padding: .15rem .45rem; border-radius: 20px;
  min-width: 20px; text-align: center; line-height: 1.4;
}

/* Footer del sidebar */
.sidebar-footer {
  padding: .75rem 1rem 1rem;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex; flex-direction: column; gap: .25rem;
}
.sidebar-footer-link {
  display: flex; align-items: center;
  padding: .5rem .85rem; border-radius: 8px;
  font-size: .8rem; font-weight: 500;
  color: var(--sidebar-text); text-decoration: none;
  transition: background .15s, color .15s;
}
.sidebar-footer-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-footer-link.text-danger { color: #f87171 !important; }
.sidebar-footer-link.text-danger:hover { background: rgba(239,68,68,.12); }

/* =====================================================================
   CONTENT AREA
   ===================================================================== */
.admin-content { flex: 1; margin-left: var(--sidebar-w); transition: margin .25s; }
.admin-content.sidebar-collapsed { margin-left: 0; }
@media (max-width: 991px) { .admin-content { margin-left: 0; } }
.admin-main-wrap { padding: 1.75rem 2rem; min-height: calc(100vh - var(--topbar-h)); }

/* =====================================================================
   PAGE HEADER
   ===================================================================== */
.admin-page-header { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid #e5e7eb; }
.admin-page-header h4 { font-weight: 800; }

/* =====================================================================
   KPI CARDS
   ===================================================================== */
.kpi-card {
  border-radius: 16px; padding: 1.25rem 1.4rem;
  color: #fff; position: relative; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
}
.kpi-card::after {
  content: ''; position: absolute; right: -25px; top: -25px;
  width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.08);
}
.kpi-primary { background: linear-gradient(135deg, #006847, #00b070); }
.kpi-success { background: linear-gradient(135deg, #0f9d58, #10b981); }
.kpi-warning { background: linear-gradient(135deg, #d97706, #f59e0b); }
.kpi-info    { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.kpi-value   { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.kpi-label   { font-size: .75rem; opacity: .9; text-transform: uppercase; letter-spacing: .5px; margin-top: .2rem; }
.kpi-sub     { font-size: .72rem; opacity: .7; margin-top: .25rem; }
.kpi-icon    { position: absolute; right: 1.25rem; top: 50%; transform: translateY(-50%); font-size: 2.5rem; opacity: .15; }

/* =====================================================================
   ADMIN TABLE
   ===================================================================== */
.admin-table { font-size: .875rem; }
.admin-table th {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: #6b7280;
  background: #f9fafb; border-bottom: 2px solid #e5e7eb;
  padding: .7rem 1rem; white-space: nowrap;
}
.admin-table td { padding: .75rem 1rem; vertical-align: middle; border-color: #f3f4f6; color: #374151; }
.admin-table tbody tr { transition: background .1s; }
.admin-table tbody tr:hover { background: #f9fafb; }

/* =====================================================================
   UTILITIES & MISC
   ===================================================================== */
.btn-xs { padding: .22rem .55rem; font-size: .75rem; border-radius: .3rem; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.flex-1 { flex: 1; }

/* Login */
.admin-login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f1923 0%, #012c1e 100%);
  display: flex; align-items: center; justify-content: center; padding: 2rem;
}
.admin-login-icon {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--mx-green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; margin: 0 auto 1rem;
  box-shadow: 0 8px 24px rgba(0,104,71,.4);
}

/* Candidato avatar */
.candidato-avatar { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; margin: 0 auto; }
.candidato-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-admin-placeholder {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--mx-green), #00d98b);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.8rem; font-weight: 800;
}
.cand-avatar-sm { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.cand-avatar-sm img { width: 100%; height: 100%; object-fit: cover; }
.avatar-admin-placeholder-sm {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--mx-green), #00d98b);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
}
.cat-admin-icon {
  width: 56px; height: 56px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

/* ----- Admin Login --------------------------------------------------- */
.admin-login-bg {
  min-height:100vh;
  background:linear-gradient(135deg,#0d1208 0%,#012c1e 100%);
  display:flex; align-items:center; justify-content:center; padding:2rem;
}
.admin-login-icon {
  width:64px; height:64px; border-radius:16px;
  background:var(--mx-green); color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:1.6rem; margin:0 auto 1rem;
}

/* =====================================================================
   OVERLAY SIDEBAR (MÓVIL)
   ===================================================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1019;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* =====================================================================
   ACCIONES RÁPIDAS
   ===================================================================== */
.quick-action-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .4rem; padding: .85rem .5rem;
  border-radius: 12px; border: 1.5px solid #e5e7eb;
  background: #fff; text-decoration: none; color: #374151;
  font-size: .75rem; font-weight: 600; text-align: center;
  transition: border-color .18s, color .18s, background .18s, box-shadow .18s;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.quick-action-btn:hover {
  border-color: var(--mx-green); color: var(--mx-green);
  background: #f0fdf4; box-shadow: 0 4px 12px rgba(0,104,71,.1);
}
.quick-action-btn .qa-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
}

/* =====================================================================
   TARJETA DE APLICACIÓN (vista móvil)
   ===================================================================== */
.aplic-card-mobile {
  display: none;
  padding: .9rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}
.aplic-card-mobile:last-child { border-bottom: 0; }

/* =====================================================================
   RESPONSIVE – PANTALLAS PEQUEÑAS
   ===================================================================== */
@media (max-width: 575px) {
  .admin-main-wrap { padding: .85rem .75rem; }
  .kpi-value { font-size: 1.75rem; }
  .kpi-icon  { font-size: 1.9rem; }
  .kpi-card  { padding: 1rem 1.1rem; border-radius: 14px; }
  .kpi-label { font-size: .7rem; }
  .admin-page-header { margin-bottom: .85rem; padding-bottom: .75rem; }

  /* Tabla aplicaciones → ocultar en xs, mostrar tarjetas */
  .aplics-table-wrap { display: none; }
  .aplic-card-mobile { display: flex; }
}

@media (min-width: 576px) and (max-width: 767px) {
  .admin-main-wrap { padding: 1rem; }
  .kpi-value { font-size: 1.9rem; }
  .kpi-card  { padding: 1.1rem 1.2rem; }
}

@media (max-width: 767px) {
  /* Topbar: ocultar secciones menos importantes */
  .topbar-action { display: none !important; }
  .topbar-divider { display: none !important; }

  /* Gráfica más compacta */
  #chartAplics { max-height: 180px !important; }

  /* Padding de cards */
  .card-header.bg-white.pt-4 { padding-top: 1rem !important; padding-left: 1rem !important; padding-right: 1rem !important; }
  .card-body.p-4 { padding: 1rem !important; }
  .card-body.px-4 { padding-left: 1rem !important; padding-right: 1rem !important; }
}

@media (max-width: 991px) {
  /* Botón toggle más visible en móvil */
  #sidebarToggle { background: var(--mx-green) !important; color: #fff !important; }
  #sidebarToggle:hover { background: var(--mx-green2) !important; }
}

/* =====================================================================
   FIN
   ===================================================================== */
