/* =========================================================
   PORTAL ACADÉMICO · ENGINEERING THEME
   Formal · Universitario · Ingeniería · Tecnología
   ========================================================= */

:root {
  --eng-navy: #122245;
  --eng-navy-deep: #0b1732;
  --eng-navy-soft: #203762;

  --eng-gold: #b59957;
  --eng-gold-dark: #92783f;
  --eng-gold-soft: #f4eedf;

  --eng-bg: #f4f6f9;
  --eng-surface: #ffffff;
  --eng-surface-soft: #f8fafc;

  --eng-text: #15233c;
  --eng-muted: #687990;

  --eng-line: #dde4ec;
  --eng-line-strong: #cdd7e2;

  --eng-success: #176a49;
  --eng-danger: #a4313d;

  --eng-radius-sm: 9px;
  --eng-radius: 14px;
  --eng-radius-lg: 20px;

  --eng-shadow:
    0 12px 34px rgba(18,34,69,.08);

  --eng-shadow-soft:
    0 6px 18px rgba(18,34,69,.055);
}


/* =========================================================
   BASE
   ========================================================= */

html {
  background: var(--eng-bg);
}

body {
  color: var(--eng-text);
  background:
    linear-gradient(
      180deg,
      #f9fafc 0,
      var(--eng-bg) 280px
    );
}

img,
video,
iframe {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

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


/* =========================================================
   DETALLE TÉCNICO SUTIL
   ========================================================= */

body::before {
  content: "";

  position: fixed;
  inset: 0;

  pointer-events: none;

  z-index: -1;

  opacity: .24;

  background-image:
    linear-gradient(
      rgba(18,34,69,.028) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(18,34,69,.028) 1px,
      transparent 1px
    );

  background-size:
    32px 32px;
}


/* =========================================================
   BOTONES GENERALES
   ========================================================= */

.button,
.admin-button {
  border-radius: var(--eng-radius-sm);

  transition:
    transform .16s ease,
    box-shadow .16s ease,
    border-color .16s ease,
    background .16s ease;
}

.button:hover,
.admin-button:hover {
  transform: translateY(-1px);
}

.button,
.admin-button:not(.ghost):not(.secondary) {
  background: var(--eng-navy);
  color: #fff;

  box-shadow:
    0 7px 18px rgba(18,34,69,.14);
}

.button:hover,
.admin-button:not(.ghost):not(.secondary):hover {
  background: var(--eng-navy-soft);
}


/* =========================================================
   CAMPOS GENERALES
   ========================================================= */

input,
textarea,
select {
  border-color: var(--eng-line-strong);

  transition:
    border-color .16s ease,
    box-shadow .16s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--eng-gold) !important;

  outline: none;

  box-shadow:
    0 0 0 3px
    rgba(181,153,87,.14) !important;
}


/* =========================================================
   EYEBROWS / ETIQUETAS
   ========================================================= */

.eyebrow,
.admin-eyebrow {
  color: var(--eng-gold-dark);

  letter-spacing: .14em;

  font-weight: 900;
}


/* =========================================================
   PORTAL PÚBLICO · HEADER
   ========================================================= */

body:not(.admin-body):not(.student-shell-body)
.topbar {
  min-height: 76px;

  border-bottom:
    1px solid rgba(181,153,87,.30);

  background:
    linear-gradient(
      90deg,
      var(--eng-navy-deep),
      var(--eng-navy)
    );

  box-shadow:
    0 8px 24px rgba(11,23,50,.12);
}

body:not(.admin-body):not(.student-shell-body)
.brand-icon {
  color: var(--eng-gold);
}

body:not(.admin-body):not(.student-shell-body)
.brand b {
  letter-spacing: -.01em;
}

body:not(.admin-body):not(.student-shell-body)
.topbar nav a {
  position: relative;
}

body:not(.admin-body):not(.student-shell-body)
.topbar nav a::after {
  content: "";

  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;

  height: 2px;

  transform: scaleX(0);

  background: var(--eng-gold);

  transition: transform .16s ease;
}

body:not(.admin-body):not(.student-shell-body)
.topbar nav a:hover::after {
  transform: scaleX(1);
}


/* =========================================================
   PORTAL PÚBLICO · CONTENEDOR
   ========================================================= */

body:not(.admin-body):not(.student-shell-body)
.container {
  width: min(1180px, calc(100% - 44px));

  padding-left: 0;
  padding-right: 0;
}


/* =========================================================
   PORTAL PÚBLICO · HERO
   ========================================================= */

body:not(.admin-body):not(.student-shell-body)
.hero {
  position: relative;

  overflow: hidden;

  border:
    1px solid var(--eng-line);

  border-radius:
    var(--eng-radius-lg);

  background:
    linear-gradient(
      135deg,
      #ffffff 0%,
      #f8fafc 48%,
      #eef2f7 100%
    );

  box-shadow: var(--eng-shadow);
}

body:not(.admin-body):not(.student-shell-body)
.hero::before {
  content: "";

  position: absolute;

  width: 230px;
  height: 230px;

  right: -95px;
  top: -105px;

  border:
    1px solid rgba(181,153,87,.32);

  transform: rotate(45deg);
}

body:not(.admin-body):not(.student-shell-body)
.hero::after {
  content: "";

  position: absolute;

  width: 120px;
  height: 3px;

  left: 54px;
  bottom: 0;

  background: var(--eng-gold);
}

body:not(.admin-body):not(.student-shell-body)
.hero-content,
body:not(.admin-body):not(.student-shell-body)
.hero-art {
  position: relative;

  z-index: 1;
}

body:not(.admin-body):not(.student-shell-body)
.hero h1 {
  color: var(--eng-navy);

  letter-spacing: -.04em;
}

body:not(.admin-body):not(.student-shell-body)
.hero p {
  color: var(--eng-muted);
}

body:not(.admin-body):not(.student-shell-body)
.hero-art-photo img {
  border:
    1px solid var(--eng-line);

  border-radius:
    var(--eng-radius);

  background: #fff;

  box-shadow:
    0 14px 32px rgba(18,34,69,.10);
}


/* =========================================================
   PORTAL PÚBLICO · SECCIONES
   ========================================================= */

body:not(.admin-body):not(.student-shell-body)
.professor-intro,
body:not(.admin-body):not(.student-shell-body)
.card,
body:not(.admin-body):not(.student-shell-body)
.panel,
body:not(.admin-body):not(.student-shell-body)
.resource-row,
body:not(.admin-body):not(.student-shell-body)
.announcement {
  border:
    1px solid var(--eng-line);

  border-radius:
    var(--eng-radius);

  background: rgba(255,255,255,.96);

  box-shadow: var(--eng-shadow-soft);
}

body:not(.admin-body):not(.student-shell-body)
.professor-intro {
  position: relative;

  overflow: hidden;
}

body:not(.admin-body):not(.student-shell-body)
.professor-intro::before {
  content: "";

  position: absolute;

  inset:
    0 auto 0 0;

  width: 4px;

  background: var(--eng-gold);
}

body:not(.admin-body):not(.student-shell-body)
.section-head h2,
body:not(.admin-body):not(.student-shell-body)
.professor-intro h2 {
  color: var(--eng-navy);
}


/* =========================================================
   PORTAL PÚBLICO · ASIGNATURAS
   ========================================================= */

body:not(.admin-body):not(.student-shell-body)
.subject-card {
  overflow: hidden;

  border:
    1px solid var(--eng-line);

  background: var(--eng-surface);

  transition:
    transform .18s ease,
    box-shadow .18s ease,
    border-color .18s ease;
}

body:not(.admin-body):not(.student-shell-body)
.subject-card:hover {
  transform: translateY(-3px);

  border-color:
    rgba(181,153,87,.55);

  box-shadow:
    0 16px 36px rgba(18,34,69,.11);
}

body:not(.admin-body):not(.student-shell-body)
.subject-card h3 {
  color: var(--eng-navy);
}


/* =========================================================
   PORTAL PÚBLICO · FOOTER
   ========================================================= */

body:not(.admin-body):not(.student-shell-body)
.footer {
  border-top:
    1px solid var(--eng-line);

  background:
    rgba(255,255,255,.65);

  color: var(--eng-muted);
}


/* =========================================================
   PROFESOR · SHELL
   ========================================================= */

.admin-body {
  background: var(--eng-bg);
}

.admin-sidebar {
  border-right:
    1px solid rgba(181,153,87,.20);

  background:
    linear-gradient(
      180deg,
      var(--eng-navy-deep),
      var(--eng-navy)
    );
}

.admin-brand-mark {
  border:
    1px solid rgba(181,153,87,.44);

  background:
    rgba(255,255,255,.98);

  color: var(--eng-navy);

  box-shadow:
    inset 0 -3px 0
    rgba(181,153,87,.24);
}

.admin-navigation a {
  border:
    1px solid transparent;

  transition:
    background .15s ease,
    border-color .15s ease,
    transform .15s ease;
}

.admin-navigation a:hover {
  transform: translateX(2px);

  border-color:
    rgba(255,255,255,.08);

  background:
    rgba(255,255,255,.07);
}

.admin-navigation a.active {
  border-color:
    rgba(181,153,87,.20);

  background:
    linear-gradient(
      90deg,
      rgba(181,153,87,.20),
      rgba(255,255,255,.09)
    );
}

.admin-navigation a.active > span:first-child {
  color: #dec681;
}

.admin-topbar {
  border-bottom:
    1px solid var(--eng-line);

  background:
    rgba(255,255,255,.95);

  backdrop-filter:
    blur(12px);
}

.admin-topbar strong {
  color: var(--eng-navy);
}

.admin-content {
  min-width: 0;
}


/* =========================================================
   PROFESOR · CABECERAS
   ========================================================= */

.admin-page-header {
  position: relative;

  min-width: 0;

  padding-bottom: 14px;

  border-bottom:
    1px solid var(--eng-line);
}

.admin-page-header::after {
  content: "";

  position: absolute;

  left: 0;
  bottom: -1px;

  width: 68px;
  height: 2px;

  background: var(--eng-gold);
}

.admin-page-header h1 {
  color: var(--eng-navy);

  letter-spacing: -.025em;
}


/* =========================================================
   PROFESOR · PANELES
   ========================================================= */

.admin-form-panel {
  border:
    1px solid var(--eng-line);

  border-radius:
    var(--eng-radius);

  background: var(--eng-surface);

  box-shadow: var(--eng-shadow-soft);
}

.admin-form-panel h2,
.admin-form-panel h3 {
  color: var(--eng-navy);
}


/* =========================================================
   PROFESOR · TABLAS
   ========================================================= */

.admin-body table {
  border-color: var(--eng-line);
}

.admin-body thead th {
  background: #f3f6f9;

  color: #53677f;
}

.admin-body tbody tr {
  transition: background .14s ease;
}

.admin-body tbody tr:hover {
  background: #fafbfd;
}


/* =========================================================
   ALUMNO · SHELL
   ========================================================= */

.student-shell-body {
  background: var(--eng-bg);
}

.student-sidebar {
  border-right:
    1px solid rgba(181,153,87,.18);

  background:
    linear-gradient(
      180deg,
      var(--eng-navy-deep),
      var(--eng-navy)
    );
}

.student-sidebar-mark {
  color: var(--eng-gold);
}

.student-sidebar-profile {
  border:
    1px solid rgba(255,255,255,.09);

  background:
    rgba(255,255,255,.055);
}

.student-sidebar-nav a {
  border:
    1px solid transparent;

  transition:
    background .15s ease,
    border-color .15s ease,
    transform .15s ease;
}

.student-sidebar-nav a:hover {
  transform: translateX(2px);

  background:
    rgba(255,255,255,.07);
}

.student-sidebar-nav a.active {
  border-color:
    rgba(181,153,87,.21);

  background:
    linear-gradient(
      90deg,
      rgba(181,153,87,.20),
      rgba(255,255,255,.08)
    );
}

.student-sidebar-nav a.active
.student-sidebar-icon {
  color: #dec681;
}

.student-shell-topbar {
  border-bottom:
    1px solid var(--eng-line);

  background:
    rgba(255,255,255,.95);

  backdrop-filter:
    blur(12px);
}

.student-shell-topbar strong {
  color: var(--eng-navy);
}

.student-shell-content {
  min-width: 0;
}


/* =========================================================
   ALUMNO · TARJETAS
   ========================================================= */

.student-shell-body
.student-card,
.student-shell-body
.student-hero,
.student-shell-body
.professor-intro,
.student-shell-body
.portal-extra-card,
.student-shell-body
.student-upload-card {
  border-color:
    var(--eng-line);

  background:
    var(--eng-surface);

  box-shadow:
    var(--eng-shadow-soft);
}


/* =========================================================
   ALERTAS
   ========================================================= */

.suite-alert {
  border:
    1px solid transparent;

  box-shadow: none;
}

.suite-alert.success {
  border-color:
    rgba(23,106,73,.18);
}

.suite-alert.danger {
  border-color:
    rgba(164,49,61,.18);
}


/* =========================================================
   FILE PICKER
   ========================================================= */

.portal-file-picker {
  border-color:
    var(--eng-line-strong);

  background:
    var(--eng-surface-soft);
}

.portal-file-picker-button {
  border-color:
    rgba(181,153,87,.38);

  background:
    var(--eng-navy);

  color: #fff;
}


/* =========================================================
   RESPONSIVE GLOBAL
   ========================================================= */

@media (max-width: 1000px) {

  body:not(.admin-body):not(.student-shell-body)
  .container {
    width:
      min(
        calc(100% - 32px),
        1180px
      );
  }

}


@media (max-width: 800px) {

  body:not(.admin-body):not(.student-shell-body)
  .topbar {
    min-height: 68px;
  }

  body:not(.admin-body):not(.student-shell-body)
  .container {
    width:
      calc(100% - 28px);
  }

  body:not(.admin-body):not(.student-shell-body)
  .hero {
    padding:
      30px 26px;
  }

  body:not(.admin-body):not(.student-shell-body)
  .hero::after {
    left: 26px;
  }

  .admin-page-header {
    gap: 14px;
  }

}


@media (max-width: 600px) {

  :root {
    --eng-radius-lg: 16px;
    --eng-radius: 12px;
  }

  body:not(.admin-body):not(.student-shell-body)
  .container {
    width:
      calc(100% - 22px);

    padding-top: 18px;
  }

  body:not(.admin-body):not(.student-shell-body)
  .hero {
    padding:
      25px 20px;
  }

  body:not(.admin-body):not(.student-shell-body)
  .hero::after {
    left: 20px;

    width: 52px;
  }

  .admin-form-panel {
    border-radius:
      12px;
  }

}


@media (max-width: 380px) {

  body:not(.admin-body):not(.student-shell-body)
  .container {
    width:
      calc(100% - 16px);
  }

}


/* =========================================================
   ACCESIBILIDAD
   ========================================================= */

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;

    transition-duration:
      .01ms !important;

    animation-duration:
      .01ms !important;
  }

}


/* =========================================================
   PWA GLOBAL
   ========================================================= */

.global-pwa-overlay[hidden],
.global-pwa-floating[hidden] {
  display: none !important;
}


.global-pwa-dialog-open {
  overflow: hidden;
}


.global-pwa-overlay {
  position: fixed;
  inset: 0;

  z-index: 10000;

  display: grid;
  place-items: center;

  padding: 22px;

  background:
    rgba(8,19,42,.58);

  backdrop-filter:
    blur(7px);
}


.global-pwa-dialog {
  width:
    min(
      100%,
      470px
    );

  max-height:
    calc(100vh - 44px);

  overflow-y: auto;

  padding: 28px;

  border:
    1px solid
    rgba(181,153,87,.34);

  border-radius: 20px;

  background: #ffffff;

  box-shadow:
    0 26px 80px
    rgba(8,19,42,.25);
}


.global-pwa-icon {
  width: 58px;
  height: 58px;

  display: grid;
  place-items: center;

  margin-bottom: 18px;

  overflow: hidden;

  border:
    1px solid
    var(--eng-line);

  border-radius: 15px;

  background: #fff;
}


.global-pwa-icon img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: contain;
}


.global-pwa-kicker {
  display: block;

  margin-bottom: 5px;

  color:
    var(--eng-gold-dark);

  font-size: .72rem;
  font-weight: 900;

  letter-spacing: .14em;
  text-transform: uppercase;
}


.global-pwa-copy h2 {
  margin:
    0 0 9px;

  color:
    var(--eng-navy);

  font-size:
    clamp(
      1.45rem,
      4vw,
      1.9rem
    );

  line-height: 1.15;
}


.global-pwa-copy p {
  margin: 0;

  color:
    var(--eng-muted);

  font-size: .95rem;

  line-height: 1.55;
}


.global-pwa-ios-help {
  display: grid;

  gap: 3px;

  margin-top: 18px;

  padding: 13px 14px;

  border:
    1px solid
    rgba(181,153,87,.25);

  border-radius: 11px;

  background:
    var(--eng-gold-soft);

  color:
    var(--eng-navy);
}


.global-pwa-ios-help[hidden] {
  display: none !important;
}


.global-pwa-ios-help strong {
  font-size: .8rem;
}


.global-pwa-ios-help span {
  font-size: .75rem;

  line-height: 1.45;
}


.global-pwa-status {
  margin:
    14px 0 0;

  padding: 11px 12px;

  border-radius: 10px;

  background:
    #f1f5f9;

  color:
    #53677f;

  font-size: .75rem;

  line-height: 1.45;
}


.global-pwa-status.error {
  background: #fff0f1;
  color: #96313c;
}


.global-pwa-actions {
  display: grid;

  grid-template-columns:
    1fr
    1fr;

  gap: 9px;

  margin-top: 22px;
}


.global-pwa-primary,
.global-pwa-secondary {
  min-height: 46px;

  padding:
    0 15px;

  border-radius: 10px;

  font-weight: 850;

  cursor: pointer;
}


.global-pwa-primary {
  border:
    1px solid
    var(--eng-navy);

  background:
    var(--eng-navy);

  color: #fff;
}


.global-pwa-secondary {
  border:
    1px solid
    var(--eng-line-strong);

  background: #fff;

  color:
    var(--eng-navy);
}


.global-pwa-floating {
  position: fixed;

  right: 18px;
  bottom: 18px;

  z-index: 200;

  min-height: 42px;

  display: inline-flex;
  align-items: center;

  gap: 7px;

  padding:
    0 14px;

  border:
    1px solid
    rgba(181,153,87,.42);

  border-radius: 999px;

  background:
    var(--eng-navy);

  color: #fff;

  box-shadow:
    0 10px 30px
    rgba(18,34,69,.20);

  font-size: .76rem;
  font-weight: 850;

  cursor: pointer;
}


.global-pwa-floating span {
  color:
    #e2cc8e;
}


@media (max-width: 520px) {

  .global-pwa-overlay {
    align-items: end;

    padding: 10px;
  }


  .global-pwa-dialog {
    width: 100%;

    max-height:
      calc(100dvh - 20px);

    padding:
      22px 18px;

    border-radius:
      18px;
  }


  .global-pwa-actions {
    grid-template-columns: 1fr;
  }


  .global-pwa-primary {
    grid-row: 1;
  }


  .global-pwa-secondary {
    grid-row: 2;
  }


  .global-pwa-floating {
    right: 12px;
    bottom: 12px;

    max-width:
      calc(100% - 24px);
  }

}


/* =========================================================
   LOGIN · MANTENER SESIÓN INICIADA
   ========================================================= */

.remember-session-card {
  width: 100%;

  display: grid !important;

  grid-template-columns:
    42px
    minmax(0,1fr);

  align-items: start;

  gap: 12px;

  padding: 14px 15px;

  border:
    1px solid
    var(--eng-line-strong);

  border-radius: 12px;

  background:
    #f8fafc;

  cursor: pointer;

  user-select: none;

  transition:
    border-color .16s ease,
    background .16s ease,
    box-shadow .16s ease,
    transform .16s ease;
}


.remember-session-card:hover {
  border-color:
    rgba(181,153,87,.65);

  background:
    #fbfaf6;

  box-shadow:
    0 6px 18px
    rgba(18,34,69,.055);
}


.remember-session-control {
  position: relative;

  width: 42px;
  height: 42px;

  display: grid;

  place-items: center;

  flex: 0 0 42px;
}


.remember-session-control
input {
  position: absolute;

  width: 1px !important;
  height: 1px !important;

  opacity: 0;

  pointer-events: none;
}


.remember-session-check {
  width: 24px;
  height: 24px;

  display: grid;

  place-items: center;

  border:
    2px solid
    #98a8bb;

  border-radius: 7px;

  background: #fff;

  transition:
    border-color .15s ease,
    background .15s ease,
    box-shadow .15s ease;
}


.remember-session-control
input:checked
+
.remember-session-check {
  border-color:
    var(--eng-navy);

  background:
    var(--eng-navy);

  box-shadow:
    0 0 0 4px
    rgba(181,153,87,.14);
}


.remember-session-control
input:checked
+
.remember-session-check::after {
  content: "✓";

  color: #fff;

  font-size: .85rem;
  font-weight: 900;

  line-height: 1;
}


.remember-session-control
input:focus-visible
+
.remember-session-check {
  outline:
    3px solid
    rgba(181,153,87,.30);

  outline-offset: 2px;
}


.remember-session-copy {
  min-width: 0;

  display: grid;

  gap: 4px;
}


.remember-session-copy strong {
  color:
    var(--eng-navy);

  font-size: .88rem;

  line-height: 1.35;
}


.remember-session-copy small {
  color:
    var(--eng-muted);

  font-size: .72rem;

  line-height: 1.5;
}


.remember-session-security {
  width: fit-content;

  margin-top: 3px;

  padding:
    3px 7px;

  border-radius: 999px;

  background:
    var(--eng-gold-soft);

  color:
    var(--eng-gold-dark);

  font-size: .62rem;
  font-weight: 850;
}


.remember-session-card:has(
  input:checked
) {
  border-color:
    rgba(181,153,87,.70);

  background:
    linear-gradient(
      135deg,
      #fff 0%,
      #faf7ef 100%
    );

  box-shadow:
    inset 3px 0 0
    var(--eng-gold);
}


@media (max-width: 520px) {

  .remember-session-card {
    grid-template-columns:
      36px
      minmax(0,1fr);

    gap: 9px;

    padding:
      13px 12px;
  }


  .remember-session-control {
    width: 36px;
    height: 36px;
  }


  .remember-session-check {
    width: 23px;
    height: 23px;
  }


  .remember-session-copy strong {
    font-size: .82rem;
  }


  .remember-session-copy small {
    font-size: .68rem;
  }

}
