/* =========================================================
   assets/estilos.css
   Estilos generales del sitio - paleta institucional SENA
   ========================================================= */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #eef1ef;
  color: #1a1a1a;
}

a { text-decoration: none; color: inherit; }

/* ---------- Login ---------- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(155deg, #04342C 0%, #062f24 55%, #08251c 100%);
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 900px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  border-radius: 16px;
  overflow: hidden;
}

.login-info {
  padding: 2.75rem 2.5rem;
  color: #ffffff;
}

.login-info h1 {
  font-size: 26px;
  font-weight: 500;
  line-height: 1.3;
  margin: 0 0 12px;
}

.login-info p {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  max-width: 340px;
  line-height: 1.6;
}

.login-form {
  background: #ffffff;
  padding: 2.75rem 2.5rem;
}

.login-form h2 {
  font-size: 19px;
  font-weight: 500;
  margin: 0 0 4px;
}

.login-form .subtitle {
  font-size: 13px;
  color: #5f5e5a;
  margin: 0 0 24px;
}

.field-label {
  font-size: 12px;
  font-weight: 500;
  color: #5f5e5a;
  display: block;
  margin-bottom: 6px;
}

input[type=text], input[type=password], input[type=number],
input[type=date], input[type=file], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #d8dad8;
  font-size: 14px;
  margin-bottom: 14px;
  font-family: inherit;
}

button, .btn {
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid #d8dad8;
  background: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: #39A900;
  color: #ffffff;
  border: none;
  width: 100%;
}

.tab-active {
  background: #39A900 !important;
  color: #ffffff !important;
  border-color: #39A900 !important;
}

.error-box {
  margin-top: 12px;
  font-size: 13px;
  color: #791f1f;
  background: #fcebeb;
  padding: 10px 12px;
  border-radius: 8px;
}

.login-help {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid #eee;
  font-size: 11px;
  color: #888780;
  line-height: 1.6;
}

/* ---------- Layout principal (sidebar + contenido) ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 230px;
  background: #04342C;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  color: #ffffff;
}

.sidebar-header {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar-header .badge {
  width: 32px; height: 32px; border-radius: 50%;
  background: #39A900;
  display: flex; align-items: center; justify-content: center;
  font-weight: 500;
}

.sidebar-nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }

.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.7);
}

.sidebar-nav a.active { background: #39A900; color: #ffffff; }
.sidebar-nav a:hover:not(.active) { background: rgba(255,255,255,0.08); }

.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,0.12); }

.sidebar-user { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

.sidebar-user .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; flex-shrink: 0;
}

.logout-btn {
  width: 100%; text-align: center; justify-content: center;
  background: transparent; border: 1px solid rgba(255,255,255,0.25); color: #fff;
}

/* ---------- Contenido principal ---------- */
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: #ffffff;
  border-bottom: 1px solid #e3e5e3;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}

.topbar h2 { margin: 0; font-size: 18px; font-weight: 500; }

.content-area { padding: 20px 24px 28px; flex: 1; }

/* ---------- Tarjetas y métricas ---------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.metric-card {
  background: #f4f6f5;
  border-radius: 8px;
  padding: 1rem;
}

.metric-card .label { font-size: 13px; color: #5f5e5a; }
.metric-card .value { font-size: 24px; font-weight: 500; margin-top: 8px; }

.card {
  background: #ffffff;
  border: 1px solid #e3e5e3;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 10px;
}

.card-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}

.muted { color: #5f5e5a; font-size: 12px; }

.badge-pill {
  font-size: 12px; font-weight: 500;
  padding: 3px 10px; border-radius: 8px;
  display: inline-block;
}

.badge-success { background: #eaf3de; color: #27500a; }
.badge-danger { background: #fcebeb; color: #791f1f; }
.badge-info { background: #e6f1fb; color: #0c447c; }
.badge-neutral { background: #f4f6f5; color: #5f5e5a; }

/* ---------- Tabla de ponderación ---------- */
table.grades-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grades-table th {
  text-align: left; padding: 8px 16px; font-size: 12px; color: #5f5e5a;
  border-bottom: 1px solid #e3e5e3;
}
table.grades-table th.right, table.grades-table td.right { text-align: right; }
table.grades-table td { padding: 10px 16px; border-bottom: 1px solid #eef1ef; }

.ficha-card {
  display: flex; flex-direction: column; background: #fff; border: 1px solid #e3e5e3; border-radius: 12px;
  padding: 1.25rem; height: 100%;
}
.ficha-card:hover { border-color: #39A900; }
.ficha-card a:hover strong { color: #39A900; }
.ficha-card strong { line-height: 1.3; }

.grid-fichas { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; align-items: stretch; }

.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item { padding: 10px 14px; border-bottom: 1px solid #eef1ef; font-size: 13px; }

.profile-header {
  background: #04342C; border-radius: 12px; padding: 2rem;
  display: flex; align-items: center; gap: 20px; color: #fff; margin-bottom: 24px; flex-wrap: wrap;
}
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%; background: #39A900;
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 500; flex-shrink: 0;
}

.progress-bar-bg { height: 6px; background: #eef1ef; border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; }

/* ---------- Menú móvil (oculto en escritorio) ---------- */
.menu-toggle {
  display: none;
  font-size: 20px;
  line-height: 1;
  padding: 6px 12px;
  border: 1px solid #d8dad8;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-overlay { display: none; }

/* ========================================================= 
   RESPONSIVE
   ========================================================= */

/* Tablet y pantallas medianas */
@media (max-width: 900px) {
  .login-card { grid-template-columns: 1fr; max-width: 440px; }
  .login-info { display: none; }
}

/* Móvil: el sidebar se vuelve un panel deslizable */
@media (max-width: 768px) {
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }

  /* El sidebar se saca del flujo y se desliza desde la izquierda */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 240px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1000;
  }
  .sidebar.sidebar-abierto { transform: translateX(0); }

  /* Capa oscura detrás del menú abierto */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
  }
  .sidebar-overlay.overlay-visible { display: block; }

  /* El contenido ocupa todo el ancho */
  .main-content { width: 100%; }
  .topbar { padding: 12px 16px; }
  .topbar h2 { font-size: 16px; }
  .content-area { padding: 16px 14px 24px; }

  /* Métricas y fichas en una sola columna */
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .grid-fichas { grid-template-columns: 1fr; }

  /* Tarjetas con menos padding */
  .card { padding: 12px 14px; }

  /* Tablas: permitir scroll horizontal si no caben */
  table.grades-table { display: block; overflow-x: auto; white-space: nowrap; }

  /* Encabezado de perfil más compacto */
  .profile-header { padding: 1.25rem; gap: 14px; }
  .profile-avatar { width: 56px; height: 56px; font-size: 20px; }
}

/* Móvil pequeño */
@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .login-wrapper { padding: 1rem; }
  .login-form { padding: 1.75rem 1.5rem; }
  .topbar h2 { font-size: 15px; }
}