/**
 * Directorio Académico UTEM — Stylesheet
 * Design: Academic Navy & Gold University Portal
 * Typography: Libre Baskerville (headings) + Source Sans 3 (body)
 */

@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

/* ════════════════════════════════════════════════════════════════
   DESIGN TOKENS
════════════════════════════════════════════════════════════════ */
:root {
  --cd-primary:        #1a3a6b;
  --cd-primary-dark:   #0f2448;
  --cd-primary-light:  #2a5298;
  --cd-accent:         #e8a020;
  --cd-accent-dark:    #c4831a;
  --cd-accent-light:   #fbd07a;
  --cd-white:          #ffffff;
  --cd-off-white:      #f7f8fa;
  --cd-surface:        #ffffff;
  --cd-surface-2:      #f0f2f6;
  --cd-border:         #dce1ea;
  --cd-text:           #1c2333;
  --cd-text-muted:     #5a6478;
  --cd-text-light:     #8a93a6;
  --cd-shadow-sm:      0 1px 3px rgba(26,58,107,0.08), 0 1px 2px rgba(26,58,107,0.04);
  --cd-shadow:         0 4px 12px rgba(26,58,107,0.10), 0 2px 6px rgba(26,58,107,0.06);
  --cd-shadow-lg:      0 12px 32px rgba(26,58,107,0.14), 0 4px 12px rgba(26,58,107,0.08);
  --cd-radius:         12px;
  --cd-radius-sm:      8px;
  --cd-radius-xs:      4px;
  --cd-transition:     0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --cd-font-display:   'Libre Baskerville', Georgia, serif;
  --cd-font-body:      'Source Sans 3', -apple-system, sans-serif;

  /* Role colours */
  --cd-role-faculty:    #1a3a6b;
  --cd-role-staff:      #2d6a4f;
  --cd-role-student:    #7b2d8b;
  --cd-role-admin:      #b54708;
  --cd-role-researcher: #1d4e89;
  --cd-role-emeritus:   #495057;
}

/* ════════════════════════════════════════════════════════════════
   BASE
════════════════════════════════════════════════════════════════ */
.cd-wrap,
.cd-profile-wrap,
.cd-listing-wrap {
  font-family: var(--cd-font-body);
  color: var(--cd-text);
  font-size: 15px;
  line-height: 1.6;
  box-sizing: border-box;
}
.cd-wrap *,
.cd-profile-wrap *,
.cd-listing-wrap * {
  box-sizing: border-box;
}

/* ════════════════════════════════════════════════════════════════
   SEARCH BAR
════════════════════════════════════════════════════════════════ */
.cd-search-bar {
  background: var(--cd-primary);
  background: linear-gradient(135deg, var(--cd-primary-dark) 0%, var(--cd-primary) 60%, var(--cd-primary-light) 100%);
  padding: 28px 32px 20px;
  border-radius: var(--cd-radius);
  margin-bottom: 28px;
  position: relative;
}
.cd-search-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.cd-search-input-wrap {
  flex: 1;
  min-width: 260px;
  position: relative;
}
.cd-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cd-text-muted);
  font-size: 15px;
  pointer-events: none;
  z-index: 1;
}
.cd-search-input {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 46px;
  border: 2px solid transparent;
  border-radius: 10px;
  font-family: var(--cd-font-body);
  font-size: 15px;
  background: var(--cd-white);
  color: var(--cd-text);
  transition: border-color var(--cd-transition), box-shadow var(--cd-transition);
  outline: none;
}
.cd-search-input::placeholder { color: var(--cd-text-light); }
.cd-search-input:focus {
  border-color: var(--cd-accent);
  box-shadow: 0 0 0 4px rgba(232, 160, 32, 0.20);
}
.cd-search-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.cd-result-count {
  color: rgba(255,255,255,0.85);
  font-size: 13.5px;
  white-space: nowrap;
}
.cd-result-count strong {
  color: var(--cd-accent-light);
  font-size: 18px;
  font-weight: 700;
}

/* View toggle */
.cd-view-toggle {
  display: flex;
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.cd-view-btn {
  width: 36px;
  height: 32px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.6);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--cd-transition), color var(--cd-transition);
}
.cd-view-btn.active,
.cd-view-btn:hover {
  background: rgba(255,255,255,0.25);
  color: var(--cd-white);
}

/* Active filter tags */
.cd-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  min-height: 0;
}
.cd-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.18);
  color: var(--cd-white);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 4px 10px 4px 12px;
  border-radius: 100px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background var(--cd-transition);
}
.cd-filter-tag:hover { background: rgba(255,255,255,0.28); }
.cd-filter-tag-remove {
  width: 16px;
  height: 16px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
}

/* ════════════════════════════════════════════════════════════════
   AUTOCOMPLETE
════════════════════════════════════════════════════════════════ */
.cd-autocomplete {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--cd-white);
  border: 1px solid var(--cd-border);
  border-radius: var(--cd-radius-sm);
  box-shadow: var(--cd-shadow-lg);
  z-index: 9999;
  overflow: hidden;
  display: none;
}
.cd-autocomplete.open { display: block; }
.cd-autocomplete-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--cd-transition);
  text-decoration: none;
  color: var(--cd-text);
}
.cd-autocomplete-item:hover,
.cd-autocomplete-item.highlighted { background: var(--cd-off-white); }
.cd-autocomplete-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--cd-surface-2);
  flex-shrink: 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--cd-primary);
}
.cd-autocomplete-info { flex: 1; min-width: 0; }
.cd-autocomplete-name { font-weight: 600; font-size: 14px; }
.cd-autocomplete-sub  { font-size: 12px; color: var(--cd-text-muted); }

/* ════════════════════════════════════════════════════════════════
   LAYOUT
════════════════════════════════════════════════════════════════ */
.cd-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 900px) {
  .cd-layout { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════════
   SIDEBAR FILTERS
════════════════════════════════════════════════════════════════ */
.cd-sidebar {
  position: sticky;
  top: 20px;
}
.cd-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cd-filter-header h3 {
  font-family: var(--cd-font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--cd-primary);
  margin: 0;
  letter-spacing: 0.02em;
}
.cd-clear-filters {
  background: none;
  border: none;
  color: var(--cd-accent-dark);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cd-clear-filters:hover { color: var(--cd-accent); }

.cd-filter-group {
  background: var(--cd-surface);
  border: 1px solid var(--cd-border);
  border-radius: var(--cd-radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}
.cd-filter-toggle {
  width: 100%;
  background: none;
  border: none;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--cd-font-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--cd-text);
  cursor: pointer;
  text-align: left;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.cd-filter-toggle i {
  font-size: 11px;
  color: var(--cd-text-muted);
  transition: transform var(--cd-transition);
}
.cd-filter-toggle[aria-expanded="true"] i { transform: rotate(180deg); }
.cd-filter-options {
  padding: 6px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}
.cd-filter-options::-webkit-scrollbar { width: 4px; }
.cd-filter-options::-webkit-scrollbar-track { background: transparent; }
.cd-filter-options::-webkit-scrollbar-thumb { background: var(--cd-border); border-radius: 4px; }
.cd-filter-option {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--cd-text);
  transition: background var(--cd-transition);
  user-select: none;
}
.cd-filter-option:hover { background: var(--cd-off-white); }
.cd-filter-option input[type="checkbox"] { display: none; }
.cd-checkbox {
  width: 16px;
  height: 16px;
  border: 2px solid var(--cd-border);
  border-radius: 4px;
  flex-shrink: 0;
  transition: border-color var(--cd-transition), background var(--cd-transition);
  position: relative;
}
.cd-filter-option input:checked + .cd-checkbox {
  background: var(--cd-primary);
  border-color: var(--cd-primary);
}
.cd-filter-option input:checked + .cd-checkbox::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 9px;
  border: 2px solid var(--cd-white);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.cd-count { color: var(--cd-text-light); font-size: 12px; margin-left: auto; }

/* ════════════════════════════════════════════════════════════════
   MAIN CONTENT
════════════════════════════════════════════════════════════════ */
.cd-main { position: relative; min-height: 300px; }

/* Loading */
.cd-loading {
  position: absolute;
  inset: 0;
  background: rgba(247, 248, 250, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--cd-transition);
  border-radius: var(--cd-radius);
}
.cd-loading.active { opacity: 1; pointer-events: auto; }
.cd-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--cd-border);
  border-top-color: var(--cd-primary);
  border-radius: 50%;
  animation: cd-spin 0.8s linear infinite;
}
@keyframes cd-spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════════════
   RESULTS GRID
════════════════════════════════════════════════════════════════ */
.cd-results.cd-view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.cd-results.cd-view-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* No results */
.cd-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
  color: var(--cd-text-muted);
}
.cd-no-results i {
  font-size: 48px;
  color: var(--cd-border);
  display: block;
  margin-bottom: 16px;
}
.cd-no-results p { font-size: 16px; margin: 0; }

/* ════════════════════════════════════════════════════════════════
   PERSON CARD — GRID
════════════════════════════════════════════════════════════════ */
.cd-card {
  background: var(--cd-surface);
  border: 1px solid var(--cd-border);
  border-radius: var(--cd-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--cd-transition), box-shadow var(--cd-transition), border-color var(--cd-transition);
  position: relative;
  animation: cd-card-in 0.35s ease both;
}
.cd-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--cd-shadow-lg);
  border-color: var(--cd-primary);
}
@keyframes cd-card-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Featured badge */
.cd-featured-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--cd-accent);
  color: var(--cd-primary-dark);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(232,160,32,0.5);
}

/* Photo */
.cd-card-photo-link { display: block; text-decoration: none; }
.cd-card-photo {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: linear-gradient(135deg, var(--cd-surface-2) 0%, #dce3f0 100%);
  position: relative;
}
.cd-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.cd-card:hover .cd-card-photo img { transform: scale(1.04); }
.cd-card-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--cd-font-display);
  font-size: 48px;
  font-weight: 700;
  color: var(--cd-primary-light);
  opacity: 0.4;
  letter-spacing: -2px;
}

/* Card body */
.cd-card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}
.cd-card-header { display: flex; flex-direction: column; gap: 4px; }
.cd-card-name {
  font-family: var(--cd-font-display);
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}
.cd-card-name a {
  color: var(--cd-text);
  text-decoration: none;
  transition: color var(--cd-transition);
}
.cd-card-name a:hover { color: var(--cd-primary); }
.cd-card-title {
  font-size: 13px;
  color: var(--cd-text-muted);
  font-weight: 500;
  margin: 0;
}
.cd-card-dept {
  font-size: 12.5px;
  color: var(--cd-text-light);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.cd-card-dept i { color: var(--cd-primary-light); }
.cd-card-excerpt {
  font-size: 13px;
  color: var(--cd-text-muted);
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Contact links */
.cd-card-contact {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: auto;
  border-top: 1px solid var(--cd-border);
  padding-top: 10px;
}
.cd-contact-link {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--cd-text-muted);
  text-decoration: none;
  transition: color var(--cd-transition);
  overflow: hidden;
}
.cd-contact-link i { color: var(--cd-primary-light); font-size: 12px; flex-shrink: 0; }
.cd-contact-link span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.cd-contact-link:hover { color: var(--cd-primary); }

/* CTA */
.cd-card-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--cd-off-white);
  color: var(--cd-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--cd-radius-sm);
  transition: background var(--cd-transition), color var(--cd-transition);
}
.cd-card-cta:hover {
  background: var(--cd-primary);
  color: var(--cd-white);
}
.cd-card-cta i { font-size: 11px; transition: transform var(--cd-transition); }
.cd-card-cta:hover i { transform: translateX(3px); }

/* ── LIST view override ── */
.cd-view-list .cd-card {
  flex-direction: row;
  align-items: stretch;
}
.cd-view-list .cd-card-photo-link {
  width: 120px;
  flex-shrink: 0;
}
.cd-view-list .cd-card-photo {
  aspect-ratio: unset;
  height: 100%;
  min-height: 120px;
}
.cd-view-list .cd-card-body {
  padding: 14px 18px;
}
.cd-view-list .cd-card-excerpt { -webkit-line-clamp: 2; }

/* ════════════════════════════════════════════════════════════════
   ROLE BADGES
════════════════════════════════════════════════════════════════ */
.cd-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--cd-surface-2);
  color: var(--cd-text-muted);
  width: fit-content;
}
.cd-role-badge.cd-role-faculty    { background: rgba(26,58,107,0.12);  color: var(--cd-role-faculty);    }
.cd-role-badge.cd-role-staff      { background: rgba(45,106,79,0.12);  color: var(--cd-role-staff);      }
.cd-role-badge.cd-role-student    { background: rgba(123,45,139,0.12); color: var(--cd-role-student);    }
.cd-role-badge.cd-role-admin      { background: rgba(181,71,8,0.12);   color: var(--cd-role-admin);      }
.cd-role-badge.cd-role-researcher { background: rgba(29,78,137,0.12);  color: var(--cd-role-researcher); }
.cd-role-badge.cd-role-emeritus   { background: rgba(73,80,87,0.12);   color: var(--cd-role-emeritus);   }

/* ════════════════════════════════════════════════════════════════
   PAGINATION / LOAD MORE
════════════════════════════════════════════════════════════════ */
.cd-pagination {
  margin-top: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.cd-load-more {
  background: var(--cd-white);
  border: 2px solid var(--cd-primary);
  color: var(--cd-primary);
  padding: 12px 32px;
  border-radius: 100px;
  font-family: var(--cd-font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--cd-transition), color var(--cd-transition), transform var(--cd-transition);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cd-load-more:hover {
  background: var(--cd-primary);
  color: var(--cd-white);
  transform: translateY(-2px);
}
.cd-load-more:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.cd-pagination-info { font-size: 12.5px; color: var(--cd-text-light); }

/* ════════════════════════════════════════════════════════════════
   PROFILE PAGE
════════════════════════════════════════════════════════════════ */
.cd-breadcrumb {
  font-size: 13px;
  color: var(--cd-text-muted);
  margin-bottom: 24px;
}
.cd-breadcrumb a {
  color: var(--cd-primary);
  text-decoration: none;
}
.cd-breadcrumb a:hover { text-decoration: underline; }
.cd-breadcrumb span[aria-current] { color: var(--cd-text-muted); }

/* Hero */
.cd-profile-hero {
  /* Soporta colores personalizados por perfil via variables CSS inyectadas inline */
  background: linear-gradient(
    135deg,
    var(--cd-profile-hero-from, var(--cd-primary-dark)) 0%,
    var(--cd-profile-hero-to,   var(--cd-primary))      55%,
    var(--cd-profile-hero-to,   var(--cd-primary-light)) 100%
  );
  border-radius: var(--cd-radius);
  padding: 40px 40px 48px;
  color: #ffffff;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.cd-profile-hero::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(232,160,32,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.cd-profile-hero-inner {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}
.cd-profile-photo-wrap { flex-shrink: 0; }
.cd-profile-photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255,255,255,0.3);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.cd-profile-initials {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 4px solid rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--cd-font-display);
  font-size: 52px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  letter-spacing: -3px;
}
.cd-profile-headline { flex: 1; }
.cd-profile-name {
  font-family: var(--cd-font-display);
  font-size: 30px;
  font-weight: 700;
  margin: 8px 0 4px;
  line-height: 1.2;
  color: var(--cd-profile-name-color, #ffffff) !important;
  text-shadow: 0 1px 6px rgba(0,0,0,0.45);
}
/* Especificidad extra para vencer reglas del tema de WordPress */
.cd-profile-hero .cd-profile-name,
.cd-profile-hero .cd-profile-name a,
.cd-profile-hero h1.cd-profile-name {
  color: var(--cd-profile-name-color, #ffffff) !important;
  text-shadow: 0 1px 6px rgba(0,0,0,0.45);
}
.cd-profile-title {
  font-size: 17px;
  font-weight: 300;
  margin: 0 0 4px;
  color: var(--cd-profile-text-color, rgba(255,255,255,0.88)) !important;
}
.cd-profile-hero .cd-profile-title {
  color: var(--cd-profile-text-color, rgba(255,255,255,0.88)) !important;
}
.cd-profile-credentials {
  font-size: 14px;
  margin: 0 0 16px;
  font-style: italic;
  color: var(--cd-profile-text-color, rgba(255,255,255,0.72)) !important;
}
.cd-profile-hero .cd-profile-credentials {
  color: var(--cd-profile-text-color, rgba(255,255,255,0.72)) !important;
}

/* Quick contact chips */
.cd-profile-quick-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.cd-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.15);
  color: var(--cd-white);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.25);
  transition: background var(--cd-transition);
}
.cd-chip:hover { background: rgba(255,255,255,0.25); color: var(--cd-white); }
.cd-chip i { font-size: 12px; }

/* Social links */
.cd-profile-social { display: flex; gap: 10px; }
.cd-social-link {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  color: var(--cd-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.2);
  transition: background var(--cd-transition), transform var(--cd-transition);
}
.cd-social-link:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-2px);
  color: var(--cd-white);
}

/* Profile body */
.cd-profile-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 860px) {
  .cd-profile-body { grid-template-columns: 1fr; }
  .cd-profile-sidebar { order: -1; }
}

/* Sections */
.cd-profile-section {
  background: var(--cd-surface);
  border: 1px solid var(--cd-border);
  border-radius: var(--cd-radius);
  padding: 28px;
  margin-bottom: 20px;
}
.cd-section-heading {
  font-family: var(--cd-font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--cd-primary);
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--cd-border);
  display: flex;
  align-items: center;
  gap: 9px;
}
.cd-section-heading i { font-size: 16px; color: var(--cd-accent); }
.cd-profile-bio { font-size: 15px; line-height: 1.75; color: var(--cd-text); }
.cd-profile-bio p { margin: 0 0 16px; }
.cd-profile-bio p:last-child { margin: 0; }

/* Tags */
.cd-tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cd-tag {
  background: var(--cd-surface-2);
  color: var(--cd-text-muted);
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 13px;
  border: 1px solid var(--cd-border);
  font-weight: 500;
}

/* Sidebar cards */
.cd-profile-sidebar { display: flex; flex-direction: column; gap: 16px; }
.cd-sidebar-card {
  background: var(--cd-surface);
  border: 1px solid var(--cd-border);
  border-radius: var(--cd-radius);
  padding: 22px;
}
.cd-sidebar-heading {
  font-family: var(--cd-font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--cd-primary);
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--cd-border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cd-sidebar-heading i { color: var(--cd-accent); font-size: 14px; }

/* Detail list */
.cd-detail-list {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  align-items: start;
}
.cd-detail-list dt {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cd-text-light);
  padding-top: 4px;
  white-space: nowrap;
}
.cd-detail-list dd {
  font-size: 13.5px;
  color: var(--cd-text);
  margin: 0;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 3px;
}
.cd-detail-list dd i { color: var(--cd-primary-light); font-size: 12px; margin-right: 4px; }
.cd-detail-list dd a {
  color: var(--cd-primary);
  text-decoration: none;
  font-weight: 500;
}
.cd-detail-list dd a:hover { text-decoration: underline; }
.cd-dept-link, .cd-prog-link {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--cd-primary);
  text-decoration: none;
}
.cd-dept-link:hover, .cd-prog-link:hover { text-decoration: underline; }

/* ════════════════════════════════════════════════════════════════
   LISTING PAGES (departments, programs, buildings)
════════════════════════════════════════════════════════════════ */
.cd-listing-header {
  background: var(--cd-primary);
  background-size: cover;
  background-position: center;
  border-radius: var(--cd-radius) var(--cd-radius) 0 0;
  padding: 36px 40px;
  color: var(--cd-white);
  position: relative;
  overflow: hidden;
}
.cd-listing-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(10,27,56,0.85) 0%, rgba(26,58,107,0.7) 100%);
}
.cd-listing-header-inner { position: relative; z-index: 1; }
.cd-listing-type {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
  margin: 0 0 6px;
}
.cd-listing-title {
  font-family: var(--cd-font-display);
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
}
.cd-listing-code {
  background: rgba(255,255,255,0.15);
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.cd-listing-body {
  background: var(--cd-surface);
  border: 1px solid var(--cd-border);
  border-top: none;
  padding: 28px 32px;
  margin-bottom: 24px;
}
.cd-listing-desc { font-size: 15px; line-height: 1.75; margin-bottom: 16px; }
.cd-listing-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  font-size: 13.5px;
  color: var(--cd-text-muted);
}
.cd-listing-meta-row a {
  color: var(--cd-primary);
  text-decoration: none;
}
.cd-listing-meta-row a:hover { text-decoration: underline; }
.cd-listing-meta-row i { margin-right: 5px; color: var(--cd-primary-light); }
.cd-listing-people-heading {
  font-family: var(--cd-font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--cd-primary);
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cd-count-badge {
  background: var(--cd-primary);
  color: var(--cd-white);
  font-family: var(--cd-font-body);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 100px;
}

/* ════════════════════════════════════════════════════════════════
   ADMIN META BOX STYLES
════════════════════════════════════════════════════════════════ */
.campus-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 8px 0;
}
.campus-meta-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #646970;
  margin-bottom: 5px;
}
.campus-meta-field input[type="text"],
.campus-meta-field input[type="email"],
.campus-meta-field input[type="url"],
.campus-meta-field input[type="tel"],
.campus-meta-field input[type="number"] {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #dcdcde;
  border-radius: 4px;
  font-size: 13.5px;
}
.campus-meta-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .cd-sidebar { position: static; }
  .cd-search-bar { padding: 20px 20px 16px; }
  .cd-profile-hero { padding: 28px 24px 32px; }
  .cd-profile-hero-inner { flex-direction: column; align-items: center; text-align: center; gap: 20px; }
  .cd-profile-name { font-size: 24px; }
  .cd-profile-quick-contact { justify-content: center; }
  .cd-profile-social { justify-content: center; }
}
@media (max-width: 600px) {
  .cd-results.cd-view-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .cd-view-list .cd-card { flex-direction: column; }
  .cd-view-list .cd-card-photo-link { width: 100%; }
  .cd-view-list .cd-card-photo { aspect-ratio: 4/3; height: auto; }
  .cd-listing-header { padding: 24px 20px; }
  .cd-listing-body { padding: 20px; }
}

/* ════════════════════════════════════════════════════════════════
   PRINT
════════════════════════════════════════════════════════════════ */
@media print {
  .cd-sidebar, .cd-search-bar, .cd-card-cta,
  .cd-social-link, .cd-view-toggle { display: none !important; }
  .cd-layout { grid-template-columns: 1fr; }
  .cd-profile-hero { background: var(--cd-primary) !important; -webkit-print-color-adjust: exact; }
}

/* ══════════════════════════════════════════════════════
   PERSONALIZACIÓN DE COLOR POR FICHA
   Las variables se inyectan inline SOLO cuando el admin
   configuró un color real. No se usa ninguna clase extra
   para evitar que tarjetas sin color rompan su estilo.
   ══════════════════════════════════════════════════════ */
.cd-card[style*="--cd-card-custom-bg"] {
    background: var(--cd-card-custom-bg);
}
.cd-card[style*="--cd-card-custom-accent"] {
    border-top-color: var(--cd-card-custom-accent);
}
.cd-card[style*="--cd-card-custom-accent"] .cd-card-cta {
    background: var(--cd-card-custom-accent);
    color: #fff;
}
.cd-card[style*="--cd-card-custom-accent"] .cd-card-cta:hover {
    filter: brightness(0.9);
}
.cd-card[style*="--cd-card-custom-accent"] .cd-role-badge {
    background: color-mix(in srgb, var(--cd-card-custom-accent) 15%, transparent);
    color: var(--cd-card-custom-accent);
    border-color: var(--cd-card-custom-accent);
}
.cd-card[style*="--cd-card-custom-name"] .cd-card-name a {
    color: var(--cd-card-custom-name);
}

/* ══════════════════════════════════════
   COLORES PERSONALIZADOS DEL HERO
   ══════════════════════════════════════
   El template inyecta en el atributo style del hero:
   --cd-profile-hero-from  (color inicio del degradado)
   --cd-profile-hero-to    (color fin del degradado)
   --cd-profile-name-color (color del nombre)
   --cd-profile-text-color (color del subtítulo/texto)
   --cd-profile-accent     (chips, social links)
*/
.cd-profile-hero[style] .cd-chip {
    background: color-mix(in srgb, var(--cd-profile-accent, #fff) 18%, transparent);
    border-color: color-mix(in srgb, var(--cd-profile-accent, #fff) 35%, transparent);
    color: var(--cd-profile-name-color, #fff);
}
.cd-profile-hero[style] .cd-social-link {
    background: color-mix(in srgb, var(--cd-profile-accent, #fff) 18%, transparent);
    border-color: color-mix(in srgb, var(--cd-profile-accent, #fff) 30%, transparent);
    color: var(--cd-profile-name-color, #fff);
}
.cd-profile-hero[style] .cd-role-badge {
    background: color-mix(in srgb, var(--cd-profile-accent, #e8a020) 20%, transparent);
    color: var(--cd-profile-accent, #e8a020);
    border-color: transparent;
}

/* ══════════════════════════════════════════════════════
   SECCIÓN HTML PERSONALIZADO
   ══════════════════════════════════════════════════════ */
.cd-custom-html-content {
    line-height: 1.7;
    color: var(--cd-text);
}
.cd-custom-html-content a {
    color: var(--cd-primary);
    text-decoration: underline;
}
.cd-custom-html-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}
.cd-custom-html-content th,
.cd-custom-html-content td {
    padding: 8px 12px;
    border: 1px solid var(--cd-border);
    text-align: left;
}
.cd-custom-html-content th {
    background: var(--cd-primary);
    color: #fff;
    font-weight: 600;
}
.cd-custom-html-content tr:nth-child(even) td {
    background: var(--cd-off-white);
}
.cd-custom-html-content ul,
.cd-custom-html-content ol {
    padding-left: 24px;
    margin: 12px 0;
}
.cd-custom-html-content li {
    margin-bottom: 6px;
}
.cd-custom-html-content iframe,
.cd-custom-html-content video {
    max-width: 100%;
    border-radius: var(--cd-radius);
}

/* Título de grid inline */
.cd-grid-title {
    font-family: var(--cd-font-display);
    color: var(--cd-primary);
    font-size: 1.6rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--cd-accent);
}
