/* YOUMNA Portal — production UI on top of the demo's styles.css.
   Reuses the palette variables defined in styles.css (:root). */

.portal-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------------------
   Account menu (fixed top-right of the launcher)
   --------------------------------------------------------------------------- */
.account-menu {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  text-align: left;
}

.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 280px;
  padding: 8px 14px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(20, 20, 17, 0.82);
  backdrop-filter: blur(20px);
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 240ms var(--ease),
    background 240ms var(--ease),
    transform 240ms var(--ease);
}

.account-trigger:hover,
.account-menu.is-open .account-trigger {
  border-color: var(--line-strong);
  background: rgba(28, 28, 24, 0.92);
}

.account-trigger:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.account-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--lime);
  color: #1b1b16;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.account-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.account-id strong {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-id small {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-caret {
  flex: none;
  width: 8px;
  height: 8px;
  margin-left: 2px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 240ms var(--ease);
}

.account-menu.is-open .account-caret {
  transform: rotate(-135deg) translateY(-1px);
}

.account-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 280px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(18, 18, 15, 0.96);
  backdrop-filter: blur(26px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.account-panel[hidden] {
  display: none;
}

.account-panel-head {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.account-panel-head strong {
  font-size: 14px;
  font-weight: 700;
}

.account-panel-head small {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.account-role {
  justify-self: start;
  margin-top: 4px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lime);
}

.account-apps {
  display: grid;
  gap: 8px;
}

.account-apps-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.account-apps ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.account-apps li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
}

.account-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.account-logout {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 220ms var(--ease),
    background 220ms var(--ease);
}

.account-logout:hover {
  border-color: var(--lime);
  background: rgba(222, 255, 61, 0.08);
}

.account-logout:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   Full-screen states: loading / error / no-access
   --------------------------------------------------------------------------- */
.portal-state {
  display: block;
}

.portal-state-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  padding: 24px;
  overflow: hidden;
}

.portal-state-card {
  position: relative;
  z-index: 2;
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(28px);
  box-shadow: var(--shadow);
  text-align: center;
}

.portal-state-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.portal-state-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portal-state-eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--lime);
}

.portal-state-card h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.portal-state-note {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 42ch;
}

.portal-state-note strong {
  color: var(--text);
}

.portal-state-sub {
  font-size: 13.5px;
}

.portal-state-note a {
  color: var(--lime);
  text-decoration: none;
  border-bottom: 1px solid rgba(222, 255, 61, 0.4);
}

.portal-state-note a:hover {
  border-bottom-color: var(--lime);
}

.portal-primary-button,
.portal-ghost-button {
  margin-top: 6px;
  padding: 12px 26px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 220ms var(--ease),
    background 220ms var(--ease),
    border-color 220ms var(--ease);
}

.portal-primary-button {
  border: 1px solid var(--lime);
  background: var(--lime);
  color: #1b1b16;
}

.portal-primary-button:hover {
  transform: translateY(-1px);
}

.portal-ghost-button {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
}

.portal-ghost-button:hover {
  border-color: var(--lime);
  background: rgba(222, 255, 61, 0.06);
}

.portal-primary-button:focus-visible,
.portal-ghost-button:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

/* Spinner */
.portal-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(244, 244, 239, 0.18);
  border-top-color: var(--lime);
  animation: portal-spin 0.9s linear infinite;
}

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

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 620px) {
  .account-menu {
    top: 12px;
    right: 12px;
  }

  .account-id {
    display: none;
  }

  .account-trigger {
    padding: 6px;
    gap: 0;
  }

  .account-panel {
    width: min(86vw, 300px);
  }

  .portal-state-card {
    padding: 32px 22px;
  }

  .portal-state-card h1 {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-spinner {
    animation-duration: 2.4s;
  }

  .account-trigger,
  .account-caret,
  .portal-primary-button,
  .portal-ghost-button,
  .account-logout {
    transition: none;
  }
}
