/*
   UNIMAP — Responsive Account/Profile styles
   This file is loaded AFTER shared.css, so these profile rules
   intentionally override the older profile rules in shared.css.
*/

.auth-page,
.account-page,
.profile-page {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.auth-shell,
.account-card,
.profile-info-card {
  background: var(--surface, #101722);
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(0,0,0,.18);
}

.auth-shell {
  width: min(100%, 520px);
  margin: 28px auto;
  padding: 28px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-brand img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
  margin: 0 auto 14px;
}

.auth-title,
.account-title,
.profile-name {
  margin: 0;
  color: var(--text, #fff);
}

.auth-subtitle,
.account-subtitle,
.profile-email {
  margin: 8px 0 0;
  color: var(--muted, #9aa6b2);
}

.auth-form,
.account-form {
  display: grid;
  gap: 16px;
}

.auth-form .field,
.account-form .field {
  display: grid;
  gap: 7px;
}

.auth-form label,
.account-form label {
  color: var(--text, #fff);
  font-size: .92rem;
  font-weight: 600;
}

.auth-form input,
.auth-form select,
.auth-form textarea,
.account-form input,
.account-form select,
.account-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border, rgba(255,255,255,.10));
  border-radius: 12px;
  background: var(--input-bg, #0b111a);
  color: var(--text, #fff);
  padding: 12px 13px;
  outline: none;
  font: inherit;
}

.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus,
.account-form input:focus,
.account-form select:focus,
.account-form textarea:focus {
  border-color: var(--accent, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59,130,246,.14);
}

.auth-actions,
.account-actions,
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.primary-btn,
.secondary-btn,
.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-sizing: border-box;
}

.primary-btn,
.auth-submit {
  background: var(--accent, #3b82f6);
  color: #fff;
}

.secondary-btn {
  background: transparent;
  color: var(--text, #fff);
  border-color: var(--border, rgba(255,255,255,.12));
}

.auth-footer,
.account-footer {
  margin-top: 18px;
  text-align: center;
  color: var(--muted, #9aa6b2);
  font-size: .9rem;
}

.auth-footer a,
.account-footer a {
  color: var(--accent, #60a5fa);
  text-decoration: none;
}

.form-errors,
.errorlist {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  color: #fecaca;
  background: rgba(239,68,68,.10);
  border: 1px solid rgba(239,68,68,.18);
  list-style: none;
}

/* =========================================================
   PROFILE — DESKTOP/TABLET
  
   ========================================================= */

.profile-page {
  width: min(100%, 920px);
  max-width: 920px;
  padding: 28px 18px 96px;
}

.profile-hero {
  width: 100%;
  min-width: 0;
  display: grid !important;
  grid-template-columns: 108px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 20px;
  row-gap: 4px;
  align-items: center;
  padding: 24px !important;
  text-align: left !important;
  box-sizing: border-box;
  overflow: hidden;
}

.profile-avatar-large,
.profile-initials-large {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 108px !important;
  height: 108px !important;
  min-width: 108px;
  min-height: 108px;
  margin: 0 !important;
  border-radius: 50%;
  box-sizing: border-box;
}

.profile-avatar-large {
  display: block;
  object-fit: cover;
  overflow: hidden;
  border: 3px solid rgba(36,137,255,.35);
}

.profile-initials-large {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2489ff, #1456a3);
  color: #fff;
  font-size: 32px;
  font-weight: 800;
}

.profile-name {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.15;
}

.profile-email {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  max-width: 100%;
  margin: 0 !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.4;
  font-size: 13px;
}

.profile-role {
  grid-column: 3;
  grid-row: 1 / span 2;
  justify-self: end;
  align-self: center;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  margin: 0 !important;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(36,137,255,.1);
  border: 1px solid rgba(36,137,255,.18);
  color: #66adff;
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.profile-info-card {
  width: 100%;
  min-width: 0;
  margin-top: 15px;
  padding: 21px;
  box-sizing: border-box;
  overflow: hidden;
}

.profile-info-title {
  margin-bottom: 18px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.profile-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
}

.profile-info-item {
  min-width: 0;
  min-height: 82px;
  padding: 15px;
  background: var(--unimap-card-2, var(--surface-2));
}

.profile-info-item strong {
  display: block;
  margin-bottom: 7px;
  color: #728198;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.profile-info-item span {
  display: block;
  min-width: 0;
  color: #eef2f7;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.profile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.profile-actions .secondary-btn {
  width: 100%;
}

/* =========================================================
   PROFILE — SMALL PHONES
   Designed for 320–480px widths.
   ========================================================= */

@media (max-width: 600px) {
  .auth-page,
  .account-page,
  .profile-page {
    width: 100%;
    max-width: none;
    padding: 18px 12px 94px;
  }

  .auth-shell {
    padding: 22px 18px;
    margin-top: 14px;
  }

  .profile-hero {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto auto !important;
    justify-items: center;
    column-gap: 0;
    row-gap: 7px;
    padding: 22px 16px 24px !important;
    text-align: center !important;
    border-radius: 20px;
  }

  .profile-avatar-large,
  .profile-initials-large {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 96px !important;
    height: 96px !important;
    min-width: 96px;
    min-height: 96px;
    margin: 0 0 6px !important;
  }

  .profile-name {
    grid-column: 1 !important;
    grid-row: 2 !important;
    width: 100%;
    max-width: 100%;
    font-size: 23px;
    line-height: 1.18;
    text-align: center;
    overflow-wrap: anywhere;
  }

  .profile-email {
    grid-column: 1 !important;
    grid-row: 3 !important;
    width: 100%;
    max-width: 100%;
    padding: 0 4px;
    text-align: center;
    font-size: 12px;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .profile-role {
    grid-column: 1 !important;
    grid-row: 4 !important;
    justify-self: center;
    align-self: center;
    margin-top: 3px !important;
  }

  .profile-info-card {
    padding: 16px;
    border-radius: 18px;
  }

  .profile-info-title {
    margin-bottom: 13px;
    font-size: 15px;
  }

  .profile-info-grid {
    grid-template-columns: 1fr;
    gap: 1px;
  }

  .profile-info-item {
    min-height: 0;
    padding: 13px;
  }

  .profile-info-item span {
    font-size: 13px;
  }

  .profile-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .primary-btn,
  .secondary-btn,
  .auth-submit {
    width: 100%;
  }
}

/* Extra-small phones: keep the profile card comfortable at 320px. */
@media (max-width: 360px) {
  .profile-page {
    padding-left: 9px;
    padding-right: 9px;
  }

  .profile-hero {
    padding-left: 13px !important;
    padding-right: 13px !important;
  }

  .profile-avatar-large,
  .profile-initials-large {
    width: 88px !important;
    height: 88px !important;
    min-width: 88px;
    min-height: 88px;
  }

  .profile-name {
    font-size: 21px;
  }

  .profile-email {
    font-size: 11.5px;
  }
}

/* Profile picture viewer */
.profile-avatar-button {
  display:block;
  padding:0;
  margin:0;
  border:0;
  background:transparent;
  border-radius:50%;
  cursor:zoom-in;
  line-height:0;
  overflow:hidden;
}
.profile-avatar-button:focus-visible {
  outline:2px solid #4d9aff;
  outline-offset:4px;
}
.profile-picture-viewer-open { overflow:hidden; }
.profile-picture-viewer {
  position:fixed;
  inset:0;
  z-index:1200;
  display:grid;
  place-items:center;
  padding:18px;
}
.profile-picture-viewer-backdrop {
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.82);
  backdrop-filter:blur(8px);
}
.profile-picture-viewer-panel {
  position:relative;
  width:min(520px,100%);
  max-height:90vh;
  padding:22px;
  border:1px solid rgba(255,255,255,.1);
  border-radius:22px;
  background:#0b1625;
  box-shadow:0 30px 90px rgba(0,0,0,.55);
  text-align:center;
}
.profile-picture-viewer-panel > img {
  display:block;
  width:min(430px,100%);
  max-height:72vh;
  margin:0 auto;
  object-fit:contain;
  border-radius:16px;
}
.profile-picture-viewer-panel h2 {
  margin:14px 0 0;
  font-size:17px;
}
.profile-picture-viewer-close {
  position:absolute;
  top:12px;
  right:12px;
  z-index:2;
  width:36px;
  height:36px;
  border:1px solid rgba(255,255,255,.1);
  border-radius:11px;
  background:rgba(0,0,0,.3);
  color:#fff;
  font-size:23px;
  cursor:pointer;
}
.profile-picture-viewer-initials {
  width:min(260px,70vw);
  aspect-ratio:1;
  margin:0 auto;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg,#2489ff,#1456a3);
  color:#fff;
  font-size:60px;
  font-weight:800;
}
@media (max-width:600px) {
  .profile-picture-viewer { padding:10px; }
  .profile-picture-viewer-panel { padding:18px 14px 20px; border-radius:20px; }
  .profile-picture-viewer-panel > img { max-height:70vh; border-radius:13px; }
}


/* Profile account/support menu: explicit styling so links render as cards/buttons. */
.profile-menu-section {
  display: block;
  margin: 28px 0 12px;
}
.profile-menu-section h2 {
  margin: 0 0 14px;
  color: var(--text, #f4f7fb);
  font-size: 18px;
  font-weight: 800;
}
.profile-menu-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.profile-menu-links > a.profile-menu-link {
  display: flex !important;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 70px;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 16px;
  background: var(--surface, #101722);
  color: var(--text, #f4f7fb) !important;
  text-decoration: none !important;
  text-align: left;
  box-shadow: 0 8px 22px rgba(0,0,0,.12);
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.profile-menu-links > a.profile-menu-link:hover,
.profile-menu-links > a.profile-menu-link:focus-visible {
  border-color: rgba(59,130,246,.65);
  background: var(--surface-2, #152236);
  color: var(--text, #fff) !important;
  text-decoration: none !important;
}
.profile-menu-links > a.profile-menu-link:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 3px;
}
.profile-menu-symbol {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  flex: 0 0 42px;
  border-radius: 13px;
  background: rgba(59,130,246,.13);
  color: #75b4ff;
  font-size: 21px;
}
.profile-menu-links > a.profile-menu-link > span:nth-child(2) {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.profile-menu-links > a.profile-menu-link strong {
  display: block;
  color: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
}
.profile-menu-links > a.profile-menu-link small {
  display: block;
  color: var(--muted, #9aa8ba);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}
.profile-menu-arrow {
  margin-left: auto;
  padding-left: 8px;
  color: var(--muted, #9aa8ba);
  font-size: 26px;
  line-height: 1;
}
.profile-menu-links > a.profile-menu-logout {
  border-color: rgba(255,92,92,.25);
}
.profile-menu-links > a.profile-menu-logout .profile-menu-symbol {
  background: rgba(255,92,92,.10);
  color: #ff8585;
}
.profile-menu-links > a.profile-menu-logout strong {
  color: #ff8585;
}
@media (max-width: 600px) {
  .profile-menu-section { margin-top: 24px; }
  .profile-menu-links { gap: 9px; }
  .profile-menu-links > a.profile-menu-link { min-height: 66px; padding: 12px 13px; }
}
