/* ============================================================
   IEENSIU — Tejiendo Saberes
   Estilos institucionales base
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --verde-institucional: #1B5E20;
  --verde-medio:         #2E7D32;
  --verde-claro:         #4CAF50;
  --dorado:              #C8920A;
  --dorado-claro:        #E8A020;
  --rojo-wayuu:          #8B1A1A;
  --crema:               #F5F0E8;
  --crema-oscuro:        #EAE3D2;
  --texto-principal:     #1A1A1A;

  --wayuu-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpolygon points='20,2 38,20 20,38 2,20' fill='none' stroke='%231B5E20' stroke-width='1.5' opacity='0.12'/%3E%3Crect x='16' y='16' width='8' height='8' fill='%23C8920A' opacity='0.1' transform='rotate(45 20 20)'/%3E%3C/svg%3E");

  --font-titulo: 'Playfair Display', Georgia, serif;
  --font-cuerpo: 'Source Sans 3', system-ui, sans-serif;

  --sidebar-w: 220px;
  --navbar-h: 64px;
  --radius: 8px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --transition: .2s ease;
}

/* ── Reset y base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-cuerpo);
  font-size: clamp(13px, 2vw, 16px);
  color: var(--texto-principal);
  background: var(--crema);
  margin: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-titulo);
  font-weight: 700;
  line-height: 1.25;
}

h1 { font-size: clamp(20px, 4vw, 36px); }
h2 { font-size: clamp(16px, 3vw, 26px); }
h3 { font-size: clamp(15px, 2.5vw, 22px); }

a { color: var(--verde-medio); text-decoration: none; }
a:hover { color: var(--verde-institucional); text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ── Navbar institucional ───────────────────────────────────── */
.navbar-institucional {
  background: var(--verde-institucional) !important;
  border-bottom: 3px solid var(--dorado);
  min-height: var(--navbar-h);
  padding: 8px 16px;
  position: sticky;
  top: 0;
  z-index: 1030;
}

/* Logo rectangular (imagen real del escudo) */
.navbar-logo-img {
  height: 46px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
  background: white;
  padding: 2px 4px;
}

/* Fallback cuando no hay imagen subida */
.logo-rect {
  height: 42px;
  background: white;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  font-family: var(--font-titulo);
  font-weight: 700;
  font-size: 11px;
  color: var(--verde-institucional);
  flex-shrink: 0;
  letter-spacing: -.3px;
  white-space: nowrap;
}

/* Mantener .logo-circle solo para login (hasta que tenga logo) */
.logo-circle {
  width: 64px;
  height: 64px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-family: var(--font-titulo);
  font-weight: 700;
  font-size: 11px;
  color: var(--verde-institucional);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-family: var(--font-titulo);
  font-weight: 700;
  font-size: clamp(14px, 2vw, 18px);
  color: var(--dorado);
  white-space: nowrap;
}

.brand-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,.7);
  white-space: nowrap;
}

.navbar-institucional .navbar-text {
  color: rgba(255,255,255,.85);
  font-size: 13px;
}

/* ── Franja Wayuu ───────────────────────────────────────────── */
.wayuu-divider {
  height: 8px;
  background: repeating-linear-gradient(
    90deg,
    var(--verde-institucional) 0px,   var(--verde-institucional) 6px,
    var(--dorado)              6px,   var(--dorado)              12px,
    var(--rojo-wayuu)          12px,  var(--rojo-wayuu)          18px,
    var(--crema-oscuro)        18px,  var(--crema-oscuro)        24px
  );
  width: 100%;
}

/* ── Layout con sidebar ─────────────────────────────────────── */
.layout-wrapper {
  display: flex;
  min-height: calc(100vh - var(--navbar-h));
}

/* Sidebar desktop */
.sidebar {
  width: var(--sidebar-w);
  min-height: calc(100vh - var(--navbar-h));
  background: var(--verde-institucional);
  background-image: var(--wayuu-pattern);
  background-size: 40px 40px;
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition);
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,.85) !important;
  text-decoration: none !important;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
  white-space: nowrap;
  font-size: 14px;
  min-height: 44px;
}

.sidebar-link:hover {
  background: rgba(200,146,10,.15);
  color: white !important;
}

.sidebar-link.active {
  background: rgba(200,146,10,.2);
  border-left-color: var(--dorado);
  color: white !important;
  font-weight: 600;
}

.sidebar-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

/* Sidebar offcanvas (mobile) */
.sidebar-offcanvas {
  background: var(--verde-institucional);
  background-image: var(--wayuu-pattern);
  background-size: 40px 40px;
}
.sidebar-offcanvas .offcanvas-header {
  border-bottom: 1px solid rgba(255,255,255,.15);
}

/* Contenido principal */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 24px;
  min-width: 0;
}

/* ── Hero section ───────────────────────────────────────────── */
.hero-section {
  background: linear-gradient(135deg, var(--verde-institucional) 0%, #1B4A1E 60%, #2E5C2E 100%);
  background-image: var(--wayuu-pattern), linear-gradient(135deg, var(--verde-institucional) 0%, #1B4A1E 60%, #2E5C2E 100%);
  background-size: 40px 40px, cover;
  padding: clamp(32px, 6vw, 64px) 0 clamp(24px, 4vw, 48px);
  color: white;
}

.hero-title {
  font-family: var(--font-titulo);
  font-weight: 700;
  color: white;
}

.hero-title .highlight {
  color: var(--dorado-claro);
}

.hero-subtitle {
  color: rgba(255,255,255,.85);
  font-size: clamp(13px, 2vw, 16px);
}

/* Stats pills en hero */
.stat-pill {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50px;
  padding: 6px 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: white;
  font-size: 13px;
}

.stat-pill .stat-num {
  font-weight: 700;
  font-size: 16px;
  color: var(--dorado-claro);
}

/* ── Cards de proyectos ─────────────────────────────────────── */
.project-card {
  border: 1px solid rgba(27,94,32,.15);
  border-radius: var(--radius);
  background: white;
  transition: transform var(--transition), box-shadow var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.project-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-card-footer {
  padding: 10px 16px;
  background: var(--crema);
  border-top: 1px solid var(--crema-oscuro);
}

/* Color top border por tipo */
.tipo-investigacion { border-top: 3px solid #0C447C; }
.tipo-transversal   { border-top: 3px solid #6A1B9A; }
.tipo-aula          { border-top: 3px solid #1B5E20; }
.tipo-semillero     { border-top: 3px solid #E65100; }

/* ── Badges por tipo ────────────────────────────────────────── */
.badge-investigacion { background: #E3F2FD !important; color: #0C447C !important; }
.badge-transversal   { background: #F3E5F5 !important; color: #6A1B9A !important; }
.badge-aula          { background: #E8F5E9 !important; color: #1B5E20 !important; }
.badge-semillero     { background: #FFF3E0 !important; color: #E65100 !important; }

.badge-estado-borrador  { background: #FFF9C4 !important; color: #827717 !important; }
.badge-estado-publicado { background: #E8F5E9 !important; color: #1B5E20 !important; }
.badge-estado-archivado { background: #ECEFF1 !important; color: #455A64 !important; }

/* ── Botones ────────────────────────────────────────────────── */
.btn {
  min-height: 44px;
  font-family: var(--font-cuerpo);
  font-weight: 500;
  border-radius: var(--radius);
}

.btn-sm { min-height: 36px; }

.btn-primary {
  background: var(--verde-medio) !important;
  border-color: var(--verde-medio) !important;
  color: white !important;
}
.btn-primary:hover {
  background: var(--verde-institucional) !important;
  border-color: var(--verde-institucional) !important;
}

.btn-ia {
  background: var(--dorado) !important;
  border-color: var(--dorado) !important;
  color: white !important;
}
.btn-ia:hover {
  background: #a87508 !important;
  border-color: #a87508 !important;
}

.btn-danger {
  background: #C62828 !important;
  border-color: #C62828 !important;
  color: white !important;
}
.btn-danger:hover {
  background: #9b1c1c !important;
  border-color: #9b1c1c !important;
}

/* ── Formularios ────────────────────────────────────────────── */
.form-control, .form-select {
  border: 1px solid var(--crema-oscuro);
  border-radius: var(--radius);
  font-family: var(--font-cuerpo);
  min-height: 44px;
  font-size: 14px;
  color: var(--texto-principal);
}

.form-control:focus, .form-select:focus {
  border-color: var(--verde-claro);
  box-shadow: 0 0 0 3px rgba(76,175,80,.15);
}

.form-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--verde-institucional);
  margin-bottom: 4px;
}

.input-group-text {
  background: var(--crema);
  border-color: var(--crema-oscuro);
  color: var(--verde-institucional);
}

/* Zona drag-and-drop PDF */
.upload-zone {
  border: 2px dashed var(--crema-oscuro);
  border-radius: var(--radius);
  background: var(--crema);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--verde-claro);
  background: #f0f9f0;
}

.upload-zone .upload-icon {
  font-size: 36px;
  color: var(--verde-medio);
  display: block;
  margin-bottom: 8px;
}

.upload-zone input[type="file"] {
  display: none;
}

/* Barra de progreso dentro de la zona de carga */
.upload-zone-progress-wrap {
  display: none;
  margin-top: 12px;
}

.upload-zone-progress-track {
  background: var(--crema-oscuro);
  border-radius: 50px;
  height: 6px;
  overflow: hidden;
  max-width: 220px;
  margin: 0 auto 6px;
}

.upload-zone-progress-bar {
  height: 100%;
  border-radius: 50px;
  background: linear-gradient(90deg, var(--verde-institucional), var(--verde-claro));
  width: 0%;
  transition: width .7s ease;
}

.upload-zone-progress-text {
  font-size: 12px;
  color: var(--verde-institucional);
  font-weight: 600;
  text-align: center;
}

/* ── Tablas admin ───────────────────────────────────────────── */
.table-institucional thead {
  background: var(--verde-institucional);
  color: white;
}

.table-institucional thead th {
  font-family: var(--font-titulo);
  font-weight: 600;
  font-size: 13px;
  padding: 12px 16px;
  border: none;
}

.table-institucional tbody tr:hover {
  background: rgba(27,94,32,.04);
}

/* ── Cards de dashboard ─────────────────────────────────────── */
.dash-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--crema-oscuro);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow var(--transition);
}

.dash-card:hover { box-shadow: var(--shadow-sm); }

.dash-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.dash-card-icon.verde  { background: #E8F5E9; color: var(--verde-institucional); }
.dash-card-icon.dorado { background: #FFF8E1; color: var(--dorado); }
.dash-card-icon.azul   { background: #E3F2FD; color: #0D47A1; }
.dash-card-icon.morado { background: #F3E5F5; color: #6A1B9A; }

.dash-card-num {
  font-family: var(--font-titulo);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--verde-institucional);
}

.dash-card-label {
  font-size: 13px;
  color: #666;
  margin: 0;
}

/* ── Sección Nuestras Raíces ────────────────────────────────── */
.raices-section {
  background: var(--crema);
  border-top: 1px solid var(--crema-oscuro);
  padding: clamp(32px, 5vw, 64px) 0;
}

.raices-escudo {
  width: clamp(80px, 12vw, 140px);
  height: auto;
}

.raices-lema {
  font-family: var(--font-titulo);
  font-style: italic;
  color: var(--dorado);
  font-size: clamp(14px, 2.5vw, 20px);
}

/* ── Paginación ─────────────────────────────────────────────── */
.pagination .page-link {
  color: var(--verde-institucional);
  border-color: var(--crema-oscuro);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
}

.pagination .page-item.active .page-link {
  background: var(--verde-institucional);
  border-color: var(--verde-institucional);
}

.pagination .page-link:hover {
  background: var(--crema-oscuro);
  color: var(--verde-institucional);
}

/* ── Modales ────────────────────────────────────────────────── */
.modal-header {
  background: var(--verde-institucional);
  color: white;
  border-bottom: 3px solid var(--dorado);
}

.modal-header .modal-title {
  font-family: var(--font-titulo);
  font-weight: 700;
}

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

/* ── Alerts personalizadas ──────────────────────────────────── */
.alert-success {
  background: #E8F5E9;
  border-color: #A5D6A7;
  color: var(--verde-institucional);
}

.alert-danger {
  background: #FFEBEE;
  border-color: #EF9A9A;
  color: #B71C1C;
}

/* ── Login page ─────────────────────────────────────────────── */
.login-body {
  background: linear-gradient(135deg, var(--verde-institucional) 0%, #1B4A1E 60%, #2E5C2E 100%);
  background-image: var(--wayuu-pattern), linear-gradient(135deg, var(--verde-institucional) 0%, #1B4A1E 60%, #2E5C2E 100%);
  background-size: 40px 40px, cover;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-header {
  background: var(--verde-institucional);
  background-image: var(--wayuu-pattern);
  background-size: 40px 40px;
  padding: 32px 24px;
  text-align: center;
  border-bottom: 3px solid var(--dorado);
}

.login-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

/* Login: logo real (rectangular) */
.login-logo-img {
  max-height: 80px;
  max-width: 180px;
  width: auto;
  object-fit: contain;
  border-radius: 6px;
  background: white;
  padding: 4px 8px;
}

/* Login: fallback sin imagen */
.login-logo {
  width: 64px;
  height: 64px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-titulo);
  font-weight: 700;
  font-size: 11px;
  color: var(--verde-institucional);
}

/* ── Página Configuración ────────────────────────────────── */
.logo-preview-box {
  border: 2px dashed var(--crema-oscuro);
  border-radius: var(--radius);
  background: var(--verde-institucional);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.logo-preview-img {
  max-height: 80px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.logo-preview-placeholder {
  text-align: center;
  color: rgba(255,255,255,.5);
}

.logo-preview-placeholder i { color: rgba(255,255,255,.4); }
.logo-preview-placeholder p { color: rgba(255,255,255,.5); }

.upload-zone-sm {
  padding: 16px;
  text-align: center;
  cursor: pointer;
}

.logo-siglas {
  font-family: var(--font-titulo);
  font-weight: 700;
  font-size: 11px;
  color: var(--verde-institucional);
  letter-spacing: -.3px;
  line-height: 1.1;
  text-align: center;
}

.login-title {
  font-family: var(--font-titulo);
  color: var(--dorado);
  font-size: 22px;
  margin: 0 0 4px;
}

.login-subtitle {
  color: rgba(255,255,255,.7);
  font-size: 12px;
  margin: 0;
}

.login-body-inner { padding: 24px; }

.btn-login {
  background: var(--verde-medio) !important;
  border-color: var(--verde-medio) !important;
  color: white !important;
  font-weight: 600;
  font-size: 15px;
}

.btn-login:hover {
  background: var(--verde-institucional) !important;
  border-color: var(--verde-institucional) !important;
}

.login-footer {
  padding: 12px 24px;
  background: var(--crema);
  border-top: 1px solid var(--crema-oscuro);
  text-align: center;
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  background: var(--verde-institucional);
  color: white;
  padding: 24px 0;
  margin-top: 0;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-siglas-sm {
  font-family: var(--font-titulo);
  font-weight: 700;
  font-size: 11px;
  color: var(--verde-institucional);
  background: white;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -.2px;
  text-align: center;
  line-height: 1.1;
}

.footer-site-name {
  font-family: var(--font-titulo);
  font-weight: 600;
  color: var(--dorado);
  font-size: 14px;
}

.footer-lema {
  font-family: var(--font-titulo);
  font-style: italic;
  color: var(--dorado-claro);
  font-size: clamp(12px, 1.8vw, 15px);
  margin: 0;
}

.footer-copy {
  color: rgba(255,255,255,.5);
  font-size: 12px;
  margin: 0;
}

/* ── Buscador en hero ───────────────────────────────────────── */
.hero-search .form-control {
  border: none;
  border-radius: 50px 0 0 50px;
  padding: 12px 20px;
  font-size: 15px;
  height: 50px;
}

.hero-search .btn {
  border-radius: 0 50px 50px 0;
  padding: 0 24px;
  background: var(--dorado) !important;
  border-color: var(--dorado) !important;
  color: white !important;
  height: 50px;
  min-height: 50px;
}

/* ── Filtros ────────────────────────────────────────────────── */
.filters-bar {
  background: white;
  border: 1px solid var(--crema-oscuro);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

/* ── PDF preview ────────────────────────────────────────────── */
.pdf-preview {
  width: 100%;
  height: 500px;
  border: 1px solid var(--crema-oscuro);
  border-radius: var(--radius);
}

/* ── Spinner IA ─────────────────────────────────────────────── */
.ia-spinner {
  display: none;
  align-items: center;
  gap: 8px;
  color: var(--dorado);
  font-size: 13px;
  font-weight: 500;
}

.ia-spinner.visible { display: flex; }

/* ── Page header ────────────────────────────────────────────── */
.page-header {
  background: white;
  border-bottom: 1px solid var(--crema-oscuro);
  padding: 16px 24px;
  margin: -24px -24px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-main .page-header {
  margin: 0 -24px 24px;
}

.page-header-title {
  font-family: var(--font-titulo);
  font-size: clamp(16px, 3vw, 22px);
  font-weight: 700;
  color: var(--verde-institucional);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb-institucional {
  font-size: 12px;
  margin: 0;
}

.breadcrumb-institucional .breadcrumb-item + .breadcrumb-item::before {
  color: var(--crema-oscuro);
}

.breadcrumb-institucional .breadcrumb-item.active {
  color: var(--verde-institucional);
  font-weight: 600;
}

/* ── Admin sin sidebar — full width ────────────────────────── */
.admin-main {
  width: 100%;
  padding: 24px;
  min-width: 0;
}

/* Nav horizontal admin */
.admin-topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: white;
  border-bottom: 2px solid var(--crema-oscuro);
  padding: 10px 24px;
  margin-bottom: 24px;
  position: sticky;
  top: var(--navbar-h);
  z-index: 90;
}

.admin-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  text-decoration: none !important;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.admin-nav-pill i { font-size: 15px; }

.admin-nav-pill:hover {
  background: var(--crema);
  color: var(--verde-institucional);
}

.admin-nav-pill.active {
  background: var(--verde-institucional);
  color: white !important;
}

/* ── Tablet sidebar (solo íconos) ───────────────────────────── */
@media (min-width: 992px) and (max-width: 1199px) {
  .sidebar {
    width: 64px;
    overflow: hidden;
  }
  .sidebar:hover {
    width: var(--sidebar-w);
  }
  .sidebar-label {
    opacity: 0;
    transition: opacity var(--transition);
    white-space: nowrap;
  }
  .sidebar:hover .sidebar-label { opacity: 1; }
  .main-content { margin-left: 64px; }
}

/* ── Tooltips de ayuda ──────────────────────────────────────── */
[data-bs-toggle="tooltip"] { cursor: help; }

/* ── Overlay de carga al subir PDF ─────────────────────────── */
.upload-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-overlay.visible { display: flex; }

.upload-overlay-box {
  background: white;
  border-radius: 12px;
  padding: 36px 48px;
  text-align: center;
  min-width: 300px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.upload-overlay-icon {
  font-size: 40px;
  color: var(--verde-institucional);
  margin-bottom: 12px;
  display: block;
  animation: bounce-upload .8s infinite alternate ease-in-out;
}

@keyframes bounce-upload {
  from { transform: translateY(0); }
  to   { transform: translateY(-8px); }
}

.upload-overlay-title {
  font-family: var(--font-titulo);
  color: var(--verde-institucional);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.upload-overlay-sub {
  color: #777;
  font-size: 13px;
  margin-bottom: 20px;
}

.upload-progress-track {
  background: var(--crema-oscuro);
  border-radius: 50px;
  height: 8px;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  border-radius: 50px;
  background: linear-gradient(90deg, var(--verde-institucional), var(--verde-claro));
  animation: progress-slide 1.6s infinite ease-in-out;
  width: 40%;
}

@keyframes progress-slide {
  0%   { margin-left: -40%; }
  100% { margin-left: 100%; }
}

/* ── Imagen del proyecto ────────────────────────────────────── */
.proyecto-img-upload-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.proyecto-img-preview {
  position: relative;
  display: inline-block;
  max-width: 320px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--crema-oscuro);
}

.proyecto-img-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.btn-quitar-img {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,.55);
  border: none;
  color: white;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  transition: background var(--transition);
}

.btn-quitar-img:hover { background: rgba(198,40,40,.8); }

.upload-zone-img {
  cursor: pointer;
  display: block;
  text-align: center;
  padding: 24px;
  max-width: 320px;
  border: 2px dashed var(--crema-oscuro);
  border-radius: var(--radius);
  background: var(--crema);
  transition: border-color var(--transition), background var(--transition);
}

.upload-zone-img:hover {
  border-color: var(--verde-claro);
  background: #f0f9f0;
}

.upload-zone-img .upload-icon {
  font-size: 32px;
  color: var(--verde-medio);
  display: block;
  margin-bottom: 6px;
}

.upload-zone-img input[type="file"] { display: none; }

/* Imagen circular en tarjeta */
.project-card-thumb {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  object-fit: contain;
  object-position: center;
  background: var(--crema);
  border: 2px solid var(--crema-oscuro);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  flex-shrink: 0;
  cursor: zoom-in;
  transition: transform .2s ease, box-shadow .2s ease;
  padding: 2px;
}

.project-card-thumb:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0,0,0,.22);
}

/* Lightbox */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 20px;
}

.lightbox-overlay.visible { display: flex; }

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  object-fit: contain;
  animation: lightbox-in .22s ease;
  cursor: default;
}

@keyframes lightbox-in {
  from { transform: scale(.88); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  background: rgba(255,255,255,.15);
  border: none;
  color: white;
  font-size: 22px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s;
  z-index: 10000;
}

.lightbox-close:hover { background: rgba(255,255,255,.28); }

/* ── Chips de materias ──────────────────────────────────────── */
.materia-chip {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.materia-chip input[type="checkbox"] {
  display: none;
}

.materia-chip span {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 50px;
  border: 1.5px solid var(--crema-oscuro);
  background: white;
  font-size: 13px;
  font-family: var(--font-cuerpo);
  color: #555;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.materia-chip input[type="checkbox"]:checked + span {
  background: var(--verde-institucional);
  border-color: var(--verde-institucional);
  color: white;
  font-weight: 600;
}

.materia-chip:hover span {
  border-color: var(--verde-claro);
  background: #f0f9f0;
}

.materia-chip input[type="checkbox"]:checked + span:hover {
  background: var(--verde-medio);
  border-color: var(--verde-medio);
}

.materia-nucleo-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--verde-institucional);
  opacity: .7;
}

/* ── Flujo de publicación ───────────────────────────────────── */
.flujo-paso {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--crema-oscuro);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: 13px;
  color: #555;
}

.flujo-paso-ok {
  border-color: var(--verde-claro);
  color: var(--verde-institucional);
  background: #f0f9f0;
}

.flujo-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--verde-institucional);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.flujo-flecha {
  color: var(--crema-oscuro);
  font-size: 18px;
  display: flex;
  align-items: center;
}

/* ── Campos personalizados condicionales (formulario proyecto) ── */
.seccion-campos-personalizados {
  border: 1px solid var(--crema-oscuro);
  background: var(--crema);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.seccion-campos-titulo {
  font-family: var(--font-titulo);
  font-size: 14px;
  font-weight: 700;
  color: var(--verde-institucional);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.seccion-campos-titulo::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--crema-oscuro);
}

/* Condición row en modal admin/campos.php */
.cond-row {
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--crema);
  border: 1px solid var(--crema-oscuro);
}

/* ── Notificaciones ─────────────────────────────────────────── */
.notif-badge-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e53935;
  color: white;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  margin-left: 2px;
}

.notif-panel {
  border: 1.5px solid #E65100;
  border-radius: var(--radius);
  background: #FFF8F0;
  padding: 16px 20px;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.notif-panel-titulo {
  font-family: var(--font-titulo);
  font-weight: 700;
  font-size: 15px;
  color: #BF360C;
  display: flex;
  align-items: center;
  gap: 4px;
}

.notif-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e53935;
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  margin-left: 4px;
}

.notif-card {
  display: flex;
  gap: 12px;
  background: white;
  border: 1px solid #FFCCBC;
  border-left: 4px solid #E65100;
  border-radius: var(--radius);
  padding: 14px;
  height: 100%;
}

.notif-card-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: #FBE9E7;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #E65100;
  font-size: 18px;
}

.notif-card-body {
  flex: 1;
  min-width: 0;
}

.notif-card-titulo {
  font-family: var(--font-titulo);
  font-size: 13px;
  font-weight: 600;
  color: var(--texto-principal);
  margin-bottom: 4px;
  line-height: 1.4;
}

.notif-card-meta {
  font-size: 11px;
  color: #777;
  margin-bottom: 0;
}

/* ── Galería — modal público (lightbox) ── */
.modal-galeria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 160px));
  gap: 8px;
  justify-content: start;
}

.modal-galeria-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  background: #e8e4df;
}

.modal-galeria-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .2s;
}

.modal-galeria-item:hover img { transform: scale(1.05); }

.modal-galeria-item .galeria-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.modal-galeria-item:hover .galeria-overlay { background: rgba(0,0,0,.35); }
.modal-galeria-item:hover .galeria-overlay i { opacity: 1; }
.modal-galeria-item .galeria-overlay i { color: #fff; font-size: 20px; opacity: 0; transition: opacity .2s; }

/* ── Lightbox overlay ── */
#lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
#lightbox-overlay.active { display: flex; }

#lightbox-img {
  max-width: 90vw;
  max-height: 78vh;
  border-radius: 6px;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}

#lightbox-info {
  text-align: center;
  color: #fff;
  margin-top: 12px;
  max-width: 600px;
}
#lightbox-info .lb-titulo { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
#lightbox-info .lb-desc   { font-size: 13px; opacity: .8; }
#lightbox-info .lb-counter { font-size: 11px; opacity: .5; margin-top: 6px; }

.lb-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.lb-btn:hover { background: rgba(255,255,255,.25); }
#lb-prev { left: 16px; }
#lb-next { right: 16px; }
#lb-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  opacity: .7;
  line-height: 1;
}
#lb-close:hover { opacity: 1; }

/* ── URL evidencias en modal ── */
.modal-evidencias-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #E8F0FE;
  color: #1A73E8;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid #B8D0FA;
  transition: background .15s;
}
.modal-evidencias-link:hover { background: #D2E3FC; color: #1558B0; }

/* ── Galería dropzone ── */
.galeria-dropzone {
  border: 2px dashed var(--crema-oscuro);
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
  background: var(--crema);
  cursor: pointer;
  transition: border-color .2s, background .2s;
  user-select: none;
}
.galeria-dropzone:hover,
.galeria-dropzone.dragover {
  border-color: var(--verde-medio);
  background: #f0f7f0;
}
.galeria-dropzone.dragover {
  border-style: solid;
  background: #e8f5e9;
}
.galeria-dropzone-icon {
  font-size: 36px;
  color: var(--verde-medio);
  margin-bottom: 6px;
  pointer-events: none;
}
.galeria-dropzone p {
  pointer-events: none;
}

/* Barra de progreso de subida AJAX */
.galeria-progress-wrap {
  height: 14px;
  background: #ddd;
  overflow: hidden;
  flex-shrink: 0;
}
.galeria-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--verde-institucional), var(--verde-medio));
  transition: width .12s ease;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  line-height: 14px;
  white-space: nowrap;
}
.galeria-progress-wrap.galeria-progress-error .galeria-progress-bar {
  background: #dc3545;
}
.galeria-status {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 5px;
  font-size: 10px;
  min-height: 16px;
  flex-shrink: 0;
}

/* Thumbnails de previsualización */
.galeria-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 110px));
  gap: 8px;
  justify-content: start;
}
.galeria-form-card {
  position: relative;
  border: 1px solid var(--crema-oscuro);
  border-radius: 8px;
  overflow: hidden;
  background: var(--crema);
  display: flex;
  flex-direction: column;
  animation: galeríaEntrar .25s ease;
  width: 110px;
}
@keyframes galeríaEntrar {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}
.galeria-form-thumb-wrap {
  width: 110px;
  height: 80px;
  background: #ece9e3;
  overflow: hidden;
  flex-shrink: 0;
}
.galeria-form-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.galeria-form-fields {
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.galeria-form-fields input,
.galeria-form-fields textarea {
  font-size: 10px !important;
}
.galeria-form-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  background: rgba(0,0,0,.55);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  line-height: 1;
  transition: background .15s;
}
.galeria-form-remove:hover { background: rgba(200,30,30,.8); }
