/*
 * Dialogo de cuenta compartido entre la portada y el campus.
 * Se carga despues de las hojas principales para mantener una unica
 * experiencia de perfil sin importar desde donde se abra.
 */

.account-dialog {
  background: transparent;
  border: 0;
  color: var(--brand-ink, #172033);
  margin: auto;
  max-height: calc(100dvh - 32px);
  max-width: none;
  overflow: visible;
  padding: 0;
  width: min(960px, calc(100vw - 32px));
}

.account-dialog::backdrop {
  backdrop-filter: blur(3px);
  background: rgba(16, 27, 43, 0.62);
}

.account-dialog[open] {
  animation: account-dialog-in 170ms ease-out;
}

@keyframes account-dialog-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.account-dialog [hidden] {
  display: none !important;
}

.account-dialog-shell {
  background: #fff;
  border: 1px solid #d8e2ec;
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(12, 28, 48, 0.28);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100dvh - 32px);
  min-height: min(610px, calc(100dvh - 32px));
  overflow: hidden;
}

.account-dialog-header {
  align-items: center;
  border-bottom: 1px solid #e2e9f0;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  min-height: 86px;
  padding: 16px 20px;
}

.account-dialog-identity {
  align-items: center;
  display: flex;
  gap: 13px;
  min-width: 0;
}

.account-dialog-avatar {
  align-items: center;
  background: var(--brand-900, #164194);
  border-radius: 7px;
  color: #fff;
  display: inline-flex;
  flex: 0 0 46px;
  font-size: 13px;
  font-weight: 900;
  height: 46px;
  justify-content: center;
  width: 46px;
}

.account-dialog-identity > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.account-dialog-identity > div > span {
  color: var(--brand-700, #2764ae);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.account-dialog-identity h2 {
  color: var(--brand-ink, #172033);
  font-size: 20px;
  line-height: 1.15;
  margin: 0;
}

.account-dialog-identity p {
  align-items: center;
  color: var(--brand-muted, #636e72);
  display: flex;
  font-size: 11px;
  gap: 6px;
  line-height: 1.3;
  margin: 0;
  min-width: 0;
}

.account-dialog-identity p strong,
.account-dialog-identity p span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-dialog-identity p strong {
  color: var(--brand-ink, #172033);
}

.account-dialog-identity p i {
  font-style: normal;
}

.account-dialog-header-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.account-dialog .account-dialog-close,
.account-dialog .account-dialog-logout {
  align-items: center;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  font-family: inherit;
  justify-content: center;
}

.account-dialog .account-dialog-close {
  background: #f4f7fa;
  border: 1px solid #dce5ed;
  color: #34465a;
  flex: 0 0 38px;
  font-size: 24px;
  height: 38px;
  line-height: 1;
  min-height: 38px;
  padding: 0 0 3px;
  width: 38px;
}

.account-dialog .account-dialog-close:hover {
  background: #e8eef4;
  color: var(--brand-900, #164194);
}

.account-dialog .account-dialog-logout {
  background: #fff;
  border: 1px solid #ebcfd1;
  color: #a62f35;
  font-size: 10px;
  font-weight: 850;
  gap: 7px;
  min-height: 38px;
  padding: 8px 11px;
}

.account-dialog .account-dialog-logout:hover {
  background: #fff4f4;
  border-color: #dcaeb1;
}

.account-dialog .account-dialog-logout svg {
  fill: none;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 16px;
}

.account-dialog-layout {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 0;
}

.account-dialog-tabs {
  align-content: start;
  background: #f5f8fb;
  border-right: 1px solid #e1e8ef;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 16px 12px;
}

.account-dialog .account-dialog-tabs button {
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 6px;
  color: #536477;
  cursor: pointer;
  display: grid;
  font-family: inherit;
  gap: 3px;
  min-height: 58px;
  min-width: 0;
  padding: 10px 12px;
  text-align: left;
}

.account-dialog .account-dialog-tabs button:hover {
  background: #eaf0f6;
  color: var(--brand-900, #164194);
}

.account-dialog .account-dialog-tabs button.active {
  background: #e5eef8;
  border-left-color: var(--brand-700, #2764ae);
  color: var(--brand-900, #164194);
}

.account-dialog-tabs button span,
.account-dialog-tabs button small {
  display: block;
  line-height: 1.3;
  min-width: 0;
}

.account-dialog-tabs button span {
  font-size: 12px;
  font-weight: 850;
}

.account-dialog-tabs button small {
  color: #708092;
  font-size: 9px;
  font-weight: 650;
}

.account-dialog-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 32px 30px;
}

.account-dialog-panel {
  animation: account-panel-in 140ms ease-out;
  margin: 0 auto;
  max-width: 670px;
}

@keyframes account-panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.account-panel-heading {
  border-bottom: 1px solid #e3eaf1;
  margin-bottom: 22px;
  padding-bottom: 18px;
}

.account-panel-heading > span,
.account-orders-heading > div > span {
  color: var(--brand-700, #2764ae);
  display: block;
  font-size: 9px;
  font-weight: 850;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.account-panel-heading h3 {
  color: var(--brand-ink, #172033);
  font-size: 20px;
  line-height: 1.2;
  margin: 0;
}

.account-panel-heading p {
  color: var(--brand-muted, #636e72);
  font-size: 11px;
  line-height: 1.55;
  margin: 6px 0 0;
}

.account-dialog .account-profile-form,
.account-dialog .account-password-form {
  display: grid;
  gap: 20px;
}

.account-form-grid {
  display: grid;
  gap: 17px 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-dialog .account-profile-form label,
.account-dialog .account-password-form label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.account-dialog .account-profile-form label > span,
.account-dialog .account-password-form label > span {
  color: #35475a;
  font-size: 10px;
  font-weight: 800;
}

.account-dialog .account-profile-form label > small {
  color: #7c8a98;
  font-size: 9px;
  line-height: 1.4;
  margin-top: -2px;
}

.account-dialog .account-profile-form input,
.account-dialog .account-profile-form select,
.account-dialog .account-password-form input {
  background: #fff;
  border: 1px solid #ccd7e1;
  border-radius: 6px;
  color: var(--brand-ink, #172033);
  font: inherit;
  font-size: 12px;
  height: 44px;
  min-height: 44px;
  min-width: 0;
  padding: 0 12px;
  width: 100%;
}

.account-dialog .account-profile-form input[readonly] {
  background: #f1f4f6;
  color: #677789;
  cursor: not-allowed;
}

.account-dialog .account-profile-form input:focus,
.account-dialog .account-profile-form select:focus,
.account-dialog .account-password-form input:focus {
  border-color: var(--brand-600, #1d71b8);
  box-shadow: 0 0 0 3px rgba(29, 113, 184, 0.14);
  outline: 0;
}

.account-form-wide {
  grid-column: 1 / -1;
}

.account-form-footer {
  align-items: center;
  border-top: 1px solid #e5ebf1;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 62px;
  padding-top: 16px;
}

.account-form-footer > p {
  color: var(--brand-muted, #636e72);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
}

.account-form-footer > p.is-success {
  color: #197149;
}

.account-form-footer > p.is-error {
  color: #a62f35;
}

.account-dialog .account-form-footer > button,
.account-dialog .account-orders-heading > button,
.account-dialog .account-orders-state > button {
  background: var(--brand-900, #164194);
  border: 1px solid var(--brand-900, #164194);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
  font-family: inherit;
  font-size: 11px;
  font-weight: 850;
  min-height: 40px;
  padding: 9px 15px;
}

.account-dialog .account-form-footer > button:hover,
.account-dialog .account-orders-heading > button:hover,
.account-dialog .account-orders-state > button:hover {
  background: var(--brand-700, #2764ae);
  border-color: var(--brand-700, #2764ae);
}

.account-dialog .account-form-footer > button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.account-security-summary {
  border-bottom: 1px solid #e1e8ef;
  border-top: 1px solid #e1e8ef;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 26px;
}

.account-security-summary > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 15px 0;
}

.account-security-summary > div + div {
  border-left: 1px solid #e1e8ef;
  padding-left: 20px;
}

.account-security-summary dt {
  color: #718091;
  font-size: 9px;
  font-weight: 750;
}

.account-security-summary dd {
  color: var(--brand-ink, #172033);
  font-size: 12px;
  font-weight: 850;
  margin: 0;
  overflow-wrap: anywhere;
}

.account-dialog .account-password-form {
  gap: 15px 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-dialog .account-password-heading,
.account-dialog .account-password-form .account-form-footer,
.account-dialog .account-password-form label:first-of-type {
  grid-column: 1 / -1;
}

.account-password-heading {
  display: grid;
  gap: 4px;
}

.account-password-heading strong {
  color: var(--brand-ink, #172033);
  font-size: 13px;
}

.account-password-heading small {
  color: var(--brand-muted, #636e72);
  font-size: 10px;
  line-height: 1.45;
}

.account-orders-heading {
  align-items: end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

.account-orders-heading > div {
  min-width: 0;
}

.account-dialog .account-orders-heading > button {
  background: #fff;
  color: var(--brand-900, #164194);
  min-height: 36px;
  padding: 7px 12px;
}

.account-orders-list {
  display: grid;
  gap: 12px;
}

.account-orders-state {
  align-content: center;
  color: var(--brand-muted, #636e72);
  display: grid;
  justify-items: center;
  min-height: 250px;
  padding: 30px;
  text-align: center;
}

.account-orders-state > span {
  animation: account-orders-spin 750ms linear infinite;
  border: 3px solid #d9e4ee;
  border-radius: 50%;
  border-top-color: var(--brand-700, #2764ae);
  height: 28px;
  margin-bottom: 12px;
  width: 28px;
}

@keyframes account-orders-spin {
  to { transform: rotate(360deg); }
}

.account-orders-state strong {
  color: var(--brand-ink, #172033);
  font-size: 13px;
}

.account-orders-state p {
  font-size: 10px;
  line-height: 1.5;
  margin: 5px 0 14px;
  max-width: 360px;
}

.account-orders-state.is-error strong {
  color: #a62f35;
}

.account-order-item {
  border: 1px solid #dce5ed;
  border-radius: 8px;
  overflow: hidden;
}

.account-order-item > header,
.account-order-item > footer {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 13px 15px;
}

.account-order-item > header {
  background: #f5f8fb;
  border-bottom: 1px solid #e1e8ef;
}

.account-order-item > header > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.account-order-item > header span {
  color: #197149;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.account-order-item > header strong {
  color: var(--brand-ink, #172033);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.account-order-item time,
.account-order-item > footer > small {
  color: var(--brand-muted, #636e72);
  font-size: 9px;
}

.account-order-courses {
  display: grid;
  gap: 10px;
  padding: 15px;
}

.account-order-courses > div {
  align-items: start;
  display: grid;
  gap: 9px;
  grid-template-columns: 18px minmax(0, 1fr);
}

.account-order-courses > div > span {
  align-items: center;
  background: #e5f3ec;
  border-radius: 50%;
  color: #197149;
  display: inline-flex;
  font-size: 9px;
  height: 18px;
  justify-content: center;
  width: 18px;
}

.account-order-courses p,
.account-order-item > footer p {
  margin: 0;
}

.account-order-courses strong,
.account-order-courses small {
  display: block;
  line-height: 1.4;
}

.account-order-courses strong {
  color: var(--brand-ink, #172033);
  font-size: 11px;
}

.account-order-courses small {
  color: var(--brand-muted, #636e72);
  font-size: 9px;
}

.account-order-item > footer {
  border-top: 1px solid #e6ecf2;
}

.account-order-item > footer p {
  align-items: baseline;
  display: flex;
  gap: 8px;
}

.account-order-item > footer p span {
  color: var(--brand-muted, #636e72);
  font-size: 9px;
}

.account-order-item > footer p strong {
  color: var(--brand-900, #164194);
  font-size: 14px;
}

.account-dialog button:focus-visible,
.account-dialog input:focus-visible,
.account-dialog select:focus-visible {
  outline: 3px solid rgba(29, 113, 184, 0.22);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .account-dialog {
    max-height: calc(100dvh - 16px);
    width: calc(100vw - 16px);
  }

  .account-dialog-shell {
    max-height: calc(100dvh - 16px);
    min-height: min(680px, calc(100dvh - 16px));
  }

  .account-dialog-header {
    min-height: 74px;
    padding: 12px 14px;
  }

  .account-dialog-avatar {
    flex-basis: 40px;
    height: 40px;
    width: 40px;
  }

  .account-dialog-identity h2 {
    font-size: 17px;
  }

  .account-dialog-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .account-dialog-tabs {
    border-bottom: 1px solid #e1e8ef;
    border-right: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 7px 8px;
  }

  .account-dialog.is-non-student .account-dialog-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-dialog .account-dialog-tabs button {
    border-bottom: 3px solid transparent;
    border-left: 0;
    min-height: 43px;
    padding: 7px 5px;
    text-align: center;
  }

  .account-dialog .account-dialog-tabs button.active {
    border-bottom-color: var(--brand-700, #2764ae);
    border-left-color: transparent;
  }

  .account-dialog-tabs button small {
    display: none;
  }

  .account-dialog-content {
    padding: 22px 20px 26px;
  }
}

@media (max-width: 480px) {
  .account-dialog {
    height: 100dvh;
    max-height: none;
    width: 100vw;
  }

  .account-dialog-shell {
    border: 0;
    border-radius: 0;
    height: 100dvh;
    max-height: none;
    min-height: 0;
  }

  .account-dialog-identity > div > span,
  .account-dialog-identity p i,
  .account-dialog-identity p span,
  .account-dialog .account-dialog-logout span {
    display: none;
  }

  .account-dialog .account-dialog-logout {
    height: 38px;
    padding: 0;
    width: 38px;
  }

  .account-dialog-tabs button span {
    font-size: 10px;
  }

  .account-dialog-content {
    padding: 20px 16px 28px;
  }

  .account-panel-heading h3 {
    font-size: 18px;
  }

  .account-form-grid,
  .account-dialog .account-password-form,
  .account-security-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-form-wide,
  .account-dialog .account-password-heading,
  .account-dialog .account-password-form .account-form-footer,
  .account-dialog .account-password-form label:first-of-type {
    grid-column: auto;
  }

  .account-security-summary > div + div {
    border-left: 0;
    border-top: 1px solid #e1e8ef;
    padding-left: 0;
  }

  .account-form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .account-dialog .account-form-footer > button {
    width: 100%;
  }

  .account-order-item > header,
  .account-order-item > footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-dialog[open],
  .account-dialog-panel,
  .account-orders-state > span {
    animation-duration: 0.01ms !important;
  }
}
