/* =============================================================
   VEDESCOL — RESPONSIVE.CSS
   Comprehensive responsive fixes for all pages.
   Applied AFTER style.css. Desktop design is preserved.
   Mobile-first adaptive — breakpoints: 430px · 768px · 1024px
   ============================================================= */

/* ─── GLOBAL RESETS ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* ─── BODY: Correct padding-top for fixed navbar ───────────── */
body {
  padding-top: var(--nav-height, 68px) !important;
  overflow-x: hidden;
  min-width: 0;
}

/* ─── GLOBAL CONTAINER SAFETY ────────────────────────────────── */
.container,
.content-wrapper,
section > div,
main > section > div {
  max-width: 100%;
}

/* ─── NAVBAR ─────────────────────────────────────────────────── */
/* Desktop 2-row layout already handled in style.css.
   Here we fix the toggle and mobile drawer. */
.nav-container {
  padding: 0 0.75rem;
  gap: 0.5rem;
  flex-wrap: nowrap;
  align-items: center;
}

/* ─── FOOTER ─────────────────────────────────────────────────── */
.footer {
  width: 100%;
}
.footer-top {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  padding: 3rem 1.5rem;
}
.footer-col {
  min-width: 0;
}
.footer-col p,
.footer-col ul,
.footer-col h5 {
  word-break: break-word;
}

/* ─── HERO SECTIONS ──────────────────────────────────────────── */
.hero-section,
[class*="hero"],
section[style*="padding: 8rem"],
section[style*="padding: 7rem"] {
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

/* ─── CARD GRIDS (general) ───────────────────────────────────── */
.cards-grid,
.grid-3,
.grid-4,
[class*="grid"],
[class*="cards"] {
  min-width: 0;
}

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn-primary,
.btn-secondary,
.nav-btn-donar,
[class*="btn"] {
  white-space: normal;
  word-break: break-word;
}

/* ─── FORMS ──────────────────────────────────────────────────── */
input,
textarea {
  max-width: 100%;
  width: 100%;
}

form select {
  max-width: 100%;
  width: 100%;
}

/* ─── FLOATING ELEMENTS ──────────────────────────────────────── */
.chat-widget {
  bottom: 80px;
  right: 12px;
  max-width: calc(100vw - 24px);
}
.chat-panel {
  max-width: calc(100vw - 24px);
}
.back-to-top {
  bottom: 1.2rem;
  right: 1rem;
}

/* =============================================================
   TABLET — max-width: 1024px
   ============================================================= */
@media (max-width: 1024px) {

  /* body padding for single-row navbar on mobile */
  body {
    padding-top: var(--nav-height, 68px) !important;
  }

  /* Logo shrink on tablet */
  
  .logo-main {
    font-size: 1rem !important;
  }
  .logo-sub {
    font-size: 0.5rem !important;
  }

  /* Grids: 2 columns */
  .footer-top {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Hero padding reduction */
  section {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }

}

/* =============================================================
   MOBILE — max-width: 768px
   ============================================================= */
@media (max-width: 768px) {

  /* Remove excessive section padding */
  section,
  main > section {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Headings scale */
  h1 { font-size: clamp(1.6rem, 6vw, 2.4rem) !important; }
  h2 { font-size: clamp(1.3rem, 5vw, 1.9rem) !important; }
  h3 { font-size: clamp(1.1rem, 4.5vw, 1.5rem) !important; }

  /* Footer: single column */
  .footer-top {
    grid-template-columns: 1fr !important;
    padding: 2rem 1rem !important;
    gap: 1.5rem !important;
  }
  .footer-bottom {
    padding: 1rem !important;
    text-align: center !important;
    font-size: 0.8rem !important;
  }

  /* Logo in footer */
  .footer-logo {
    flex-direction: column;
    align-items: flex-start;
  }
  .footer-logo-img {
    width: 60px !important;
    height: 60px !important;
  }

  /* Generic card grids → 1 column */
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(3"] {
    grid-template-columns: 1fr !important;
  }

  /* Flex rows → column */
  [style*="display: flex"][style*="gap"] {
    flex-wrap: wrap !important;
  }

  /* Remove large min-width from cards */
  [style*="minmax(320px"],
  [style*="minmax(280px"] {
    grid-template-columns: 1fr !important;
  }

  /* Timeline on talento page */
  [style*="position: absolute"][style*="left: 35px"] {
    display: none !important;
  }

  /* Buttons: full width when stacked */
  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Form fields single column */
  form[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Country flags row → wrap */
  [style*="display: flex; flex-wrap: wrap; justify-content: center"] {
    gap: 1rem !important;
  }

  /* Hero sections */
  [style*="padding: 8rem"] {
    padding: 5rem 1rem !important;
  }
  [style*="padding: 7rem"] {
    padding: 4rem 1rem !important;
  }

  /* Timeline steps: vertical */
  [style*="display: flex; align-items: flex-start; gap: 2rem"] {
    flex-direction: row;
    gap: 1rem !important;
  }

  /* Chat widget reposition on mobile */
  .chat-widget {
    bottom: 70px;
    right: 10px;
  }
  .chat-panel {
    width: min(360px, calc(100vw - 20px));
    right: 0;
    left: 0;
    margin: auto;
  }

  /* Social icons bar */
  .social-bar,
  [class*="social"] {
    flex-wrap: wrap;
  }
}

/* =============================================================
   SMALL MOBILE — max-width: 430px
   ============================================================= */
@media (max-width: 430px) {

  body {
    padding-top: var(--nav-height, 68px) !important;
  }

  /* Logo compact */
  
  
  .logo-main {
    font-size: 0.9rem !important;
  }
  .logo-sub {
    display: none !important; /* Too small to show on tiny phones */
  }

  /* Section padding minimal */
  section,
  main > section {
    padding: 2.5rem 0.75rem !important;
  }

  /* h1 scale down */
  h1 {
    font-size: clamp(1.4rem, 7vw, 2rem) !important;
    line-height: 1.2 !important;
  }

  /* Buttons: full width stacked */
  [style*="display: flex; gap: 1rem; justify-content: center"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  [style*="display: flex; gap: 1rem; justify-content: center"] > a,
  [style*="display: flex; gap: 1rem; justify-content: center"] > button {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }

  /* Cards: no min-width overflow */
  [style*="min-width"] {
    min-width: 0 !important;
  }

  /* Country flags: smaller */
  [style*="width: 120px"] {
    width: 80px !important;
  }
  [style*="width: 80px; height: 80px; background: #fff; border-radius: 50%"] {
    width: 56px !important;
    height: 56px !important;
    font-size: 1.8rem !important;
  }

  /* Tarjeta images: natural height */
  [style*="height: 220px"] {
    height: 180px !important;
  }

  /* Footer compact */
  .footer-logo-img {
    width: 50px !important;
    height: 50px !important;
  }

  /* Convenio cards */
  .convenio-card {
    max-width: 100%;
  }
  .convenio-header {
    flex-direction: column !important;
    padding: 1rem !important;
  }
  .convenio-body,
  .convenio-footer {
    padding: 1rem !important;
  }
  .convenio-actions {
    flex-direction: column !important;
  }
  .convenio-btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Steps timeline number circles */
  [style*="width: 70px; height: 70px; background: #003087"] {
    width: 48px !important;
    height: 48px !important;
    font-size: 1.1rem !important;
    flex-shrink: 0 !important;
  }

  /* Buscador form */
  form select,
  form button[onclick] {
    font-size: 0.9rem !important;
    padding: 0.7rem !important;
  }
}

/* =============================================================
   SPECIFIC PAGE OVERRIDES
   ============================================================= */

/* ── INDEX: Hero ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-section {
    padding: 4rem 1rem 3rem !important;
    min-height: auto !important;
  }
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .hero-actions a,
  .hero-actions button {
    width: 100%;
    justify-content: center;
  }
  .hero-badge {
    justify-content: center;
    text-align: center;
  }
  .stats-row,
  .hero-stats {
    flex-wrap: wrap;
    gap: 1rem;
  }
}

/* ── PROGRAMS / BENEFITS GRID ──────────────────────────────── */
@media (max-width: 768px) {
  .programs-grid,
  .benefits-grid,
  .servicios-grid {
    grid-template-columns: 1fr !important;
  }
  .program-card,
  .benefit-card,
  .servicio-card {
    max-width: 100%;
  }
}

/* ── EVENTOS ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .eventos-grid {
    grid-template-columns: 1fr !important;
  }
  .evento-card {
    width: 100%;
  }
}

/* ── BOLSA DE EMPLEO ───────────────────────────────────────── */
@media (max-width: 768px) {
  .jobs-grid,
  .bolsa-grid {
    grid-template-columns: 1fr !important;
  }
  .job-card {
    width: 100%;
  }
  /* Filter bar */
  .filters-bar,
  .search-bar {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }
  .filters-bar input,
  .filters-bar select,
  .filters-bar button {
    width: 100% !important;
  }
}

/* ── SERVICIOS ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .servicios-tabs,
  .tabs-nav {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .tab-btn {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
  }
}

/* ── PARTICIPACION ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .participacion-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── INTERNACIONALIZACION AGRO ─────────────────────────────── */
@media (max-width: 768px) {
  .agro-grid,
  .convenios-grid {
    grid-template-columns: 1fr !important;
  }
  .convenio-card {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ── INTERNACIONALIZACION TALENTO ──────────────────────────── */
@media (max-width: 768px) {
  /* Sector cards */
  #sectores > div > div:last-child {
    grid-template-columns: 1fr !important;
  }
  /* Preparate cards */
  section > div > div[style*="grid-template-columns: repeat(auto-fit, minmax(280px"] {
    grid-template-columns: 1fr !important;
  }
  /* Countries row */
  section[style*="background: #1A2B4A"] div[style*="display: flex; flex-wrap: wrap"] {
    gap: 1rem !important;
  }
}

/* ── TURISMO ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .turismo-grid {
    grid-template-columns: 1fr !important;
  }
  .turismo-hero {
    padding: 4rem 1rem !important;
  }
}

/* ── ANALITICA ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .stats-cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  canvas, .chart-container {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* ── POLITICA ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .politica-content {
    padding: 1.5rem 1rem !important;
  }
}

/* =============================================================
   PREVENT ALL HORIZONTAL OVERFLOW
   ============================================================= */
html, body {
  overflow-x: hidden !important;
}

/* Table overflow containment */
table {
  max-width: 100%;
  overflow-x: auto;
  display: block;
  word-break: break-word;
}

/* Prevent any fixed-width elements from overflowing */
@media (max-width: 768px) {
  [style*="width: 1"] { max-width: 100% !important; }
  [style*="min-width: 3"],
  [style*="min-width: 4"],
  [style*="min-width: 5"],
  [style*="min-width: 6"] { min-width: 0 !important; }
}
/* =============================================================
   NAVEGACIÓN ACTUAL — SIN MENÚ MÓVIL SEPARADO
   ============================================================= */

@media (max-width: 1450px) {
  .nav-container {
    overflow: hidden;
  }

  .nav-menu {
    display: flex !important;
    flex: 1 1 auto;
    min-width: 0;
    gap: 0.05rem;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .nav-menu::-webkit-scrollbar {
    display: none;
  }

  .nav-menu > li {
    flex: 0 0 auto;
  }

  /* Evita que el selector de idioma crezca al ancho completo. */
  .nav-btn-wrapper .lang-selector {
    width: auto !important;
    max-width: 5rem;
    flex: 0 0 auto;
  }
}

@media (max-width: 600px) {
  .nav-btn-wrapper .lang-selector {
    width: auto !important;
    max-width: 3.5rem;
    padding: 0.3rem !important;
  }
}


/* ─── HEADER: spaced navigation that never clips links ───────── */
@media (max-width: 1500px) {
  :root { --nav-height: 68px; }

  .navbar {
    position: sticky;
    height: auto;
    min-height: var(--nav-height);
  }

  body { padding-top: 0 !important; }

  .nav-container {
    height: auto;
    min-height: var(--nav-height);
    padding: 0.55rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.25rem 1rem;
    overflow: visible;
  }

  .nav-menu {
    flex: 1 0 100%;
    min-width: 0;
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.35rem 0.65rem;
    overflow: visible;
    white-space: normal;
    padding: 0.25rem 0 0.4rem;
  }

  .nav-menu > li { flex: 0 0 auto; }
  .nav-menu li a { padding: 0.45rem 0.4rem; }
  .nav-btn-wrapper {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin-left: 0.25rem;
  }
  .nav-btn-wrapper .lang-selector { margin-right: 0 !important; }
}

@media (min-width: 1501px) {
  .nav-container { gap: clamp(0.75rem, 1.1vw, 1.25rem); }
  .nav-menu { gap: clamp(0.35rem, 0.55vw, 0.65rem); }
  .nav-menu li a { padding-inline: clamp(0.35rem, 0.45vw, 0.65rem); }
  .nav-btn-wrapper { gap: 0.75rem; }
}
/* Clear spacing and touch targets for shared navigation and dropdowns. */
.nav-menu > li:not(.nav-btn-wrapper) > a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  line-height: 1.35;
}
.nav-btn-wrapper .lang-selector { min-height: 44px; }
.nav-btn-wrapper > a { min-height: 44px; justify-content: center; }
.nav-item-dropdown.active > .dropdown-menu { display: block; }
.dropdown-menu li a {
  min-height: 44px;
  padding: 0.65rem 1rem;
  line-height: 1.4;
  white-space: normal;
}
/* Ajuste global: una sola fila de navegación y sin bloques vacíos en tablet/escritorio. */
@media (max-width: 1500px) {
  :root { --nav-height: 68px; }

  .navbar {
    position: fixed !important;
    inset: 0 0 auto 0;
    width: 100%;
    height: var(--nav-height) !important;
    min-height: var(--nav-height) !important;
  }

  body {
    padding-top: var(--nav-height) !important;
  }

  .nav-container {
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 0.75rem !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
    gap: 0.5rem !important;
  }

  .nav-menu {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    padding: 0 !important;
    gap: 0.1rem !important;
  }

  .nav-menu > li { flex: 0 0 auto !important; }

  .nav-btn-wrapper {
    flex-wrap: nowrap !important;
    margin-left: 0 !important;
    gap: 0.4rem !important;
  }

  .nav-btn-wrapper .lang-selector {
    width: auto !important;
    min-width: 3.5rem;
    max-width: 4rem;
  }

  .page-hero { padding-top: 2rem !important; }
}

/* El tablero de analítica usa el alto de su contenido, no una pantalla vacía adicional. */
.analytics-dashboard {
  min-height: 0 !important;
  padding: 2rem 1.25rem !important;
}

@media (max-width: 768px) {
  .analytics-dashboard { padding: 1.25rem 0.75rem !important; }
  .stats-grid { gap: 0.75rem; }
  .stat-card { padding: 1.25rem 0.75rem; }
  .stat-value { font-size: clamp(1.75rem, 9vw, 2.5rem); }
}
/* Encabezado institucional: enlaces y acciones separados para evitar recortes y duplicados visuales. */
.nav-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  white-space: nowrap;
}
.nav-actions .lang-selector {
  width: auto !important;
  min-width: 3.5rem;
  max-width: 4rem;
  min-height: 42px;
  padding: 0.45rem !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: #1a2b4a !important;
}
.nav-actions .nav-contact,
.nav-actions .nav-btn-donar {
  display: inline-flex !important;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.5rem 0.75rem !important;
  white-space: nowrap !important;
  font-size: 0.78rem !important;
}

@media (max-width: 1500px) {
  .navbar {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: 0 !important;
    height: 68px !important;
    min-height: 68px !important;
  }
  body { padding-top: 68px !important; }
  .nav-container {
    display: flex !important;
    flex-flow: row nowrap !important;
    justify-content: flex-start !important;
    gap: 0.4rem !important;
    width: 100% !important;
    max-width: none !important;
    height: 68px !important;
    min-height: 68px !important;
    padding: 0 0.6rem !important;
    overflow: visible !important;
  }
  .nav-logo { flex: 0 0 auto !important; gap: 0.35rem !important; }
  .logo-emblem { width: 40px !important; height: 40px !important; }
  .logo-main { font-size: 0.98rem !important; }
  .logo-sub { display: none !important; }
  .nav-menu {
    display: flex !important;
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    flex-flow: row nowrap !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    white-space: nowrap !important;
  }
  .nav-menu > li { flex: 0 0 auto !important; }
  .nav-menu > li > a {
    display: inline-flex !important;
    align-items: center !important;
    min-height: 44px;
    padding: 0.35rem clamp(0.14rem, 0.24vw, 0.3rem) !important;
    font-size: clamp(0.74rem, 0.82vw, 0.90rem) !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
  }
  .nav-actions { gap: 0.3rem !important; }
}

/* En pantallas medianas el menú pasa a una segunda fila para mantener todos los accesos visibles. */
@media (max-width: 1450px) {
  .navbar {
    position: sticky !important;
    height: auto !important;
    min-height: 0 !important;
  }
  body { padding-top: 0 !important; }
  .nav-container {
    height: auto !important;
    min-height: 68px !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    gap: 0.15rem 0.5rem !important;
    padding: 0.35rem 0.65rem !important;
  }
  .nav-logo { order: 0; }
  .nav-actions { order: 1; }
  .nav-menu {
    order: 2;
    flex: 0 0 100% !important;
    width: 100% !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 0.05rem 0.2rem !important;
    overflow: visible !important;
    white-space: normal !important;
    padding: 0.1rem 0 0.25rem !important;
  }
  .nav-menu > li { flex: 0 0 auto !important; }
  .nav-menu > li > a { font-size: 0.78rem !important; padding-inline: 0.35rem !important; }
  .dropdown-menu { z-index: 1200; }
}

@media (max-width: 700px) {
  .nav-container { padding-inline: 0.5rem !important; }
  .nav-actions { gap: 0.2rem !important; }
  .nav-actions .lang-selector { min-width: 2.9rem; min-height: 38px; padding: 0.25rem !important; }
  .nav-actions .nav-contact,
  .nav-actions .nav-btn-donar { min-height: 38px; padding: 0.35rem 0.45rem !important; font-size: 0.68rem !important; }
  .nav-menu > li > a { min-height: 38px !important; font-size: 0.72rem !important; }
}

@media (max-width: 410px) {
  .logo-text { display: none !important; }
  .nav-actions .nav-btn-donar span { display: none; }
  .nav-actions .nav-btn-donar { width: 38px; padding-inline: 0.4rem !important; }
}

/* Enlace directo y siempre visible al portal de pagos. */
.nav-menu > li > a[data-page="pagos.php"] { color: #fff !important; background: #003087 !important; border-radius: 8px !important; font-weight: 700 !important; padding-inline: 0.55rem !important; }
.nav-menu > li > a[data-page="pagos.php"]:hover { background: #1A4FA8 !important; }



