/* Responsive fixes (cleaned top section)
  Global helper overrides loaded after `styles.css`. Keep minimal and specific.
*/

/* Theme override: primary reds for navbar and accents */
:root{ --primary-red-1: #b71c1c; --primary-red-2: #e53935; --primary-red-3: #7f0f0f; }

/* Make dropdown menus more opaque and readable */
#header .navbar .dropdown ul {
  background: linear-gradient(180deg, rgba(214,61,61,0.92) 0%, rgba(201,31,31,0.90) 100%) !important;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  backdrop-filter: blur(4px);
}

#header .navbar .dropdown ul a {
  color: #fff !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

/* Better box model */
*, *::before, *::after { box-sizing: border-box; }

/* Make media (images, video, iframe, svg) fluid */
img, picture, svg, video, iframe, embed {
  max-width: 100%;
  height: auto;
}

/* Site header sizing variable: restore original value */
:root { --site-header-height: 80px; }

/* Reserve header space and keep header fixed */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--site-header-height);
  transition: transform 0.28s ease, height 0.2s ease;
  z-index: 997;
}

/* Reserve body padding so content doesn't jump when header is fixed */
body { margin: 0; padding-top: var(--site-header-height); }

/* Provide fluid container fallback if fixed px widths were used */
.container, .container-fluid { width: 100%; max-width: 1200px; margin-left: auto; margin-right: auto; padding-left: 12px; padding-right: 12px; }

/* Back-to-top styles (kept concise) */
.back-to-top {
  width: 3rem !important;
  height: 3rem !important;
  right: 1rem !important;
  bottom: 1rem !important;
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.28s ease, visibility 0.28s ease, transform 0.28s ease;
  z-index: 9998;
}
.back-to-top.active {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

/* Preloader spinner size clamp */
#preloader:before {
  width: clamp(40px, 6vw, 80px) !important;
  height: clamp(40px, 6vw, 80px) !important;
  left: calc(50% - (clamp(40px,6vw,80px)/2)) !important;
  top: calc(50% - (clamp(40px,6vw,80px)/2)) !important;
}

/* Helpful media queries: phone overrides will lower header height */
@media (max-width: 576px) {
  :root { --site-header-height: 88px; }
  #header { height: var(--site-header-height); }
  body { margin: 0; padding-top: var(--site-header-height); }
}

/* Header/logo: keep logo constrained */
#header { height: auto !important; min-height: 56px; }
#header .logo img { max-height: clamp(36px, 6vw, 80px); }

/* Logo layout: keep the two header images side-by-side, prevent overlap */
#header .logo {
  display: inline-flex;
  align-items: center;
  gap: 0.08rem; /* tighten spacing even more */
  white-space: nowrap;
  line-height: 1;
  margin-left: -20px; /* move logos further left to maximize left alignment */
  padding-left: 0;
  border-left: none !important; /* remove decorative left border for contrast */
  transform: translateX(-2px);
}
#header .logo img {
  display: inline-block;
  vertical-align: middle;
  max-height: clamp(36px, 6vw, 80px);
  width: auto;
  margin: 0;
}
/* Keep combined logo consistent with other logo sizing rules (don't force oversized logos) */
#header .logo img:only-of-type,
#header .logo img.header-combined-logo {
  max-height: clamp(36px, 6vw, 80px) !important;
  height: auto !important;
  width: auto !important;
  margin: 0 8px !important;
  display: inline-block;
}

/* Make the combined logo image visually larger and shift it left without
   affecting the navbar layout. The `.logo` element keeps a min-width to
   reserve space in the flex layout; the actual `img` is positioned
   absolutely inside the logo and pulled left so it appears independent. */
#header .logo {
  position: fixed !important; /* independent of container/layout */
  left: 12px !important; /* distance from left edge of viewport */
  top: calc(var(--site-header-height) / 2 - 12px) !important; /* slightly higher */
  transform: translateY(-50%) !important;
  margin: 0 !important;
  padding: 0 !important;
  width: auto !important;
  z-index: 1100 !important; /* below navbar so it doesn't cover links */
}

/* Improve button text readability across pages */
.table-modern a,
.btn-download,
.btn-register,
.payment-btn,
.convocatoria-card .btn,
.curriculum-section a {
  font-weight: 700 !important;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.22);
  color: #fff !important;
}

/* Convocatorias: texto negro para mejor contraste en los botones */
.convocatoria-card .btn,
.convocatoria-card .btn-download,
.convocatoria-card .btn-register {
  color: #111 !important;
  text-shadow: none !important;
}

.convocatoria-card .btn-download:hover,
.convocatoria-card .btn-register:hover {
  color: #fff !important;
}

.btn-register {
  border: 2px solid #d63d3d !important;
  color: #fff !important;
}

.btn-register:hover {
  color: #fff !important;
  background: linear-gradient(135deg, #d63d3d 0%, #c91f1f 100%) !important;
}

/* Center and space program cards and tables */
#services .container > .row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 24px 16px !important;
  justify-content: center !important;
}

/* Curriculum quick access as standalone card between header and content */
#services .container > .curriculum-quick-access {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 15px !important;
  background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%) !important;
  border: 2px solid rgba(214, 61, 61, 0.15) !important;
  box-shadow: 0 8px 25px rgba(214, 61, 61, 0.12) !important;
  border-radius: 16px !important;
  padding: 18px 28px !important;
  margin: 0 auto 40px auto !important;
  width: fit-content !important;
  max-width: 450px !important;
  box-sizing: border-box !important;
  transition: all 0.3s ease !important;
}

/* Curriculum quick access in two-column layout */
.quick-info-section .curriculum-quick-access {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 15px !important;
  background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%) !important;
  border: 2px solid rgba(214, 61, 61, 0.15) !important;
  box-shadow: 0 8px 25px rgba(214, 61, 61, 0.12) !important;
  border-radius: 16px !important;
  padding: 18px 28px !important;
  margin: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  transition: all 0.3s ease !important;
}

.curriculum-quick-access:hover {
  border-color: rgba(214, 61, 61, 0.25) !important;
  box-shadow: 0 12px 35px rgba(214, 61, 61, 0.16) !important;
  transform: translateY(-2px) !important;
}

/* Quick Info Section - Curriculum + Requirements */
.quick-info-section {
  margin-bottom: 40px !important;
}

.quick-requirements-box {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: auto !important;
}

.quick-requirements-box .description {
  font-size: 13px !important;
}

.quick-requirements-box ul {
  margin-bottom: 0 !important;
  padding-left: 20px !important;
}

.quick-requirements-box li {
  margin-bottom: 6px !important;
  font-size: 13px !important;
}

.curriculum-quick-access h5 {
  margin: 0 !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #d63d3d !important;
  letter-spacing: 0.01em !important;
  white-space: nowrap !important;
}

.curriculum-quick-access .map-open-btn {
  background: linear-gradient(135deg, #d63d3d 0%, #c91f1f 100%) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 10px !important;
  padding: 10px 22px !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  letter-spacing: 0.01em !important;
  box-shadow: 0 6px 16px rgba(214, 61, 61, 0.25) !important;
  transition: all 0.3s ease !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

.curriculum-quick-access .map-open-btn:hover,
.curriculum-quick-access .map-open-btn:focus {
  transform: translateY(-2px) !important;
  box-shadow: 0 12px 32px rgba(214, 61, 61, 0.35) !important;
  outline: none !important;
  background: linear-gradient(135deg, #c91f1f 0%, #a01515 100%) !important;
}

.curriculum-section {
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}

#header .logo img.header-combined-logo {
  position: relative !important;
  left: 0 !important;
  top: 0 !important;
  transform: none !important;
  max-height: 40px !important; /* default visible size - reduced for better proportions */
  width: auto !important;
  z-index: 1100 !important;
  display: block !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  filter: drop-shadow(0 4px 12px rgba(163,27,27,0.1));
  border-radius: 6px;
}

/* media breakpoints for logo sizing and offsets */
@media (max-width: 1200px) {
  /* keep the logo small and positioned absolutely so it doesn't move the nav */
  #header .logo img.header-combined-logo { max-height: 38px !important; left: 0; top: 0; }
}

@media (max-width: 992px) {
  #header .logo img.header-combined-logo { max-height: 36px !important; left: 0; top: 0; }
}

@media (max-width: 576px) {
  #header .logo img.header-combined-logo { max-height: 32px !important; left: 0; top: 0; box-shadow: 0 6px 16px rgba(0,0,0,0.3); filter: none; }
}

/* Keep the navbar centered in the header so logo doesn't affect its position */
#header .col-xl-11.d-flex {
  justify-content: center !important;
}

/* Ensure nav stays above the logo visually */
#header .navbar { z-index: 1150; }

/* Reduce left offset if the logo would touch the edge on very small screens */
@media (max-width: 420px) {
  #header .logo { left: 6px !important; }
}

/* Disable the old full-width pseudo-element underline on the anchor itself */
#header .navbar a::after { display: none !important; }

/* Centered underline attached to the text label itself */
#header .navbar a > .nav-label {
  position: relative;
  display: inline-block;
}

#header .navbar a > .nav-label::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -8px;
  width: 3.2em; /* centered under the text; adjust if you want it shorter/longer */
  height: 3px;
  background: rgba(255,255,255,0.16);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

#header .navbar a:hover > .nav-label::after,
#header .navbar .active > .nav-label::after {
  opacity: 1;
  transform: translateX(-50%) scaleX(1);
}

/* small responsive adjustments are handled later in this file using the existing breakpoints */

/* Reduce left offset on very small screens so header doesn't overflow */
@media (max-width: 576px) {
  #header .logo {
    margin-left: -6px;
    gap: 0.12rem;
  }
  #header .logo img:first-of-type { max-height: clamp(22px, 6vw, 44px); }
  #header .logo img:last-of-type { max-height: clamp(24px, 7vw, 48px); }
}

/* Ensure logo anchor doesn't inherit nav link styles */
#header a > .logo, #header .logo a { color: inherit; text-decoration: none; }

/* Pull hero up so its background sits under the fixed header (removes white seam) */
#hero {
  margin-top: calc(-1 * var(--site-header-height));
}
#hero .carousel-container { left: 5%; right: 5%; top: 0; padding-top: calc(var(--site-header-height) + 6px); }

/* Keep navbar link size conservative so it fits the header */
#header .navbar a { font-size: 15px; }

/* Expanded mobile menu (when hamburger opens, `show-all-dropdowns` is added to #navbar)
   This style shows a more visible, full-list panel that can scroll and present options clearly.
*/
#navbar.show-all-dropdowns ul {
  position: fixed;
  top: var(--site-header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(169, 48, 48, 0.608);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  z-index: 9999;
}

#navbar.show-all-dropdowns ul li a {
  font-size: 18px !important;
  padding: 12px 16px !important;
  color: #111 !important;
}

#navbar.show-all-dropdowns .dropdown ul {
  padding-left: 18px !important;
}

/* Stronger, improved full-panel mobile menu styles */
#navbar.show-all-dropdowns {
  position: fixed !important;
  top: var(--site-header-height) !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(255,255,255,0.99) !important;
  z-index: 11000 !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 12px 0 0 0 !important;
  overflow-y: auto !important;
}

#navbar.show-all-dropdowns > ul {
  list-style: none !important;
  margin: 0 !important;
  padding: 8px 0 !important;
  width: 100% !important;
}

#navbar.show-all-dropdowns li {
  width: 100% !important;
}

#navbar.show-all-dropdowns li a {
  display: block !important;
  width: 100% !important;
  padding: 16px 20px !important;
  font-size: 16px !important;
  color: #111 !important;
  background: transparent !important;
  border-bottom: 1px solid rgba(0,0,0,0.08) !important;
  text-decoration: none !important;
}

/* Nested submenu items slightly indented */
#navbar.show-all-dropdowns .dropdown ul {
  padding-left: 18px !important;
  background: transparent !important;
}

/* Prevent page from scrolling when mobile menu is open */
body.mobile-menu-open {
  overflow: hidden !important;
  touch-action: none !important;
}

/* Close button shown inside the full-panel mobile menu overlay */
.mobile-overlay-close {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 12050;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #c41e3a;
  color: #ffffff;
  border: none;
  border-radius: 50%; /* circular */
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  padding: 0;
}
.mobile-overlay-close:hover,
.mobile-overlay-close:focus {
  transform: scale(1.08);
  background: #a01830;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  outline: none;
}
.mobile-overlay-close:focus {
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.3);
}

/* ensure the original mobile toggle stays visible and above the overlay if present */
.mobile-nav-toggle {
  z-index: 12100;
  position: relative;
}

/* Slight visual polish for overlay to avoid thin white band at top */
#navbar.show-all-dropdowns {
  top: 0 !important; /* stretch up under header so close button aligns visually */
  padding-top: calc(var(--site-header-height) + 0px) !important;
}

/* Portfolio & testimonial items: prefer aspect-ratios where possible */
#portfolio .portfolio-item { height: auto; }
#portfolio .portfolio-item figure { height: auto; aspect-ratio: 16/9; }

/* Header hide/show on scroll: transform-based for smooth animation */
#header {
  transition: transform 0.28s ease, height 0.28s ease, background 0.28s ease;
  will-change: transform;
}
.header-hidden {
  transform: translateY(-110%) !important;
}
.header-scrolled.header-hidden {
  /* Ensure header-hidden always moves header away even if header-scrolled sets height */
  transform: translateY(-110%) !important;
  transition: transform 0.28s ease !important;
}
.header-fixed-visible {
  transform: translateY(0) !important;
}

/* Hero expansion when header hidden: move up and slightly scale visuals */
#hero {
  transition: transform 0.28s ease;
  transform-origin: top center;
}
.hero-expanded {
  transform: translateY(-12px) scale(1.02);
}

/* Navbar text: use white text to contrast with the red navbar background */
#header .navbar a, #header .navbar a:focus, #header .navbar .dropdown > a > span {
  color: #fff !important;
  text-shadow: none !important;
  font-weight: 700;
}

/* Navbar hover/active state: use a short centered bar under the text via ::after
   This avoids a full-width pill and prevents the line from extending past the label. */
#header .navbar a:hover, #header .navbar .active, #header .navbar a:active {
  color: #fff !important;
  background: transparent !important;
  border-radius: 0 !important;
}

/* Ensure nav links can position the underline pseudo-element */
#header .navbar a {
  position: relative !important;
}

/* Short centered underline for nav items */
#header .navbar a::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%) scaleX(0.9);
  bottom: 8px; /* distance from bottom of link container; tweak if needed */
  width: 36%; /* short line — adjust percent to change length */
  height: 3px;
  background: rgba(255,255,255,0.14);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

#header .navbar a:hover::after, #header .navbar .active::after {
  opacity: 1;
  transform: translateX(-50%) scaleX(1);
}

/* Make hamburger icon light on red header */
#header.header-transparent .mobile-nav-toggle,
#header.header-transparent .mobile-nav-toggle i { color: #fff !important; }

/* Keep mobile menu links readable and compact */
.navbar-mobile a {
  color: #000 !important;
  text-shadow: none !important;
  font-size: 15px !important;
  padding: 8px 12px !important;
}

/* Mobile menu container: limit height and allow scrolling so all options fit */
.navbar-mobile ul {
  top: var(--site-header-height);
  max-height: calc(100vh - var(--site-header-height));
  overflow-y: auto;
  padding-bottom: 12px;
}

/* Nested dropdowns in mobile view: make them fit and wrap text */
.navbar-mobile .dropdown ul {
  display: block !important;
  position: static !important;
  max-height: none;
  overflow: visible;
  padding-left: 12px !important;
}
.navbar-mobile .dropdown ul li {
  min-width: auto !important;
}
.navbar-mobile .dropdown ul a {
  font-size: 14px !important;
  white-space: normal !important;
  padding: 6px 12px !important;
}

/* Header background override so white logos remain visible
   We remove solid red background here: the visual tint is provided by
   the `#header::before` pseudo-element (see `styles.css` and final overrides).
*/
#header.header-transparent {
  background: transparent !important;
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  color: #fff;
}

/* Make mobile/hamburger icon clearly visible (black) */
.mobile-nav-toggle,
.mobile-nav-toggle i,
.mobile-nav-toggle.bi {
  color: #000 !important;
  font-size: 26px !important;
}

/* Ensure dropdown chevrons/icons are light on the red header */
#header.header-transparent .navbar .bi { color: #fff !important; }

/* When navbar becomes mobile (toggled), give it a subtle contrasting background */
#header .navbar.navbar-mobile {
  background-color: rgba(241,246,255,0.98) !important;
  width: 100%;
  left: 0;
  right: 0;
  padding-top: 8px;
  padding-bottom: 12px;
}

/* Force dropdown links to be smaller and wrap so nested lists fit */
#header .navbar .dropdown ul a {
  font-size: 14px !important;
  white-space: normal !important;
  padding: 6px 12px !important;
}

/* Suggestion-ready style: make nested lists collapsible on mobile visually (class-based) */
/* Show visual state for open dropdowns */
#header .navbar .dropdown.open > a, #header .navbar .dropdown-open > a { font-weight: 700; }

/* Smooth open/close for dropdowns on mobile */
.navbar-mobile .dropdown > ul {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
}
.navbar-mobile .dropdown > .dropdown-active {
  max-height: 1000px; /* generous limit to allow the menu to expand; actual height constrained by container */
}

/* Extra: reduce overall navbar link size slightly for dense menus */
#header .navbar a {
  font-size: 15px;
}

/* Ensure social icons and small squares scale */
#footer .footer-top .social-links a { width: 2.25rem; height: 2.25rem; }

/* Make progress circles and bars fluid in .progress components */
.progress { width: 100% !important; max-width: 900px; }
.progress .circle, .progress .bar { width: auto; height: auto; }

/* Primary buttons override to strong red gradient */
.btn-primary, .btn.btn-primary, .btn.primary {
  background: linear-gradient(90deg, var(--primary-red-1), var(--primary-red-2)) !important;
  border-color: rgba(0,0,0,0.06) !important;
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(229,57,53,0.12) !important;
}

/* Global link accent to red — keep standard links as readable */
a, a:link, a:visited { color: var(--primary-red-2); }
a:hover, a:focus { color: var(--primary-red-1); text-decoration: underline; }


/* Small adjustments for very small screens */
@media (max-width: 420px) {
  #hero .container, .container, .container-fluid { padding-left: 8px; padding-right: 8px; }
  .navbar a { padding-left: 12px; padding-right: 12px; }
}

/* Final header overlay overrides: make the header gradient more transparent so
   the hero/carousel shows through. This is deliberately specific and loaded
   last to win over other rules. Tweak alpha values to taste. */
#header::before {
  background: linear-gradient(90deg, rgba(163,27,27,0.20) 0%, rgba(106,13,13,0.15) 100%) !important;
}

/* When the site applies `header-transparent` class we want it even more translucent */
#header.header-transparent::before {
  background: linear-gradient(90deg, rgba(163,27,27,0.12) 0%, rgba(106,13,13,0.10) 100%) !important;
}

/* Keep scrolled state readable by increasing opacity when header-scrolled is present */
#header.header-scrolled::before {
  background: linear-gradient(90deg, rgba(163,27,27,0.92) 0%, rgba(106,13,13,0.88) 100%) !important;
}

/* Removed desktop contrast override to restore original translucent header.
   Keeping previous behavior so navbar styles are unaffected. */


/* Mobile-first media query set: fine-grained layout/typography adjustments */
@media (max-width: 1200px) {
  /* gentle reductions for large tablets / small laptops */
  #header .logo { font-size: 28px; }
  #hero { padding-top: 20px; }
  #portfolio .portfolio-item .portfolio-info { padding: 20px; height: auto; }
}

/* Removed desktop short-height caps to restore original hero carousel sizing */

@media (max-width: 992px) {
  /* tablet / landscape phones */
  #hero .carousel-container { top: 60px; left: 4%; right: 4%; }
  #hero h2 { font-size: 36px; }
  .section-header h3 { font-size: 26px; }
  .navbar a { padding: 10px 12px; }
  .container, .container-fluid { padding-left: 10px; padding-right: 10px; }
  .progress { padding-left: 8px; padding-right: 8px; }
}

/* Section headers and small accents: prefer red accents instead of blue */
.section-header h3 { color: var(--primary-red-3) !important; }
.section-header .separator, .section-header .line { background: linear-gradient(90deg, var(--primary-red-1), var(--primary-red-2)) !important; }

@media (max-width: 768px) {
  /* phones */
  #header .logo img { max-height: 56px; }
  #hero h2 { font-size: 28px; }
  #hero p { width: 90%; }
  #portfolio .portfolio-wrap { margin-bottom: 20px; }

/* Mobile dropdown readability */
.navbar-mobile .dropdown ul {
  background: linear-gradient(180deg, rgba(214,61,61,0.94) 0%, rgba(201,31,31,0.92) 100%) !important;
  border-radius: 10px;
}

.navbar-mobile .dropdown ul a {
  color: #fff !important;
  font-weight: 700 !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

/* Floating card with title + open button for mapas curriculares */
.floating-map-card {
  position: fixed;
  left: -6px;
  top: 50%;
  transform: translateY(-50%) translateX(-80%);
  width: 56px;
  height: 56px;
  padding: 0;
  background: linear-gradient(135deg, #d63d3d 0%, #c91f1f 100%);
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
  z-index: 1500;
  transition: transform 0.25s ease, opacity 0.2s ease, box-shadow 0.2s ease, width 0.25s ease, height 0.25s ease, border-radius 0.25s ease, padding 0.2s ease;
  opacity: 0.9;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-map-card::after {
  content: '+';
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.floating-map-card .floating-map-content {
  opacity: 0;
  pointer-events: none;
  width: 100%;
  padding: 0;
  transition: opacity 0.18s ease;
}

.floating-map-card.expand,
.floating-map-card:hover,
.floating-map-card:focus-within {
  width: 240px;
  height: auto;
  padding: 14px 14px 16px 16px;
  border-radius: 0 14px 14px 0;
  transform: translateY(-50%) translateX(0);
  box-shadow: 0 16px 36px rgba(0,0,0,0.26);
}

.floating-map-card.expand::after,
.floating-map-card:hover::after,
.floating-map-card:focus-within::after {
  content: '';
}

.floating-map-card.expand .floating-map-content,
.floating-map-card:hover .floating-map-content,
.floating-map-card:focus-within .floating-map-content {
  opacity: 1;
  pointer-events: auto;
}

.floating-map-card h5 {
  margin: 0 0 10px 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.floating-map-card .map-trigger-btn {
  display: inline-block;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.78);
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.floating-map-card .map-trigger-btn:hover,
.floating-map-card .map-trigger-btn:focus {
  background: rgba(255,255,255,0.22);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .floating-map-card {
    top: auto;
    bottom: 22px;
    left: 12px;
    transform: translateX(0);
    border-radius: 14px;
    width: 64px;
    height: 64px;
  }
}

/* Hide floating card when scrolling down, show when scrolling up (toggle via JS class) */
.floating-map-card.hidden-by-scroll {
  transform: translateY(-50%) translateX(-100%) !important;
  opacity: 0.25;
  pointer-events: none;
}
  .navbar-mobile ul { top: 65px; }
  .progress { display: block; }
  .progress .bar { display: block; width: 100%; margin: .5rem 0; }
  .progress .circle { display: inline-block; margin: 0 .25rem .5rem 0; }
  table, .table_formulario, .table_datos { font-size: 13px; }
}

@media (max-width: 576px) {
  /* small phones — stack and maximize readability */
  #header .logo img { max-height: 48px; }
  #hero .carousel-container { top: 50px; left: 3%; right: 3%; }
  .navbar a { padding-left: 8px; padding-right: 8px; font-size: 13px; }
  .section-header h3 { font-size: 20px; }
  .container, .container-fluid { padding-left: 6px; padding-right: 6px; }
  .btn, button, .btn-get-started { width: 100% !important; max-width: 100%; padding-left: 12px; padding-right: 12px; }
  .carousel-indicators { bottom: 10px !important; }
  /* reduce table cell padding to avoid overflow on tiny screens */
  table th, table td { padding: 6px; }
}

/* Org chart placeholder styling for Directory page */
#org-chart {
  min-height: 360px;
  border: 2px dashed #d0d0d0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  background: #fafafa;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  #org-chart { min-height: 240px; }
}

/* Responsive iframe embed for organigrama */
.org-chart-embed { width: 100%; max-width: 1200px; }
.org-chart-iframe {
  width: 100%;
  min-height: 480px; /* default height for desktop */
  height: auto;
  border: none;
  display: block;
  box-shadow: 0 2px 18px rgba(8,20,40,0.06);
  background: #fff;
}



@media (max-width: 992px) {
  .org-chart-iframe { min-height: 440px; }
}
@media (max-width: 768px) {
  .org-chart-iframe { min-height: 360px; }
}
@media (max-width: 420px) {
  .org-chart-iframe { min-height: 300px; }
}

/* Facebook embed sizing fix */
.fb-page {
  max-width: 100% !important;
  width: 100% !important;
}

.fb-page iframe {
  max-width: 100% !important;
  width: 100% !important;
}

/* Fix for featured services section with facebook */
.col-lg-4 .fb-page {
  margin: 0 auto;
}

@media (max-width: 768px) {
  .col-lg-4 .fb-page {
    max-width: 100% !important;
    width: 100% !important;
  }
}

/* ===== HOME PAGE IMPROVEMENTS ===== */

/* Featured Services Section - Home Page Top */
#main > section:first-child {
  padding: 60px 0 !important;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
}

#main > section:first-child .row {
  align-items: stretch !important;
  gap: 24px !important;
}

#main > section:first-child .box {
  background: white !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
  padding: 30px !important;
  transition: all 0.3s ease !important;
  border: 1px solid rgba(0,0,0,0.05) !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  min-height: 100% !important;
}

#main > section:first-child .box:hover {
  transform: translateY(-8px) !important;
  box-shadow: 0 12px 30px rgba(0,0,0,0.12) !important;
}

#main > section:first-child .box-bg {
  background: linear-gradient(135deg, #d63d3d 0%, #c91f1f 100%) !important;
  color: white !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  min-height: 420px !important;
}

#main > section:first-child .box-bg h3,
#main > section:first-child .box-bg p {
  color: white !important;
}

#main > section:first-child .box-bg h3 {
  font-size: 36px !important;
  font-weight: 800 !important;
  margin-bottom: 20px !important;
  letter-spacing: 0.5px !important;
}

#main > section:first-child .box-bg p {
  font-size: 16px !important;
  line-height: 1.8 !important;
}

/* Facebook box specific */
#main > section:first-child .box:first-child {
  overflow: hidden !important;
}

/* Avisos box specific */
#main > section:first-child .box:last-child {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

#main > section:first-child .box:last-child .btn {
  margin-bottom: 20px !important;
}

#main > section:first-child .box:last-child img {
  max-width: 100% !important;
  height: auto !important;
  margin-top: auto !important;
}

/* About Us Section - Misión, Visión, Principios */
#about {
  padding: 80px 0 !important;
  background: white !important;
}

#about .about-col {
  background: #fff !important;
  border-radius: 12px !important;
  padding: 40px 25px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
  transition: all 0.3s ease !important;
  border: 1px solid rgba(0,0,0,0.05) !important;
  text-align: center !important;
}

#about .about-col:hover {
  transform: translateY(-8px) !important;
  box-shadow: 0 12px 30px rgba(0,0,0,0.12) !important;
}

#about .about-col .icon {
  width: 80px !important;
  height: 80px !important;
  background: linear-gradient(135deg, #d63d3d 0%, #c91f1f 100%) !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 40px !important;
  color: white !important;
  margin: 0 auto 20px !important;
}

#about .about-col h2 {
  font-size: 22px !important;
  font-weight: 700 !important;
  color: #d63d3d !important;
  margin-bottom: 15px !important;
}

#about .about-col p {
  color: #666 !important;
  font-size: 15px !important;
  line-height: 1.8 !important;
}

#about .about-col ul {
  text-align: left !important;
  padding-left: 20px !important;
  margin-top: 15px !important;
}

#about .about-col li {
  color: #666 !important;
  font-size: 14px !important;
  line-height: 1.8 !important;
  margin-bottom: 10px !important;
}

/* Global Box Styling - Applied to ALL .box elements */
.box {
  padding: 35px 25px !important;
  background: white !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
  transition: all 0.4s ease !important;
  border: 2px solid transparent !important;
  min-height: 340px !important;
  display: flex !important;
  flex-direction: column !important;
  margin-bottom: 30px !important;
}

.box:hover {
  transform: translateY(-8px) !important;
  box-shadow: 0 8px 30px rgba(214, 61, 61, 0.15) !important;
  border-color: rgba(214, 61, 61, 0.2) !important;
}

.box .icon {
  width: 70px !important;
  height: 70px !important;
  background: linear-gradient(135deg, #d63d3d 0%, #c91f1f 100%) !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 34px !important;
  color: white !important;
  margin: 0 auto 20px !important;
  transition: transform 0.3s ease !important;
}

.box:hover .icon {
  transform: rotate(10deg) scale(1.1) !important;
}

.box .title {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #222 !important;
  margin-bottom: 15px !important;
}

.box .title a {
  color: #222 !important;
  text-decoration: none !important;
}

.box .title a:hover {
  color: #d63d3d !important;
}

.box .description {
  font-size: 14px !important;
  color: #666 !important;
  line-height: 1.8 !important;
  flex-grow: 1 !important;
  text-align: justify !important;
}

.box .description ul {
  list-style-position: inside !important;
  padding-left: 0 !important;
  margin: 15px 0 0 0 !important;
}

.box .description li {
  margin-bottom: 8px !important;
  font-size: 14px !important;
}

/* Services/Posgrados Section */
#services {
  padding: 80px 0 !important;
  background: #f8f9fa !important;
}

/* Contact Section */
#contact {
  padding: 80px 0 !important;
  background: white !important;
}

#contact .contact-info > div {
  background: #f8f9fa !important;
  border-radius: 12px !important;
  padding: 30px !important;
  box-shadow: 0 4px 15px rgba(0,0,0,0.06) !important;
  transition: all 0.3s ease !important;
  border-left: 4px solid #d63d3d !important;
}

#contact .contact-info > div:hover {
  transform: translateY(-5px) !important;
  box-shadow: 0 8px 25px rgba(214, 61, 61, 0.15) !important;
}

#contact .contact-info i {
  font-size: 32px !important;
  color: #d63d3d !important;
  margin-bottom: 10px !important;
}

#contact .contact-info h3 {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #333 !important;
  margin-bottom: 10px !important;
}

#contact .contact-info p,
#contact .contact-info address {
  color: #666 !important;
  font-size: 14px !important;
  line-height: 1.8 !important;
}

#contact .contact-info a {
  color: #d63d3d !important;
  text-decoration: none !important;
  transition: color 0.3s ease !important;
}

#contact .contact-info a:hover {
  color: #a01515 !important;
  text-decoration: underline !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #about .about-col {
    padding: 30px 20px !important;
    margin-bottom: 30px !important;
  }

  .curriculum-quick-access {
    flex-direction: row !important;
    gap: 12px !important;
    padding: 15px 20px !important;
    align-items: center !important;
    width: auto !important;
  }

  .curriculum-quick-access h5 {
    font-size: 16px !important;
  }

  .curriculum-quick-access .map-open-btn {
    padding: 8px 16px !important;
    font-size: 12px !important;
  }
}
@media (max-width: 768px) {
  #about .about-col {
    padding: 30px 20px !important;
    margin-bottom: 30px !important;
  }

  #contact .contact-info > div {
    margin-bottom: 25px !important;
  }
}

