/* frontend/src/styles/globals.css */

:root {
  --primary: #1e3a8a;
  --primary-dark: #1e40af;
  --gold: #d97706;
  --gold-hover: #b45309;
  --bg-color: #f8fafc;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Control estricto de imágenes e insignias para evitar tamaños gigantes */
img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Header de la aplicación (campus) */
.app-header {
  background: var(--primary);
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 40;
}

.app-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 68px;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex-shrink: 0;
}

.app-header__mark {
  width: 30px;
  height: 34px;
  flex-shrink: 0;
}

.app-header__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.app-header__brand-name {
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: #fff;
}

.app-header__brand-tag {
  font-size: 0.68rem;
  color: #b9c2dd;
}

.app-header__nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex: 1 1;
}

.app-header__link {
  color: #b9c2dd;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}

.app-header__link:hover {
  color: #fff;
}

.app-header__link.is-active {
  color: #fff;
  border-bottom-color: var(--gold);
}

.app-header__user {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.app-header__username {
  font-size: 0.8rem;
  color: #dfe4f2;
  white-space: nowrap;
}

.app-header__divider {
  width: 1px;
  height: 20px;
  background: #324277;
}

.app-header__logout {
  background: none;
  border: none;
  color: #dfe4f2;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.app-header__logout:hover {
  color: #fff;
}

@media (max-width: 640px) {
  .app-header__brand-tag {
    display: none;
  }
  .app-header__nav {
    gap: 1rem;
  }
  .app-header__username {
    display: none;
  }
}

/* Footer de la aplicación (campus) */
.app-footer {
  background: var(--primary-dark);
}

.app-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1.375rem 1.5rem;
}

.app-footer__copy {
  font-size: 0.8rem;
  color: #8f9ac2;
}

.app-footer__links {
  display: flex;
  gap: 1.375rem;
}

.app-footer__links a {
  color: #c3cae6;
  font-size: 0.8rem;
}

.app-footer__links a:hover {
  color: #fff;
}

/* Dashboard del campus: cursos matriculados */
.campus-hero {
  background: var(--bg-color);
  padding: 2rem 0 0.25rem;
  margin-bottom: 0;
}

.campus-hero__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.campus-hero__title {
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.campus-hero__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.campus-hero__lead {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.campus-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-gap: 1.375rem;
  gap: 1.375rem;
  padding: 1.75rem 0 3rem;
}

@media (max-width: 900px) {
  .campus-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.course-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 0.625rem;
  padding: 1.375rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  box-shadow: 0 1px 2px rgba(19, 42, 94, 0.04);
}

.course-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.course-card__initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 0.5rem;
  background: #eaf0ff;
  color: var(--primary);
  font-weight: 700;
  font-size: 1rem;
}

.course-card__badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gold-hover);
  background: #fbeedc;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
}

.course-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.course-card__docente {
  margin-top: 0.1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.course-card__progress {
  height: 6px;
  border-radius: 4px;
  background: #e9ecf3;
  overflow: hidden;
}

.course-card__progress-bar {
  height: 100%;
  background: var(--gold);
}

.course-card__next {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.course-card__btn {
  margin-top: 0.25rem;
  text-align: center;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.625rem;
  border-radius: 0.4375rem;
}

.course-card__btn:hover {
  background: var(--primary-dark);
}

/* Página Programas: buscador y catálogo */
.finder {
  padding: 2.5rem 0;
}

.finder__bar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.finder__search {
  position: relative;
  max-width: 480px;
}

.finder__search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.finder__input {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-main);
}

.finder__input:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}

.finder__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-main);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--primary);
}

.chip--active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.finder__count {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.finder__count strong {
  color: var(--text-main);
}

.finder__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-gap: 1.25rem;
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .finder__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.finder__empty {
  grid-column: 1 / -1;
  color: var(--text-muted);
  padding: 2rem 0;
}

.finder__card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 0.625rem;
  padding: 1.375rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 1px 2px rgba(19, 42, 94, 0.04);
}

.finder__card-area {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold-hover);
}

.finder__card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.finder__card-resumen {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1 1;
}

.finder__card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.finder__card-meta span {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-color);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

/* Sección de precios / formas de acceso */
.price-section {
  padding: 2.5rem 0 3.5rem;
}

.section__head {
  max-width: 640px;
  margin-bottom: 2rem;
}

.section__kicker {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-hover);
  margin-bottom: 0.4rem;
}

.section__title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.4rem;
}

.section__lead {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.price-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-gap: 1.375rem;
  gap: 1.375rem;
}

@media (max-width: 900px) {
  .price-cards {
    grid-template-columns: 1fr;
  }
}

.price-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.price-card__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.price-card__descripcion {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.price-card__precio {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.price-card__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1 1;
}

.price-card__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-main);
}

.price-card__check {
  color: var(--gold);
  font-weight: 700;
}

.price-card__button {
  width: 100%;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  border-radius: 0.375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s;
  text-decoration: none;
}

.btn--gold {
  background-color: var(--gold);
  color: white;
}

.btn--gold:hover {
  background-color: var(--gold-hover);
}

.btn--ghost {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn--ghost:hover {
  background-color: var(--border-color);
}

/* Page Hero */
.pagehero {
  background: linear-gradient(135deg, var(--primary) 0%, #1e293b 100%);
  color: white;
  padding: 3rem 0;
  margin-bottom: 2rem;
}

.pagehero__title {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.pagehero__lead {
  font-size: 1.125rem;
  opacity: 0.9;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  opacity: 0.8;
}

.breadcrumbs__link {
  color: white;
  text-decoration: none;
}

.breadcrumbs__link:hover {
  text-decoration: underline;
}

.breadcrumbs__current {
  font-weight: 600;
}

/* Canvas Layout & Grid */
.canvas-layout {
  padding: 2rem 0;
}

.canvas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.canvas-header__title {
  font-size: 1.5rem;
  font-weight: 700;
}

.canvas-body {
  display: grid;
  grid-template-columns: 1fr;
  grid-gap: 2rem;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .canvas-body {
    grid-template-columns: 1fr 380px;
  }
}

.canvas-main {
  background: white;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Reproductores y Visores */
.canvas-video__player {
  width: 100%;
  border-radius: 0.375rem;
  background: #000;
}

.canvas-pdf__frame {
  width: 100%;
  height: 600px;
  border: none;
  border-radius: 0.375rem;
}

/* Quizzes */
.canvas-quiz__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.quiz-question {
  margin-bottom: 1.5rem;
}

.quiz-question__enunciado {
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

/* Detalle de Cursos y Nodos */
.course-detail__weeks {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.week-item {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.week-item__header {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.node-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.node-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.node-item:hover {
  border-color: var(--primary);
  background: #f1f5f9;
}

.node-item__icon {
  font-size: 1.25rem;
}

.node-item__content {
  flex: 1 1;
  display: flex;
  flex-direction: column;
}

.node-item__title {
  font-weight: 600;
}

.node-item__description, .node-item__duration {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.node-item__arrow {
  font-weight: bold;
  color: var(--text-muted);
}

/* Panel del Chat IA */
.canvas-chat {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  height: 500px;
  overflow: hidden;
}

.canvas-chat__header {
  background: var(--primary);
  color: white;
  padding: 1rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.canvas-chat__messages {
  flex: 1 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #f8fafc;
}

.canvas-chat__message {
  padding: 0.75rem;
  border-radius: 0.375rem;
  max-width: 85%;
  font-size: 0.875rem;
}

.canvas-chat__message--user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
}

.canvas-chat__message--assistant {
  background: white;
  border: 1px solid var(--border-color);
  align-self: flex-start;
}

.canvas-chat__input {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
  background: white;
}

.canvas-chat__input input {
  flex: 1 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  outline: none;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.125rem;
}
