/* Ruta: public/assets/css/app.css */

:root {
  --ink: #12241c;
  --paper: #ffffff;
  --canvas: #fcfaf7;
  --forest: #0c2b22;
  --forest-deep: #061612;
  --gold: #c4a35a;
  --orange: #c56a0a;
  --muted: #6b6560;
  --muted-soft: #8a847c;
  --border: #e4e0d8;
  --danger: #9f1d1d;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

a {
  color: var(--forest);
}

button,
input,
select {
  font: inherit;
}

.sae-stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse 86% 64% at 50% 22%, #1a6b48 0%, #0d3d2c 38%, #072018 70%, #020a08 100%);
}

.sae-stage-canvas {
  min-height: 100vh;
  background: #f6f4ee;
  padding: 24px;
}

.sae-home {
  width: 100%;
  max-width: 560px;
  text-align: left;
}

.sae-home h1 {
  margin: 0;
  font-size: 52px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #fff;
}

.sae-home p {
  margin: 12px 0 0;
  font-size: 22px;
  color: rgba(255, 255, 255, 0.95);
}

.sae-home-grid {
  margin-top: 40px;
  display: grid;
  gap: 16px;
}

@media (min-width: 640px) {
  .sae-home-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.sae-glass-link,
.sae-glass-card {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  color: #fff;
}

.sae-glass-link {
  display: block;
  padding: 28px;
  text-decoration: none;
}

.sae-glass-link:hover {
  background: rgba(0, 0, 0, 0.4);
}

.sae-glass-card {
  width: 100%;
  max-width: 24rem;
  padding: 32px;
}

.sae-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

.sae-glass-link .sae-kicker + div,
.sae-glass-card h1 + p {
  margin-top: 8px;
}

.sae-glass-link div:last-child {
  margin-top: 8px;
  font-size: 18px;
  color: #fff;
}

.sae-glass-card h1 {
  margin: 0;
  text-align: center;
  font-size: 30px;
  color: #fff;
}

.sae-glass-card .lead {
  margin: 4px 0 24px;
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.sae-glass-card label {
  display: block;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
}

.sae-glass-card .hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

.sae-glass-card .back {
  display: block;
  margin-top: 16px;
  text-align: center;
  color: var(--gold);
  text-decoration: none;
  font-size: 14px;
}

.sae-glass-card .back:hover {
  text-decoration: underline;
}

.sae-field {
  margin-bottom: 12px;
}

.sae-field .sae-input {
  margin-top: 4px;
}

.sae-shell {
  display: flex;
  min-height: 100vh;
  background: var(--canvas);
}

.sae-nav-toggle {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 40;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--forest);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sae-nav-toggle svg {
  width: 20px;
  height: 20px;
  display: none;
}

.sae-shell.is-nav-open .sae-nav-icon-close,
.sae-shell.is-nav-collapsed .sae-nav-icon-open {
  display: block;
}

.sae-sidebar {
  width: 232px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  color: #f4f0e6;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0) 22%),
    linear-gradient(180deg, #123d30 0%, #0c2b22 46%, #061612 100%);
  transition: transform 0.2s ease, width 0.2s ease;
}

.sae-shell.is-nav-open .sae-nav-toggle {
  left: 196px;
}

.sae-shell.is-nav-collapsed .sae-sidebar {
  transform: translateX(-100%);
  width: 0;
  overflow: hidden;
}

.sae-shell.is-nav-collapsed .sae-nav-toggle {
  left: 12px;
}

.sae-shell.is-nav-collapsed .sae-main {
  padding-left: 64px;
}

@media (max-width: 768px) {
  .sae-sidebar {
    position: fixed;
    z-index: 30;
    height: 100vh;
    transform: translateX(-100%);
    width: 232px;
  }
  .sae-shell.is-nav-open .sae-sidebar {
    transform: none;
    width: 232px;
  }
  .sae-shell.is-nav-collapsed .sae-sidebar {
    transform: translateX(-100%);
    width: 232px;
  }
  .sae-main {
    padding: 64px 16px 24px;
  }
  .sae-shell.is-nav-collapsed .sae-main,
  .sae-shell.is-nav-open .sae-main {
    padding-left: 16px;
    padding-top: 64px;
  }
}

.sae-main {
  min-width: 0;
  flex: 1;
  padding: 28px;
}

.sae-brand {
  display: block;
  padding: 24px 20px 16px;
  text-decoration: none;
  color: inherit;
}

.sae-brand strong {
  display: block;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #fff;
}

.sae-brand small {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.sae-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 0 12px 16px;
}

.sae-nav-link,
.sae-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.sae-nav-link:hover,
.sae-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sae-nav-link.is-active {
  background: var(--orange);
  color: #fff;
  font-weight: 600;
}

.sae-nav-link svg,
.sae-logout svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.9;
}

.sae-nav-foot {
  margin-top: 8px;
}

.icon-btn {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: #eef1ee;
  color: #3f4a45;
  text-decoration: none;
  cursor: pointer;
}

.icon-btn[title="Editar"],
.icon-btn-edit { color: #0c2b22; background: #d7ebe3; }
.icon-btn[title="Calificaciones"],
.icon-btn-grades { color: #b45309; background: #fde8c8; }
.icon-btn[title="Cambio"],
.icon-btn-swap { color: #1d4ed8; background: #dbe7ff; }
.icon-btn[title="Baja"],
.icon-btn[title="Eliminar"],
.icon-btn-danger { color: #b42318; background: #fde2e0; }
.icon-btn[title="Ver"],
.icon-btn-eye { color: #0f766e; background: #d5f0ec; }
.icon-btn[title="Descargar"],
.icon-btn[title="Imprimir"],
.icon-btn-download { color: #c56a0a; background: #f8edd9; }
.icon-btn[title="Horario"],
.icon-btn-clock { color: #475569; background: #e4e9f0; }
.icon-btn[title="Documentos"],
.icon-btn-file { color: #6d28d9; background: #ece4fb; }
.icon-btn[title="Tomar lista"],
.icon-btn-list { color: #0c2b22; background: #d7ebe3; }

.icon-btn:hover {
  filter: brightness(0.92);
  transform: scale(1.12);
}

.icon-btn.is-disabled,
.icon-btn[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.icon-btn-danger:hover,
.icon-btn[title="Baja"]:hover,
.icon-btn[title="Eliminar"]:hover {
  background: #f8c9c6;
  color: #7f1d1d;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.sae-official-warn {
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 2px solid #b42318;
  border-radius: 8px;
  background: #fff4f4;
  color: #7f1d1d;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
}

.asig-doc {
  max-width: 8.5in;
  margin: 16px auto 32px;
  padding: 12px 20px 24px;
  background: #fff;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
}

.asig-head {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}

.asig-head img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.asig-head div {
  text-align: right;
  line-height: 1.25;
}

.asig-head-center {
  align-items: center;
}

.asig-head-center div {
  text-align: center;
}

.asig-head strong,
.asig-head span,
.asig-head small {
  display: block;
  font-size: 12px;
}

.asig-doc h1 {
  text-align: center;
  font-size: 18px;
  letter-spacing: 0.04em;
  margin: 12px 0 4px;
}

.asig-cycle {
  text-align: center;
  margin: 2px 0;
  font-weight: 700;
}

.asig-teacher {
  text-align: left;
  font-weight: 800;
  margin: 14px 0 8px;
}

.asig-doc table {
  width: 100%;
  border-collapse: collapse;
}

.asig-doc th,
.asig-doc td {
  border: 1px solid #111;
  padding: 3px 6px;
  font-size: 11px;
  text-align: left;
}

.asig-close {
  text-align: left;
  margin-top: 22px;
  line-height: 1.4;
}

.asig-sign {
  text-align: left;
  margin-top: 28px;
  font-weight: 700;
}

.asig-date {
  text-align: right;
  margin-top: 8px;
}

table.sae-table thead th[data-dir="asc"]::after { content: " ↑"; }
table.sae-table thead th[data-dir="desc"]::after { content: " ↓"; }

@media print {
  @page { size: letter portrait; margin: 10mm 12mm; }
  .asig-doc { margin: 0; padding: 0; max-width: none; }
}

.sae-nav-rule {
  margin: 0 12px 8px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.sae-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 12px 8px;
}

.sae-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #9b2c2c;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.sae-user strong,
.sae-user small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sae-user strong {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.sae-user small {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.sae-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.sae-heading h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  color: var(--forest);
}

.sae-heading p {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.sae-heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sae-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.sae-card-pad {
  padding: 20px;
}

.sae-card h2 {
  margin: 0;
  font-size: 18px;
  color: var(--forest);
}

.sae-card .muted {
  margin: 4px 0 16px;
  font-size: 14px;
  color: var(--muted);
}

.sae-peer-mark {
  display: inline-block;
  width: 1.1em;
  margin-right: 6px;
  font-weight: 700;
  font-size: 1.05em;
  line-height: 1;
  vertical-align: -1px;
}
.sae-peer-ok { color: #1b7a3d; }
.sae-peer-bad { color: #c62828; cursor: help; }

.sae-table-wrap {
  overflow-x: auto;
}

.sae-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.sae-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted-soft);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.sae-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #eeeae3;
  vertical-align: middle;
}

.sae-input,
.sae-select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 8px 11px;
  color: var(--ink);
}

.sae-input:focus,
.sae-select:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 2px rgba(12, 43, 34, 0.12);
}

.sae-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.75rem;
  font-weight: 700;
}

.sae-pill-ok {
  background: #e8f6ee;
  color: #166534;
}

.sae-pill-no {
  background: #fde8e8;
  color: #991b1b;
}

.sae-pill-wait {
  background: #fff4d6;
  color: #92400e;
}

.sae-pill-auto {
  background: #e8f1fb;
  color: #1d4ed8;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 6px 12px;
  background: var(--forest);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

.btn-lg {
  min-height: 40px;
  width: 100%;
}

.btn-sm {
  min-height: 28px;
  padding: 2px 8px;
  font-size: 13px;
}

.btn-outline {
  background: #fff;
  border-color: var(--border);
  color: var(--forest);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-ok {
  background: #166534;
  color: #fff;
}

.btn-ok:hover {
  background: #14532d;
}

.alert {
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

.alert-ok,
.alert-success {
  background: #e8f6ee;
  color: #166534;
}

.alert-error,
.alert-danger {
  background: #fde8e8;
  color: #991b1b;
}

.sae-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.sae-search .sae-input {
  max-width: 36rem;
  flex: 1;
}

.sae-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.sae-pager {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  color: var(--muted-soft);
}

.sae-pager-btns {
  display: flex;
  gap: 6px;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.grid-2 {
  display: grid;
  gap: 12px;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.dl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
  padding: 16px;
  font-size: 14px;
}

.dl-grid dt {
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 12px;
}

.form-stack label {
  display: block;
  font-size: 14px;
}

.form-stack .sae-input,
.form-stack .sae-select {
  margin-top: 4px;
}

.sae-sim {
  margin-top: 24px;
  border: 1px dashed #cfc9bd;
  border-radius: 8px;
  padding: 16px;
}

.sae-sim p {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-soft);
}

.sae-sim-grid {
  display: grid;
  gap: 8px;
}

@media (min-width: 900px) {
  .sae-sim-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.warn-box {
  margin-bottom: 20px;
  border: 1px solid #f1b0b0;
  background: #fdecec;
  color: #991b1b;
  border-radius: 8px;
  padding: 12px 16px;
}

.warn-box p {
  margin: 0;
}

.warn-box ul {
  margin: 4px 0 0;
  padding-left: 20px;
}

.teacher-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.teacher-row + .teacher-row {
  margin-top: 12px;
}

.max-xl {
  max-width: 36rem;
}

.nowrap {
  white-space: nowrap;
}

.text-muted {
  color: var(--muted);
}

.text-center {
  text-align: center;
}

.ml-2 {
  margin-left: 8px;
}

.sae-semester {
  margin-bottom: 16px;
  overflow: hidden;
}

.sae-semester-title {
  margin: 0;
  padding: 12px 16px;
  font-size: 16px;
  background: #f3efe6;
  border-bottom: 1px solid var(--border);
}

.observe-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fff4e5;
  border: 1px solid #efc27a;
  color: #7a4b08;
  font-size: 14px;
}

.doc-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #fff;
}

.doc-icon svg { width: 16px; height: 16px; }
.doc-icon-yes { background: #166534; }
.doc-icon-no { background: #9f1d1d; pointer-events: none; }

.audit-login { background: #eef4fb; }
.audit-alta { background: #e8f6ee; }
.audit-baja { background: #fde8e8; }
.audit-calificaciones { background: #fff6e8; }
.audit-asignacion { background: #f3eefb; }

.x-btn {
  border: 0;
  background: transparent;
  color: #9f1d1d;
  font-size: 18px;
  cursor: pointer;
  width: 28px;
}

.brand-registered {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 40;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}

.brand-registered-tip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  padding: 6px 10px;
  border-radius: 8px;
  background: #1f2a23;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.brand-registered:hover .brand-registered-tip,
.brand-registered:focus-visible .brand-registered-tip {
  opacity: 1;
  transform: translateY(0);
}
