/* ============================================================
   Metanoia Gestion - sistema de diseno
   Derivado de los mockups aprobados en el Avance 2 (_base.css).
   No modificar los valores de color sin actualizar los mockups:
   el diseno fue evaluado por la supervisora.
   ============================================================ */

:root {
  --primary:        #6B3FA0;
  --primary-dark:   #4A2875;
  --primary-light:  #8B5CC8;
  --primary-xlight: #EDE0FF;
  --sidebar-bg:     #2D1B54;
  --sidebar-text:   #C9B3F0;
  --sidebar-active: #6B3FA0;
  --body-bg:        #F4F2F8;
  --card-bg:        #FFFFFF;
  --text-main:      #1E1030;
  --text-muted:     #6B6480;
  --border:         #E2DAF0;
  --success:        #198754;
  --warning:        #E07B00;
  --danger:         #DC3545;
  --sidebar-width:  240px;
}

body {
  background: var(--body-bg);
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: var(--text-main);
}

/* ── Sidebar ── */
.sidebar {
  /* Altura fija, no minima: con min-height la barra crece por encima de la
     ventana cuando el menu es largo y el pie -donde estan el usuario y el
     boton de cerrar sesion- queda fuera de la pantalla. Con height fija, el
     bloque de navegacion se desplaza por dentro y el pie queda siempre a la
     vista. */
  width: var(--sidebar-width); height: 100vh;
  background: var(--sidebar-bg); position: fixed; top: 0; left: 0;
  display: flex; flex-direction: column; z-index: 100;
}
.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center;
}
.sidebar-brand .brand-icon {
  width: 36px; height: 36px; background: var(--primary);
  border-radius: 8px; display: inline-flex; align-items: center;
  justify-content: center; margin-right: .6rem;
  font-size: 1rem; color: #fff; flex-shrink: 0;
}
.sidebar-brand .brand-name { color: #fff; font-weight: 700; font-size: .95rem; line-height: 1.1; }
.sidebar-brand .brand-sub  { color: var(--sidebar-text); font-size: .7rem; }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-section-label {
  color: rgba(255,255,255,.35); font-size: .65rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  padding: .75rem 1.25rem .25rem;
}
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem 1.25rem; color: var(--sidebar-text);
  font-size: .875rem; border-radius: 0; transition: all .15s;
  text-decoration: none; border-left: 3px solid transparent;
}
.sidebar-nav .nav-link i { width: 16px; text-align: center; opacity: .8; }
.sidebar-nav .nav-link:hover  { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .nav-link.active { background: rgba(107,63,160,.35); color: #fff; border-left-color: var(--primary-light); }
/* Modulos aun no construidos: visibles para mostrar el alcance, sin enlace. */
.sidebar-nav .nav-link.pendiente { opacity: .38; cursor: default; }
.sidebar-nav .nav-link.pendiente:hover { background: transparent; color: var(--sidebar-text); }
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer .user-name  { color: #fff; font-size: .8rem; font-weight: 600; }
.sidebar-footer .user-role  { color: var(--sidebar-text); font-size: .7rem; }
.btn-salir {
  background: none; border: none; padding: 0; margin-left: auto;
  color: var(--sidebar-text); cursor: pointer; line-height: 1;
}
.btn-salir:hover { color: #fff; }

/* ── Layout principal ── */
.main-wrapper { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  background: var(--card-bg); border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 50;
}
.topbar .page-title   { font-size: 1rem; font-weight: 600; color: var(--text-main); margin: 0; }
.topbar .topbar-right { display: flex; align-items: center; gap: 1rem; }
.main-content { flex: 1; padding: 1.75rem 1.5rem; }

/* ── Tarjetas de indicador ── */
.stat-card { background: var(--card-bg); border-radius: 12px; padding: 1.25rem 1.5rem; border: 1px solid var(--border); height: 100%; }
.stat-card .stat-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; margin-bottom: .75rem;
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { color: var(--text-muted); font-size: .8rem; margin-top: .2rem; }
.stat-card .stat-delta { font-size: .75rem; margin-top: .5rem; }
.stat-card .stat-delta.up   { color: var(--success); }
.stat-card .stat-delta.down { color: var(--danger); }

/* ── Paneles ── */
.panel { background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border); }
.panel-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.panel-header .panel-title { font-size: .875rem; font-weight: 600; margin: 0; }
.panel-body { padding: 1.25rem; }

/* ── Distintivos ── */
.badge-active   { background: #D1FAE5; color: #065F46; font-size: .7rem; padding: .2em .6em; border-radius: 99px; font-weight: 600; }
.badge-inactive { background: #F3F4F6; color: #6B7280; font-size: .7rem; padding: .2em .6em; border-radius: 99px; font-weight: 600; }
.badge-pending  { background: #FEF3C7; color: #92400E; font-size: .7rem; padding: .2em .6em; border-radius: 99px; font-weight: 600; }
.badge-primary  { background: var(--primary-xlight); color: var(--primary-dark); font-size: .7rem; padding: .2em .6em; border-radius: 99px; font-weight: 600; }

/* ── Botones ── */
.btn-primary-custom {
  background: var(--primary); color: #fff; border: none;
  padding: .5rem 1.25rem; border-radius: 8px; font-size: .875rem;
  font-weight: 500; cursor: pointer; transition: background .15s;
}
.btn-primary-custom:hover { background: var(--primary-dark); color: #fff; }
.btn-outline-custom {
  background: transparent; color: var(--primary); border: 1.5px solid var(--primary);
  padding: .45rem 1.2rem; border-radius: 8px; font-size: .875rem;
  font-weight: 500; cursor: pointer; transition: all .15s;
}
.btn-outline-custom:hover { background: var(--primary-xlight); }

/* ── Formularios ── */
.form-label-custom { font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .04em; }
.form-control:focus, .form-select:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(107,63,160,.12); }

/* ── Tablas ── */
.table-metanoia th { background: var(--body-bg); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.table-metanoia td { font-size: .875rem; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table-metanoia tbody tr:hover { background: var(--primary-xlight); }

/* ── Avatar ── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; flex-shrink: 0;
}

/* ============================================================
   Pantalla de acceso
   ============================================================ */
.acceso-body {
  min-height: 100vh; margin: 0;
  background: linear-gradient(135deg, #2D1B54 0%, #4A2875 50%, #6B3FA0 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-wrapper { width: 100%; max-width: 420px; padding: 1.5rem; }
.login-card {
  background: #fff; border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  overflow: hidden;
}
.login-header {
  background: linear-gradient(135deg, #4A2875, #6B3FA0);
  padding: 2rem 2rem 1.75rem; text-align: center;
}
.login-logo {
  width: 56px; height: 56px; background: rgba(255,255,255,.15);
  border-radius: 14px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 1.5rem; color: #fff; margin-bottom: 1rem;
}
.login-header h1 { color: #fff; font-size: 1.2rem; font-weight: 700; margin: 0 0 .25rem; }
.login-header p  { color: rgba(255,255,255,.7); font-size: .8rem; margin: 0; }
.login-body { padding: 2rem; }
.login-body .form-label { font-size: .78rem; font-weight: 600; color: #6B6480; text-transform: uppercase; letter-spacing: .04em; }
.login-body .form-control {
  border: 1.5px solid #E2DAF0; border-radius: 8px;
  padding: .65rem .9rem; font-size: .9rem; transition: all .15s;
}
.login-body .input-group .input-group-text { background: #F4F2F8; border: 1.5px solid #E2DAF0; border-right: none; border-radius: 8px 0 0 8px; color: #8B5CC8; }
.login-body .input-group .form-control { border-left: none; border-radius: 0 8px 8px 0; }
.btn-login {
  width: 100%; background: var(--primary); color: #fff; border: none;
  border-radius: 8px; padding: .75rem; font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: all .2s; letter-spacing: .02em;
}
.btn-login:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(107,63,160,.35); }
.forgot-link { color: var(--primary); font-size: .8rem; text-decoration: none; display: block; text-align: right; margin-top: .35rem; }
.forgot-link:hover { text-decoration: underline; }
.login-footer { padding: 1rem 2rem; background: #F9F7FD; text-align: center; border-top: 1px solid #E2DAF0; }
.login-footer p { margin: 0; font-size: .72rem; color: #9B8DB0; }
.role-hint {
  background: var(--primary-xlight); border-radius: 8px;
  padding: .65rem .9rem; display: flex; gap: .5rem; align-items: flex-start;
  font-size: .78rem; color: #4A2875;
}
.role-hint i { margin-top: .1rem; color: var(--primary); }
.login-error {
  background: #FDECEA; border: 1px solid #F5C2C0; color: #8A1F1A;
  border-radius: 8px; padding: .65rem .9rem; font-size: .82rem;
  display: flex; gap: .5rem; align-items: flex-start;
}
.login-error i { margin-top: .15rem; }

/* ── Responsivo ── */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.abierta { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 99;
  }
}
@media (min-width: 992px) {
  .btn-menu, .sidebar-backdrop { display: none !important; }
}
