@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

:root {
  --color-dorado: #d4af37;
  --color-dorado-oscuro: #aa8425;
  --color-naranja: #f97316;
  --color-naranja-oscuro: #ea580c;
  --color-verde-oscuro: #14532d;
  --color-verde: #166534;
  --color-fondo: #f6f7f4;
  --color-texto: #172033;
  --color-muted: #64748b;
  --color-borde: #e5e7eb;
  --color-card: #ffffff;
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 14px 35px rgba(15, 23, 42, 0.13);
  --shadow-lg: 0 28px 70px rgba(15, 23, 42, 0.22);
  --radius-sm: 0.625rem;
  --radius-md: 1rem;
  --radius-lg: 1.35rem;
  --transition: 180ms ease;
}

/* ========== Animaciones ========== */
@keyframes scroll-left {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

/* ========== Base ========== */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(212, 175, 55, 0.12), transparent 34rem),
    linear-gradient(180deg, #ffffff 0%, var(--color-fondo) 100%);
  color: var(--color-texto);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a, button, input, textarea {
  transition: background-color var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition), opacity var(--transition);
}

button, a, input, textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none !important;
}

input, textarea {
  width: 100%;
  min-width: 0;
  font-size: 1rem;
}

input:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(249, 115, 22, 0.35);
  outline-offset: 3px;
}

::selection {
  background: rgba(212, 175, 55, 0.35);
}

/* ========== Utilidades del proyecto ========== */
.text-dorado { color: var(--color-dorado); }
.bg-dorado { background-color: var(--color-dorado); }
.text-verde-oscuro { color: var(--color-verde-oscuro); }
.bg-verde-oscuro { background-color: var(--color-verde-oscuro); }
.bg-naranja { background-color: var(--color-naranja); }
.border-blanco { border: 1px solid #fff; }
.hidden { display: none !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fade-in { animation: fadeInUp 0.55s ease both; }
.animate-fade-in-down { animation: modalIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

/* ========== Header ========== */
header {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid rgba(20, 83, 45, 0.12) !important;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08) !important;
}

header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-verde-oscuro), var(--color-dorado), var(--color-naranja));
}

header img {
  filter: drop-shadow(0 8px 12px rgba(15, 23, 42, 0.12));
}

header h1 {
  letter-spacing: -0.035em;
}

/* ========== Menú flotante ========== */
#menuButton {
  background: linear-gradient(135deg, var(--color-verde-oscuro), var(--color-verde)) !important;
  box-shadow: 0 14px 30px rgba(20, 83, 45, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#menuButton:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 18px 38px rgba(20, 83, 45, 0.34);
}

#menuDropdown {
  border-radius: var(--radius-md) !important;
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
  box-shadow: var(--shadow-md) !important;
  backdrop-filter: blur(16px);
}

#menuDropdown a {
  font-weight: 650;
}

#menuDropdown a:hover {
  color: var(--color-verde-oscuro);
}

/* ========== Carrusel institucional mejorado ========== */

.carousel-container {
  position: relative;
}

.carousel-container::before,
.carousel-container::after {
  content: "";
  position: absolute;
  top: 0;
  width: 100px;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.carousel-container::before {
  left: 0;
  background: linear-gradient(
    to right,
    rgba(255,255,255,1),
    rgba(255,255,255,0)
  );
}

.carousel-container::after {
  right: 0;
  background: linear-gradient(
    to left,
    rgba(255,255,255,1),
    rgba(255,255,255,0)
  );
}

html.dark .carousel-container::before {
  background: linear-gradient(
    to right,
    #111827,
    transparent
  );
}

html.dark .carousel-container::after {
  background: linear-gradient(
    to left,
    #111827,
    transparent
  );
}

.scroll-track {
  animation: scroll-left 34s linear infinite;
  will-change: transform;
}

.scroll-track:hover {
  animation-play-state: paused;
}

.scroll-track img {
  border-radius: 1rem !important;
  border: 1px solid rgba(255,255,255,.75);
  box-shadow: var(--shadow-sm) !important;
  transition:
    transform .35s ease,
    box-shadow .35s ease,
    filter .35s ease;
}

.scroll-track img:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow: var(--shadow-md) !important;
  filter: saturate(1.08) contrast(1.03);
}

/* ========== Sección de cursos ========== */
section.bg-gray-100 {
  background:
    linear-gradient(180deg, rgba(20, 83, 45, 0.04), rgba(212, 175, 55, 0.05)),
    #f8fafc !important;
}

.btn-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: #334155;
  padding: 0.72rem 1.15rem;
  font-weight: 800;
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.06);
}

.btn-tab:hover:not(.active-tab) {
  transform: translateY(-2px);
  background: #ffffff;
  color: var(--color-verde-oscuro);
  border-color: rgba(20, 83, 45, 0.25);
}

.active-tab {
  color: #ffffff !important;
  background: linear-gradient(135deg, var(--color-verde-oscuro), var(--color-verde)) !important;
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(20, 83, 45, 0.22);
}

#buscadorCursos {
  border: 1px solid rgba(148, 163, 184, 0.36) !important;
  border-radius: 999px !important;
  padding: 0.78rem 1rem !important;
  background: rgba(255, 255, 255, 0.92) !important;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

#buscadorCursos:focus {
  border-color: rgba(249, 115, 22, 0.65) !important;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.11), 0 12px 26px rgba(15, 23, 42, 0.08);
}

/* Switch modo oscuro */
#switchTema + div {
  box-shadow: inset 0 1px 4px rgba(15, 23, 42, 0.18);
}

.dot { transform: translateX(0); }
.dark .dot, html.dark .dot { transform: translateX(20px); }

/* Tarjetas de cursos */
.curso-item {
  position: relative;
  border: 1px solid rgba(226, 232, 240, 0.88);
  border-radius: 1.15rem !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08) !important;
  overflow: hidden;
  isolation: isolate;
}

.curso-item::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(20, 83, 45, 0.08));
  opacity: 0;
  transition: opacity var(--transition);
}

.curso-item:hover {
  transform: translateY(-6px);
  border-color: rgba(212, 175, 55, 0.55);
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.15) !important;
}

.curso-item:hover::before { opacity: 1; }

.curso-item img {
  height: 14rem;
  width: 100%;
  object-fit: cover;
  background: #e5e7eb;
  transition: transform 350ms ease, filter 350ms ease;
}

.curso-item:hover img {
  transform: scale(1.045);
  filter: saturate(1.04) contrast(1.03);
}

.curso-item .p-4 {
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), #ffffff);
}

.curso-item h3 {
  color: #1e293b;
  letter-spacing: -0.015em;
}

.tab-content h2 {
  color: var(--color-verde-oscuro) !important;
  font-weight: 850;
  letter-spacing: -0.025em;
}

.tab-content h2::after {
  content: '';
  display: block;
  width: 4rem;
  height: 3px;
  margin-top: 0.45rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--color-dorado), var(--color-naranja));
}

/* ========== Modales ========== */
#modalCurso, #modalSolicitud, #modalContacto {
  padding: 1.25rem;
  background: rgba(2, 6, 23, 0.68) !important;
  backdrop-filter: blur(12px) saturate(150%);
}

#modalCurso > div,
#modalSolicitud > div,
#modalContacto > div {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius-lg) !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: var(--shadow-lg) !important;
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
}

#modalCurso > div {
  overflow: visible;
}

#modalCurso h3,
#modalSolicitud h2,
#modalContacto h2 {
  background: linear-gradient(135deg, var(--color-verde-oscuro), var(--color-verde));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

#modalCurso h3 {
  color: var(--color-dorado);
  font-weight: 850;
}

#modalCurso h2#modalNombre {
  color: var(--color-verde-oscuro) !important;
  font-weight: 850;
  letter-spacing: -0.03em;
}

#modalCurso .space-y-2 p {
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

#modalCurso .space-y-2 p:last-child { border-bottom: 0; }

#modalFlyer {
  border-radius: 1rem !important;
  border: 1px solid rgba(226, 232, 240, 0.92);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16) !important;
  background: #f1f5f9;
}

#modalFlyer:hover { transform: scale(1.01); }

.close-btn,
#modalSolicitud button[onclick*="cerrar"],
#modalContacto button[onclick*="cerrar"] {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: #475569;
  font-weight: 500;
  line-height: 1;
}

#modalCurso .close-btn {
  position: absolute;
  top: -1rem;
  right: -1rem;
  width: 2.75rem;
  height: 2.75rem;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.28);
  font-size: 2rem;
  z-index: 20;
}

.close-btn:hover,
#modalSolicitud button[onclick*="cerrar"]:hover,
#modalContacto button[onclick*="cerrar"]:hover {
  background: #fee2e2;
  color: #dc2626;
  transform: scale(1.06);
}

/* Formularios */
#modalSolicitud input,
#modalContacto input,
#modalContacto textarea {
  border: 1px solid rgba(148, 163, 184, 0.38) !important;
  border-radius: 0.9rem !important;
  padding: 0.85rem 1rem !important;
  background: rgba(255, 255, 255, 0.95) !important;
  color: #0f172a !important;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

#modalSolicitud input:focus,
#modalContacto input:focus,
#modalContacto textarea:focus {
  border-color: var(--color-naranja) !important;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12), inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

#modalSolicitud label,
#modalContacto label {
  color: #334155;
  font-weight: 750;
}

#modalBotonConstancia button,
#modalSolicitud button[type="submit"],
#modalContacto button[type="submit"] {
  border: 0;
  border-radius: 999px !important;
  font-weight: 850;
  letter-spacing: 0.015em;
  box-shadow: 0 12px 26px rgba(20, 83, 45, 0.22);
}

#modalBotonConstancia button {
  background: linear-gradient(135deg, var(--color-verde-oscuro), var(--color-verde)) !important;
}

#modalSolicitud button[type="submit"],
#modalContacto button[type="submit"] {
  background: linear-gradient(135deg, var(--color-naranja), var(--color-naranja-oscuro)) !important;
  box-shadow: 0 12px 26px rgba(249, 115, 22, 0.25);
}

#modalBotonConstancia button:hover,
#modalSolicitud button[type="submit"]:hover,
#modalContacto button[type="submit"]:hover {
  transform: translateY(-2px);
}

/* ========== Estados JS ========== */
.field-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.14) !important;
  animation: shake 0.36s ease;
}

.form-loading {
  opacity: 0.72;
  pointer-events: none;
}

#toastExito, #toastError {
  z-index: 9999;
  max-width: 360px;
  border-radius: 1rem !important;
  box-shadow: var(--shadow-md);
  transform: translateX(0);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

#toastExito.opacity-0, #toastError.opacity-0 {
  opacity: 0 !important;
  transform: translateX(110%);
}

/* ========== Scrollbar ========== */
#modalCurso > div::-webkit-scrollbar,
#modalSolicitud > div::-webkit-scrollbar,
#modalContacto > div::-webkit-scrollbar {
  width: 8px;
}

#modalCurso > div::-webkit-scrollbar-thumb,
#modalSolicitud > div::-webkit-scrollbar-thumb,
#modalContacto > div::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(180deg, var(--color-dorado), var(--color-naranja));
}

/* ========== Modo oscuro ========== */
html.dark body {
  background:
    radial-gradient(circle at top left, rgba(212, 175, 55, 0.11), transparent 30rem),
    linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #f8fafc;
}

html.dark header {
  background: linear-gradient(135deg, #111827, #0f172a, #1e293b) !important;
  border-bottom-color: rgba(212, 175, 55, 0.22) !important;
}

html.dark .bg-white,
html.dark section.bg-white {
  background-color: #111827 !important;
}

html.dark section.bg-gray-100,
html.dark section.bg-gray-800 {
  background: linear-gradient(180deg, #0f172a, #111827) !important;
}

html.dark .text-gray-900,
html.dark .text-gray-800,
html.dark .text-gray-700 {
  color: #f8fafc !important;
}

html.dark .text-gray-600,
html.dark .text-gray-500,
html.dark .text-gray-300 {
  color: #cbd5e1 !important;
}

html.dark #menuDropdown {
  background: rgba(15, 23, 42, 0.96) !important;
  border-color: rgba(71, 85, 105, 0.8) !important;
}

html.dark #menuDropdown a:hover {
  background: rgba(51, 65, 85, 0.85) !important;
  color: #ffffff;
}

html.dark .btn-tab {
  background: rgba(30, 41, 59, 0.92);
  border-color: rgba(71, 85, 105, 0.8);
  color: #e2e8f0;
}

html.dark .active-tab {
  background: linear-gradient(135deg, var(--color-dorado-oscuro), var(--color-dorado)) !important;
  color: #111827 !important;
}

html.dark #buscadorCursos,
html.dark input,
html.dark textarea {
  background: rgba(30, 41, 59, 0.94) !important;
  border-color: rgba(71, 85, 105, 0.9) !important;
  color: #f8fafc !important;
}

html.dark .curso-item {
  background: rgba(30, 41, 59, 0.96) !important;
  border-color: rgba(71, 85, 105, 0.72);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.28) !important;
}

html.dark .curso-item .p-4 {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.94), rgba(15, 23, 42, 0.95));
}

html.dark .curso-item h3,
html.dark .tab-content h2,
html.dark #modalCurso h2#modalNombre {
  color: #f8fafc !important;
}

html.dark #modalCurso > div,
html.dark #modalSolicitud > div,
html.dark #modalContacto > div {
  background: rgba(15, 23, 42, 0.96) !important;
  border-color: rgba(71, 85, 105, 0.72);
}

html.dark #modalCurso .close-btn {
  background: #1e293b;
  color: #f8fafc;
}

html.dark #modalSolicitud label,
html.dark #modalContacto label {
  color: #e2e8f0;
}

html.dark #modalCurso .space-y-2 p {
  border-bottom-color: rgba(71, 85, 105, 0.7);
}

html.dark footer {
  background: #020617 !important;
  border-top-color: rgba(71, 85, 105, 0.7) !important;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  #modalCurso > div {
    overflow-y: auto;
  }
}

@media (max-width: 768px) {
  body { line-height: 1.55; }

  header h1 {
    font-size: 1.55rem !important;
  }

  .btn-tab {
    padding: 0.65rem 0.95rem;
    font-size: 0.9rem;
  }

  .curso-item img {
    height: 13rem;
  }

  #modalCurso, #modalSolicitud, #modalContacto {
    padding: 0.75rem;
  }

  #modalCurso > div,
  #modalSolicitud > div,
  #modalContacto > div {
    max-height: calc(100vh - 1.5rem);
    border-radius: 1rem !important;
  }

  #modalCurso .close-btn {
    top: 0.5rem;
    right: 0.5rem;
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1.5rem;
  }

  #modalFlyer {
    max-height: 42vh !important;
  }
}

@media (max-width: 640px) {
  .scroll-track img {
    height: 11rem !important;
  }

  .curso-item img {
    height: 12.5rem;
  }

  #toastExito, #toastError {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}

@media (max-width: 420px) {
  header h1 {
    font-size: 1.25rem !important;
  }

  .btn-tab {
    width: 100%;
  }

  #buscadorCursos {
    border-radius: 0.9rem !important;
  }

  .curso-item img {
    height: 11rem;
  }

  #modalFlyer {
    max-height: 34vh !important;
  }
}

@media (prefers-reduced-motion: reduce) {

  .scroll-track {
    animation-duration: 45s !important;
    animation-iteration-count: infinite !important;
  }

}
