/* Componentes compartidos creados en tiempo de ejecución. */

#wp-global-loading {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .14s ease, visibility .14s ease;
}

#wp-global-loading.wp-global-loading--visible {
  opacity: 1;
  visibility: visible;
}

#wp-global-loading .wp-global-loading__card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: min(88vw, 360px);
  min-height: 58px;
  padding: 12px 18px;
  border: 1px solid rgba(108, 157, 255, .34);
  border-radius: 16px;
  background: rgba(12, 24, 45, .94);
  color: #f7f9ff;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font: 700 15px/1.25 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#wp-global-loading .wp-global-loading__spinner {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border: 3px solid rgba(255, 255, 255, .24);
  border-top-color: #63a0ff;
  border-radius: 50%;
  animation: wp-global-loading-spin .78s linear infinite;
}

#wp-global-loading .wp-global-loading__label {
  overflow-wrap: anywhere;
}

@keyframes wp-global-loading-spin {
  to { transform: rotate(360deg); }
}

.session-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.session-user {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  color: var(--white-60);
  background: var(--white-10);
  border: 1px solid var(--navy-border);
  border-radius: 20px;
  padding: 4px 10px;
  white-space: nowrap;
}

.session-icon { font-size: .85rem; }

.session-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-session {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-ui);
  font-size: .75rem;
  font-weight: bold;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  min-height: 32px;
  white-space: nowrap;
  text-decoration: none;
  transition: all .15s;
}

.btn-session-admin {
  background: rgba(232, 184, 75, .15);
  color: var(--gold);
  border: 1px solid rgba(232, 184, 75, .3);
}

.btn-session-admin:hover { background: rgba(232, 184, 75, .25); }

.btn-session-logout {
  background: rgba(248, 113, 113, .12);
  color: #ff8a80;
  border: 1px solid rgba(248, 113, 113, .25);
}

.btn-session-logout:hover { background: rgba(248, 113, 113, .22); }

.btn-session-pwd {
  background: rgba(31, 187, 110, .1);
  color: #1fbb6e;
  border: 1px solid rgba(31, 187, 110, .25);
  font-size: .85rem;
  padding: 5px 9px;
}

.btn-session-pwd:hover { background: rgba(31, 187, 110, .2); }

#modal-change-pwd {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, .7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

#modal-change-pwd[hidden] { display: none; }

.cpwd-box {
  background: #141c2e;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .6);
}

.cpwd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.cpwd-title {
  font-size: 1rem;
  font-weight: bold;
  color: #e2e8f0;
  margin: 0;
}

.cpwd-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, .5);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}

.cpwd-close:hover { color: #fff; }
.cpwd-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.cpwd-group { display: flex; flex-direction: column; gap: 5px; }

.cpwd-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(255, 255, 255, .5);
  font-weight: bold;
}

.cpwd-input {
  background: #172035;
  color: rgba(255, 255, 255, .9);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  padding: 11px 13px;
  font-size: .95rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.cpwd-input:focus {
  border-color: #1fbb6e;
  box-shadow: 0 0 0 3px rgba(31, 187, 110, .18);
}

.cpwd-strength {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .08);
  margin-top: 4px;
  overflow: hidden;
}

.cpwd-strength-bar {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  transition: width .2s, background .2s;
}

.cpwd-error {
  background: rgba(231, 76, 60, .15);
  border: 1px solid rgba(231, 76, 60, .4);
  border-radius: 6px;
  color: #ff8a80;
  font-size: .82rem;
  padding: 8px 12px;
  text-align: center;
  display: none;
}

.cpwd-success {
  background: rgba(31, 187, 110, .15);
  border: 1px solid rgba(31, 187, 110, .4);
  border-radius: 6px;
  color: #5dd3a0;
  font-size: .82rem;
  padding: 8px 12px;
  text-align: center;
  display: none;
}

.cpwd-footer { padding: 0 20px 20px; display: flex; gap: 10px; }

.cpwd-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: .9rem;
  font-weight: bold;
  cursor: pointer;
  transition: all .15s;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cpwd-btn-primary { background: #1fbb6e; color: #fff; }
.cpwd-btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.cpwd-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.cpwd-btn-ghost { background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .6); border: 1px solid rgba(255, 255, 255, .1); }
.cpwd-btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.cpwd-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cpwd-spin .7s linear infinite;
}

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

#auth-loading {
  position: fixed;
  inset: 0;
  background: var(--navy, #0a0e1a);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity .25s ease;
}

#auth-loading.auth-loading--closing { opacity: 0; }
.auth-loading__content { text-align: center; }

.auth-loading__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, .15);
  border-top-color: #1fbb6e;
  border-radius: 50%;
  animation: auth-spin .7s linear infinite;
  margin: 0 auto 12px;
}

.auth-loading__text {
  color: rgba(255, 255, 255, .5);
  font-size: .8rem;
  font-family: system-ui, sans-serif;
}

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

.session-expired-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: #1a2035;
  border: 1px solid rgba(231, 76, 60, .5);
  border-radius: 12px;
  padding: 12px 18px;
  max-width: 340px;
  width: calc(100% - 32px);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
  font-family: system-ui, sans-serif;
}

.session-expired-banner__icon { font-size: 1.1rem; }
.session-expired-banner__message { flex: 1; }
.session-expired-banner__title { font-size: .82rem; font-weight: 700; color: #ff8a80; margin-bottom: 2px; }
.session-expired-banner__detail { font-size: .75rem; color: rgba(255, 255, 255, .6); }

.session-expired-banner__link {
  font-size: .75rem;
  font-weight: 700;
  color: #ff8a80;
  text-decoration: none;
  background: rgba(231, 76, 60, .15);
  border: 1px solid rgba(231, 76, 60, .3);
  border-radius: 6px;
  padding: 5px 10px;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  #wp-global-loading .wp-global-loading__spinner { animation-duration: 1.8s; }
  #wp-global-loading { transition: none; }
  #auth-loading { transition: none; }
}

@media (max-width: 480px) {
  .session-bar { gap: 4px; min-width: 0; flex-wrap: nowrap; flex-shrink: 1; }
  .session-user { min-width: 0; max-width: 92px; padding: 3px 6px; gap: 3px; }
  .session-name { display: block; max-width: 58px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .session-icon { font-size: .78rem; flex: 0 0 auto; }
  .btn-session { min-height: 30px; padding: 4px 7px; font-size: .68rem; }
  .btn-session-pwd { width: 32px; padding: 4px; justify-content: center; }
}

@media (max-width: 340px) {
  .session-name { max-width: 38px; }
  .session-user { max-width: 68px; }
}
