/* =========================================================
   Academia Guiu — Buscador de Títulos Universitarios
   ========================================================= */

@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');

/* --- Variables ------------------------------------------- */
:root {
  --navy:        #1a2e5a;
  --navy-dark:   #111e3d;
  --navy-mid:    #243570;
  --red:         #b02a2a;
  --red-light:   #e8d5d5;
  --white:       #ffffff;
  --grey-bg:     #f2f4f7;
  --grey-light:  #e8eaed;
  --grey-mid:    #c4c8d0;
  --grey-text:   #6b7280;
  --text:        #1c2333;
  --text-soft:   #3d4558;

  --shadow-sm:   0 1px 3px rgba(26,46,90,.08), 0 1px 2px rgba(26,46,90,.06);
  --shadow-md:   0 4px 12px rgba(26,46,90,.10), 0 2px 6px rgba(26,46,90,.08);
  --shadow-lg:   0 8px 24px rgba(26,46,90,.12), 0 4px 10px rgba(26,46,90,.08);

  --radius:      6px;
  --radius-lg:   10px;
  --transition:  all .2s cubic-bezier(.4,0,.2,1);
}

/* --- Reset & Base ---------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--grey-bg);
  -webkit-font-smoothing: antialiased;
}

/* --- Header --------------------------------------------- */
.site-header {
  background: var(--white);
  border-bottom: 3px solid var(--red);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Logos group */
.logos-group {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

/* Vertical separator between logos */
.logo-separator {
  width: 1px;
  height: 56px;
  background: var(--grey-light);
  flex-shrink: 0;
}

/* Academia Guiu logo */
.logo-academia {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-img {
  height: 90px;
  width: auto;
  display: block;
}

/* Partner logo */
.logo-partner {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-img-partner {
  height: 90px;
  width: auto;
  display: block;
}

/* Header title (center) */
.header-title {
  flex: 1;
  text-align: center;
}

.header-title h1 {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.75);
  letter-spacing: .05em;
  text-transform: uppercase;
  display: none; /* hidden on large screens — shown in hero below */
}

/* ANECA badge */
.aneca-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.aneca-label {
  font-size: 10px;
  color: var(--grey-text);
  letter-spacing: .07em;
  text-transform: uppercase;
  font-weight: 500;
}

.aneca-logo {
  background: var(--grey-bg);
  border: 1px solid var(--grey-light);
  border-radius: 4px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.aneca-logo span {
  font-family: 'Libre Baskerville', serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: .04em;
}

.aneca-logo .aneca-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
}

/* --- Hero Banner ----------------------------------------- */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, #1e3a7a 100%);
  padding: 48px 24px 52px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 80% at 80% 50%, rgba(255,255,255,.03) 0%, transparent 60%),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 59px,
      rgba(255,255,255,.025) 59px,
      rgba(255,255,255,.025) 60px
    );
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 32px;
  background: var(--grey-bg);
  clip-path: ellipse(55% 100% at 50% 100%);
}

.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-inner h1 {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: clamp(20px, 3.5vw, 30px);
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
  max-width: 720px;
  margin-bottom: 14px;
}

.hero-inner p {
  font-size: 15px;
  color: rgba(255,255,255,.72);
  max-width: 620px;
  font-weight: 300;
  line-height: 1.7;
}

.hero-divider {
  width: 40px;
  height: 3px;
  background: var(--red);
  margin: 16px 0;
  border-radius: 2px;
}

/* --- Main container ------------------------------------- */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 60px;
}

/* --- Search & Filters ----------------------------------- */
.search-panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  margin-bottom: 28px;
  border: 1px solid var(--grey-light);
}

.search-row {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  align-items: center;
}

.search-wrapper {
  position: relative;
  flex: 1;
}

.search-wrapper svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--grey-text);
  pointer-events: none;
  width: 17px;
  height: 17px;
}

#search-input {
  width: 100%;
  padding: 11px 14px 11px 42px;
  border: 1.5px solid var(--grey-light);
  border-radius: var(--radius);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: var(--transition);
  outline: none;
}

#search-input::placeholder { color: var(--grey-text); }

#search-input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,46,90,.08);
}

.btn-clear {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 18px;
  background: transparent;
  border: 1.5px solid var(--grey-light);
  border-radius: var(--radius);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--grey-text);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-clear svg { width: 14px; height: 14px; }

.btn-clear:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-light);
}

/* Filter grid */
.filters-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--grey-text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filters-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--grey-light);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: .03em;
}

.filter-group select {
  padding: 9px 32px 9px 12px;
  border: 1.5px solid var(--grey-light);
  border-radius: var(--radius);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13.5px;
  color: var(--text);
  background: var(--white);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.filter-group select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,46,90,.08);
}

.filter-group select:hover {
  border-color: var(--grey-mid);
}

/* --- Results bar ---------------------------------------- */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 2px;
}

.results-count {
  font-size: 13.5px;
  color: var(--grey-text);
  font-weight: 500;
}

.results-count strong {
  color: var(--navy);
  font-weight: 700;
}

.sort-hint {
  font-size: 12px;
  color: var(--grey-mid);
  font-style: italic;
}

/* --- Cards grid ----------------------------------------- */
#results-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* Degree card */
.degree-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--grey-light);
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.degree-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.degree-card.ciclo-grado::before      { background: var(--navy); }
.degree-card.ciclo-master::before     { background: #237a57; }
.degree-card.ciclo-doctorado::before  { background: var(--red); }

.degree-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--grey-mid);
  transform: translateY(-2px);
}

/* Card header */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-dark);
  line-height: 1.35;
  flex: 1;
}

/* Ciclo badge */
.badge-ciclo {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-ciclo.ciclo-grado {
  background: #e8edf7;
  color: var(--navy);
}

.badge-ciclo.ciclo-master {
  background: #e5f2ec;
  color: #1a6641;
}

.badge-ciclo.ciclo-doctorado {
  background: var(--red-light);
  color: var(--red);
}

/* Card meta */
.card-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meta-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-soft);
}

.meta-row svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--grey-text);
}

.meta-row span { line-height: 1.4; }

/* Card footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--grey-light);
  margin-top: 2px;
}

.card-rama {
  font-size: 12px;
  color: var(--grey-text);
  font-style: italic;
}

.badge-estado {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #1a6641;
  letter-spacing: .03em;
}

.badge-estado::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2ecc71;
  flex-shrink: 0;
}

/* --- Empty state ---------------------------------------- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
  color: var(--grey-text);
}

.empty-state svg {
  width: 52px;
  height: 52px;
  color: var(--grey-mid);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: 'Libre Baskerville', serif;
  font-size: 17px;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.empty-state p { font-size: 14px; }

/* Loading skeleton */
.skeleton-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--grey-light);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.skeleton-line {
  background: linear-gradient(90deg, var(--grey-light) 25%, #e8eaed 50%, var(--grey-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
  height: 14px;
  margin-bottom: 10px;
}

.skeleton-line:first-child { height: 18px; width: 80%; }
.skeleton-line:nth-child(2) { width: 60%; }
.skeleton-line:nth-child(3) { width: 70%; }
.skeleton-line:last-child   { width: 40%; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Footer --------------------------------------------- */
.site-footer {
  background: var(--navy-dark);
  border-top: 2px solid rgba(255,255,255,.07);
  padding: 28px 24px;
  margin-top: 20px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-text {
  font-size: 12px;
  color: rgba(255,255,255,.45);
  line-height: 1.7;
  max-width: 720px;
}

.footer-brand {
  font-size: 11px;
  color: rgba(255,255,255,.3);
  text-align: right;
  white-space: nowrap;
}

.footer-brand strong {
  display: block;
  font-family: 'Libre Baskerville', serif;
  font-size: 13px;
  color: rgba(255,255,255,.6);
  margin-bottom: 3px;
}

/* --- Responsive ----------------------------------------- */
@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }

  .logos-group {
    gap: 14px;
  }

  .logo-img,
  .logo-img-partner {
    height: 60px;
  }

  .logo-separator {
    height: 40px;
  }

  .aneca-badge { display: none; }

.hero { padding: 32px 16px 44px; }

  .main-container { padding: 24px 16px 48px; }

  .search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-clear { justify-content: center; }

  .filters-grid {
    grid-template-columns: 1fr 1fr;
  }

  #results-container {
    grid-template-columns: 1fr;
  }

  .footer-inner { flex-direction: column; gap: 16px; }
  .footer-brand { text-align: left; }
}

@media (max-width: 480px) {
  .filters-grid { grid-template-columns: 1fr; }

  .logo-img,
  .logo-img-partner {
    height: 48px;
  }

  .logo-separator {
    height: 32px;
  }

  .hero-inner h1 { font-size: 18px; }
}

/* --- Utility -------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Fade-in animation for cards */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.degree-card {
  animation: fadeInUp .25s ease both;
}
