/* ============================================================
   assets/css/main.css — LMS UCundinamarca
   Paleta: Verde oscuro #00482B | Verde medio #007B3E | Verde lima #79C000
           Amarillo #FBE122 | Dorado #DAAA00 | Negro #333
   Tipografías: 'Montserrat' (titulares) + 'Lato' (cuerpo)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Lato:wght@300;400;700&display=swap');

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --verde-oscuro:  #00482B;
  --verde-medio:   #007B3E;
  --verde-lima:    #79C000;
  --amarillo:      #FBE122;
  --dorado:        #DAAA00;
  --blanco:        #FFFFFF;
  --gris-100:      #F4F9F6;
  --gris-200:      #E8F2ED;
  --gris-400:      #94A3A0;
  --gris-700:      #3D4F47;
  --negro:         #1A2620;
  --rojo:          #DC3545;
  --azul:          #0066CC;

  --font-title:    'Montserrat', sans-serif;
  --font-body:     'Lato', sans-serif;

  --shadow-sm:     0 2px 8px rgba(0,72,43,.08);
  --shadow-md:     0 4px 20px rgba(0,72,43,.14);
  --shadow-lg:     0 8px 40px rgba(0,72,43,.18);
  --radius:        12px;
  --radius-sm:     8px;
  --transition:    .22s cubic-bezier(.4,0,.2,1);

  --sidebar-w:     260px;
  --header-h:      64px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--negro);
  background: var(--gris-100);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--verde-medio); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--verde-oscuro); }
img { max-width: 100%; display: block; }
input, textarea, select, button { font-family: var(--font-body); }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gris-200); }
::-webkit-scrollbar-thumb { background: var(--verde-medio); border-radius: 3px; }

/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--verde-oscuro);
}

.login-branding {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 40px;
  background: linear-gradient(160deg, var(--verde-oscuro) 0%, var(--verde-medio) 100%);
  position: relative;
  overflow: hidden;
}
.login-branding::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2379C000' fill-opacity='0.07'%3E%3Ccircle cx='30' cy='30' r='15'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.branding-logo {
  width: 120px; height: 120px;
  background: var(--amarillo);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title);
  font-weight: 800; font-size: 2rem;
  color: var(--verde-oscuro);
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  margin-bottom: 28px;
  position: relative; z-index: 1;
  letter-spacing: -1px;
}
.branding-title {
  font-family: var(--font-title);
  font-size: 1.8rem; font-weight: 800;
  color: var(--blanco);
  text-align: center;
  line-height: 1.2;
  position: relative; z-index: 1;
}
.branding-title span { color: var(--amarillo); }
.branding-subtitle {
  color: rgba(255,255,255,.7);
  text-align: center; margin-top: 12px;
  font-size: .95rem;
  position: relative; z-index: 1;
}
.branding-tagline {
  margin-top: 40px;
  background: rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding: 20px 28px;
  position: relative; z-index: 1;
  border: 1px solid rgba(255,255,255,.15);
  text-align: center;
}
.branding-tagline p { color: rgba(255,255,255,.85); font-size: .9rem; font-style: italic; }
.branding-tagline strong { color: var(--amarillo); font-style: normal; display: block; margin-top: 6px; font-family: var(--font-title); letter-spacing: 1px; font-size: .85rem; text-transform: uppercase; }

.login-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background: var(--blanco);
  overflow-y: auto;
}
.login-box { width: 100%; max-width: 420px; }
.login-box h2 {
  font-family: var(--font-title);
  font-size: 1.6rem; font-weight: 700;
  color: var(--verde-oscuro);
  margin-bottom: 6px;
}
.login-box p.sub { color: var(--gris-400); margin-bottom: 32px; font-size: .95rem; }

/* Tabs */
.auth-tabs { display: flex; gap: 4px; margin-bottom: 28px; background: var(--gris-200); padding: 4px; border-radius: var(--radius-sm); }
.auth-tab {
  flex: 1; padding: 9px;
  background: transparent; border: none; cursor: pointer;
  border-radius: 6px; font-weight: 600; font-size: .9rem;
  color: var(--gris-400); transition: all var(--transition);
  font-family: var(--font-body);
}
.auth-tab.active { background: var(--blanco); color: var(--verde-oscuro); box-shadow: var(--shadow-sm); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .875rem; color: var(--gris-700); }
.form-input {
  width: 100%; padding: 11px 14px;
  border: 2px solid var(--gris-200); border-radius: var(--radius-sm);
  font-size: .95rem; color: var(--negro);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none; background: var(--blanco);
}
.form-input:focus { border-color: var(--verde-medio); box-shadow: 0 0 0 3px rgba(0,123,62,.12); }
.form-input::placeholder { color: #B0BEC5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .95rem; cursor: pointer;
  border: none; transition: all var(--transition);
  font-family: var(--font-body); text-decoration: none;
}
.btn-primary { background: var(--verde-medio); color: var(--blanco); }
.btn-primary:hover { background: var(--verde-oscuro); color: var(--blanco); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,123,62,.35); }
.btn-success { background: var(--verde-lima); color: var(--verde-oscuro); }
.btn-success:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-danger  { background: var(--rojo); color: var(--blanco); }
.btn-danger:hover  { filter: brightness(.9); }
.btn-outline { background: transparent; border: 2px solid var(--verde-medio); color: var(--verde-medio); }
.btn-outline:hover { background: var(--verde-medio); color: var(--blanco); }
.btn-ghost  { background: transparent; color: var(--gris-400); }
.btn-ghost:hover { background: var(--gris-200); color: var(--negro); }
.btn-gold   { background: var(--amarillo); color: var(--verde-oscuro); }
.btn-gold:hover { background: var(--dorado); }
.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* Flash */
.flash {
  padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 20px; font-size: .9rem; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .3s ease;
}
.flash-success { background: #EDF7ED; color: #2E7D32; border: 1px solid #A5D6A7; }
.flash-error   { background: #FDECEA; color: #C62828; border: 1px solid #FFCDD2; }
.flash-info    { background: #E3F2FD; color: #1565C0; border: 1px solid #90CAF9; }
@keyframes slideIn { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }

/* ══════════════════════════════════════════════════════════════
   DASHBOARD LAYOUT
══════════════════════════════════════════════════════════════ */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh;
  background: var(--verde-oscuro);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-brand .logo-badge {
  width: 44px; height: 44px; background: var(--amarillo);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title); font-weight: 800; font-size: .9rem; color: var(--verde-oscuro);
  flex-shrink: 0;
}
.sidebar-brand .brand-text { flex: 1; min-width: 0; }
.sidebar-brand .brand-text h1 { font-family: var(--font-title); font-size: .95rem; font-weight: 700; color: var(--blanco); line-height: 1.2; }
.sidebar-brand .brand-text p  { font-size: .75rem; color: rgba(255,255,255,.5); }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section { margin-bottom: 20px; }
.nav-section-label {
  font-size: .7rem; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: rgba(255,255,255,.35);
  padding: 0 8px; margin-bottom: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.75); font-size: .9rem; font-weight: 500;
  transition: all var(--transition); cursor: pointer; margin-bottom: 2px;
  text-decoration: none; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.1); color: var(--blanco); }
.nav-item.active { background: var(--verde-medio); color: var(--blanco); }
.nav-item .nav-icon { width: 20px; flex-shrink: 0; opacity: .8; font-style: normal; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.07);
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--verde-lima); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; color: var(--verde-oscuro); flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-info .user-name  { font-size: .85rem; font-weight: 600; color: var(--blanco); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .user-role  { font-size: .73rem; color: rgba(255,255,255,.45); }

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

.topbar {
  height: var(--header-h); background: var(--blanco);
  border-bottom: 1px solid var(--gris-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-family: var(--font-title); font-weight: 700; font-size: 1.1rem; color: var(--negro); }
.topbar-breadcrumb { font-size: .85rem; color: var(--gris-400); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.hamburger {
  display: none; padding: 6px; cursor: pointer;
  background: none; border: none; color: var(--negro);
}

.page-body { padding: 28px; flex: 1; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--blanco); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-header {
  padding: 18px 22px; border-bottom: 1px solid var(--gris-200);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-family: var(--font-title); font-weight: 700; font-size: 1rem; color: var(--negro); }
.card-body { padding: 22px; }

/* ── Stats grid ─────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat-card {
  background: var(--blanco); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.green  { background: #EDF7ED; color: var(--verde-medio); }
.stat-icon.lime   { background: #F4FDE0; color: var(--verde-lima); }
.stat-icon.yellow { background: #FFFDE7; color: var(--dorado); }
.stat-icon.blue   { background: #E3F2FD; color: var(--azul); }
.stat-info .stat-value { font-family: var(--font-title); font-size: 1.8rem; font-weight: 800; color: var(--negro); line-height: 1; }
.stat-info .stat-label { font-size: .82rem; color: var(--gris-400); margin-top: 4px; }

/* ── Tabla ──────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 16px; text-align: left; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--gris-400); background: var(--gris-100); border-bottom: 1px solid var(--gris-200); white-space: nowrap; }
td { padding: 13px 16px; font-size: .9rem; color: var(--negro); border-bottom: 1px solid var(--gris-200); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gris-100); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600;
}
.badge-green  { background: #EDF7ED; color: #2E7D32; }
.badge-red    { background: #FDECEA; color: #C62828; }
.badge-yellow { background: #FFFDE7; color: #F57F17; }
.badge-gray   { background: var(--gris-200); color: var(--gris-400); }
.badge-blue   { background: #E3F2FD; color: #1565C0; }

/* ── Forms dentro de cards ──────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.col-span-2 { grid-column: 1 / -1; }
.form-textarea {
  width: 100%; min-height: 120px; resize: vertical;
  padding: 11px 14px; border: 2px solid var(--gris-200); border-radius: var(--radius-sm);
  font-size: .95rem; color: var(--negro); transition: border-color var(--transition);
  outline: none; font-family: var(--font-body);
}
.form-textarea:focus { border-color: var(--verde-medio); box-shadow: 0 0 0 3px rgba(0,123,62,.12); }
.form-select {
  width: 100%; padding: 11px 14px;
  border: 2px solid var(--gris-200); border-radius: var(--radius-sm);
  font-size: .95rem; color: var(--negro); background: var(--blanco);
  outline: none; appearance: none;
  transition: border-color var(--transition);
}
.form-select:focus { border-color: var(--verde-medio); }
.code-editor {
  width: 100%; font-family: 'Courier New', monospace; font-size: .875rem;
  background: #1A2620; color: #79C000; padding: 14px 16px;
  border: 2px solid #2A3E35; border-radius: var(--radius-sm);
  min-height: 220px; resize: vertical; outline: none; line-height: 1.6;
  tab-size: 2;
}
.code-editor:focus { border-color: var(--verde-lima); }
.code-lang-label {
  display: inline-block; padding: 3px 10px; border-radius: 4px 4px 0 0;
  font-size: .75rem; font-weight: 700; margin-bottom: -2px;
}
.lang-html { background: #E44D26; color: #fff; }
.lang-css  { background: #264de4; color: #fff; }
.lang-js   { background: #F7DF1E; color: #333; }

/* ── Clase card (student) ───────────────────────────────────── */
.clases-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.clase-card {
  background: var(--blanco); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex; flex-direction: column;
}
.clase-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.clase-card-header {
  height: 6px;
  background: linear-gradient(90deg, var(--verde-oscuro), var(--verde-lima));
}
.clase-card-body { padding: 20px; flex: 1; }
.clase-num { font-size: .75rem; font-weight: 700; color: var(--verde-lima); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 8px; }
.clase-title { font-family: var(--font-title); font-size: 1.05rem; font-weight: 700; color: var(--negro); margin-bottom: 8px; line-height: 1.3; }
.clase-desc { font-size: .875rem; color: var(--gris-400); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clase-card-footer { padding: 14px 20px; border-top: 1px solid var(--gris-200); display: flex; align-items: center; justify-content: space-between; }
.clase-visited { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; color: var(--verde-medio); }

/* ── Clase viewer ───────────────────────────────────────────── */
.clase-viewer-header {
  background: var(--verde-oscuro); color: var(--blanco);
  padding: 16px 28px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 10;
}
.clase-viewer-header h1 { font-family: var(--font-title); font-size: 1.1rem; font-weight: 700; flex: 1; }
.clase-content-frame {
  border: none; width: 100%; min-height: calc(100vh - 70px); display: block;
}

/* ── Activity feed ──────────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--gris-200);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; background: var(--verde-lima); border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.activity-text { flex: 1; font-size: .875rem; color: var(--negro); }
.activity-text strong { color: var(--verde-oscuro); }
.activity-time { font-size: .78rem; color: var(--gris-400); flex-shrink: 0; }

/* ── Historial estudiante ───────────────────────────────────── */
.hist-list { display: flex; flex-direction: column; gap: 10px; }
.hist-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--gris-100); border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.hist-num { width: 32px; height: 32px; background: var(--verde-medio); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; color: var(--blanco); flex-shrink: 0; }
.hist-info { flex: 1; }
.hist-info .htitle { font-weight: 600; font-size: .9rem; color: var(--negro); }
.hist-info .hdate  { font-size: .78rem; color: var(--gris-400); margin-top: 2px; }

/* ── Mobile overlay ─────────────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 99;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .login-page { grid-template-columns: 1fr; }
  .login-branding { display: none; }
  .login-panel { padding: 32px 24px; }

  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.visible { display: block; }
  .hamburger { display: flex; }
  .main-content { margin-left: 0; }

  .page-body { padding: 18px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .clases-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .form-grid-3 { grid-template-columns: 1fr; }

  .clase-viewer-header { padding: 12px 16px; }
  .clase-viewer-header h1 { font-size: .95rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 16px; }
  .stat-info .stat-value { font-size: 1.5rem; }
}

/* ── Utilities ──────────────────────────────────────────────── */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .78rem; }
.text-muted { color: var(--gris-400); }
.text-success { color: var(--verde-medio); }
.text-danger  { color: var(--rojo); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.page-title { font-family: var(--font-title); font-size: 1.5rem; font-weight: 800; color: var(--negro); margin-bottom: 6px; }
.page-subtitle { color: var(--gris-400); font-size: .9rem; margin-bottom: 24px; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--gris-400); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .95rem; }
.divider { height: 1px; background: var(--gris-200); margin: 20px 0; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--blanco); border-radius: var(--radius);
  padding: 28px; max-width: 440px; width: 100%;
  box-shadow: var(--shadow-lg);
  transform: scale(.95); transition: transform .2s;
}
.modal-overlay.open .modal-box { transform: scale(1); }
.modal-title { font-family: var(--font-title); font-weight: 700; font-size: 1.1rem; margin-bottom: 10px; }
.modal-body  { color: var(--gris-700); font-size: .9rem; margin-bottom: 22px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; }
