/* ==========================================================================
   profile.css — Profil użytkownika
   ========================================================================== */

:root {
  --category-content-max: var(--category-nav-max, 1400px);
}

.profile-page {
  width: 100%;
}

html:not([data-device="phone"]) .site-main:has(.profile-page) {
  width: min(calc(100% - 2 * var(--page-gutter)), var(--category-content-max, 1400px));
  max-width: var(--category-content-max, 1400px);
  margin-inline: auto;
  padding-top: var(--space-24);
  padding-inline: 0;
}

.profile-page__head {
  margin-bottom: var(--space-20);
}

.profile-page__title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: var(--fw-700);
  line-height: 1.2;
  color: var(--fg);
}

.profile-page__state {
  margin: 0;
  padding: var(--space-16);
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  background: var(--surface-1);
  color: var(--muted);
  font-size: var(--fs-14);
  line-height: 1.45;
  text-align: center;
}

html[data-theme="dark"] .profile-page__state {
  background: #1f1f1f;
  border-color: rgba(255, 255, 255, 0.12);
}

.profile-page__state[hidden],
.profile-page__grid[hidden],
.profile-password[hidden],
.profile-sub__trial[hidden] {
  display: none !important;
}

.profile-page__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.75fr);
  gap: var(--space-16);
  align-items: start;
}

.profile-card {
  padding: var(--space-20);
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  background: var(--surface-1);
}

html[data-theme="dark"] .profile-card {
  background: #1f1f1f;
  border-color: rgba(255, 255, 255, 0.12);
}

.profile-card--plan {
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, #ff5f5f 18%, transparent), transparent 55%),
    var(--surface-1);
}

html[data-theme="dark"] .profile-card--plan {
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, #ff5f5f 22%, transparent), transparent 55%),
    #1f1f1f;
}

.profile-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--space-16);
}

.profile-card__title {
  margin: 0 0 var(--space-16);
  font-size: var(--fs-14);
  font-weight: var(--fw-700);
}

.profile-card__title--inline {
  margin: 0;
}

.profile-password {
  margin-top: var(--space-20);
  padding-top: var(--space-18, 18px);
  border-top: 1px solid color-mix(in srgb, var(--fg) 10%, transparent);
}

.profile-password__title {
  margin: 0 0 var(--space-14);
  font-size: var(--fs-14);
  font-weight: var(--fw-700);
}

.profile-card__identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: var(--space-16);
}

.profile-card__identity-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 1 auto;
  min-width: 0;
}

.profile-card__avatar-wrap {
  display: flex;
  flex: 0 0 auto;
  margin-bottom: 0;
}

.profile-meta--beside-avatar {
  min-width: 0;
  flex: 0 1 auto;
}

.profile-meta--beside-avatar .profile-meta__row {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  font-size: var(--fs-13);
  color: var(--fg);
}

.profile-meta--beside-avatar .profile-meta__row strong {
  text-align: left;
  font-weight: var(--fw-700);
}

.profile-card__identity > .profile-field--identity {
  flex: 0 1 360px;
  width: min(360px, 100%);
  margin: 0 0 0 auto;
  min-width: 0;
}

.profile-field.profile-field--spaced.profile-field--identity {
  margin-bottom: 0;
}

.profile-card__avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ff5f5f;
  color: #fff;
  overflow: hidden;
}

.profile-card__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-card__photo[hidden] {
  display: none !important;
}

.profile-card__initial {
  font-size: 1.5rem;
  font-weight: var(--fw-700);
  line-height: 1;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-14);
}

.profile-field:last-of-type {
  margin-bottom: 0;
}

.profile-field.profile-field--spaced {
  margin-bottom: var(--space-16);
}

.profile-security-form {
  max-width: none;
}

.profile-security-form .profile-field {
  margin-bottom: var(--space-14);
}

.profile-security-form .profile-field:last-of-type {
  margin-bottom: var(--space-8);
}

.profile-field__control {
  position: relative;
}

.profile-field__control .profile-field__input {
  width: 100%;
  padding-right: 44px;
}

.profile-eye {
  position: absolute;
  top: 50%;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
  cursor: pointer;
}

.profile-eye:hover,
.profile-eye:focus,
.profile-eye:focus-visible {
  outline: none;
  box-shadow: none;
  color: var(--fg);
  background: transparent;
}

.profile-field__label {
  font-size: 11px;
  font-weight: var(--fw-600);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.profile-field__row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.profile-field__input,
.profile-field__readonly {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: color-mix(in srgb, var(--fg) 6%, var(--surface-1));
  color: var(--fg);
  font: inherit;
  font-size: var(--fs-14);
  box-shadow: none;
}

html[data-theme="dark"] .profile-field__input,
html[data-theme="dark"] .profile-field__readonly {
  background: #181818;
  border-color: transparent;
}

.profile-field__input:hover {
  outline: none;
  box-shadow: none;
  border-color: transparent;
}

.profile-field__input:focus,
.profile-field__input:focus-visible {
  outline: none;
  box-shadow: none;
  border-color: color-mix(in srgb, var(--fg) 55%, transparent);
}

html[data-theme="dark"] .profile-field__input:focus,
html[data-theme="dark"] .profile-field__input:focus-visible {
  border-color: rgba(255, 255, 255, 0.55);
}

.profile-field__input:-webkit-autofill,
.profile-field__input:-webkit-autofill:hover,
.profile-field__input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--fg);
  transition: background-color 99999s ease-out;
  box-shadow: 0 0 0 1000px color-mix(in srgb, var(--fg) 6%, var(--surface-1)) inset;
  border: 1px solid transparent;
}

html[data-theme="dark"] .profile-field__input:-webkit-autofill,
html[data-theme="dark"] .profile-field__input:-webkit-autofill:hover,
html[data-theme="dark"] .profile-field__input:-webkit-autofill:focus {
  box-shadow: 0 0 0 1000px #181818 inset;
}

.profile-field__save-icon {
  display: none;
}

.profile-field__save {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: #ff5f5f;
  color: #fff;
  font: inherit;
  font-size: var(--fs-13);
  font-weight: var(--fw-600);
  cursor: pointer;
  white-space: nowrap;
}

.profile-field__save--block {
  width: 100%;
  margin-top: var(--space-8);
}

.profile-field__save:disabled {
  opacity: 0.65;
  cursor: default;
}

.profile-field__save:focus-visible {
  outline: none;
  box-shadow: none;
}

.profile-field__readonly {
  margin: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-meta {
  margin-top: var(--space-16);
  padding-top: var(--space-14);
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-meta.profile-meta--beside-avatar {
  margin: 0;
  padding: 0;
  border: none;
  border-top: none;
  gap: 0;
}

.profile-meta__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--fs-13);
  color: var(--muted);
}

.profile-meta__row strong {
  font-weight: var(--fw-600);
  color: var(--fg);
  text-align: right;
}

.profile-card__status {
  margin: var(--space-12) 0 0;
  font-size: var(--fs-12);
  color: var(--muted);
}

.profile-card__status[hidden] {
  display: none !important;
}

.profile-card__status.is-ok {
  color: #66bb6a;
}

.profile-card__status.is-error {
  color: #ff5f5f;
}

.profile-sub {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.profile-sub__badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 26px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, #ff5f5f 16%, transparent);
  color: #ff5f5f;
  font-size: 12px;
  font-weight: var(--fw-700);
  letter-spacing: 0.02em;
}

.profile-sub__badge.is-free {
  background: color-mix(in srgb, var(--muted) 16%, transparent);
  color: var(--muted);
}

.profile-sub__status {
  margin: 0;
  font-size: var(--fs-13);
  line-height: 1.4;
  color: var(--muted);
}

.profile-sub__trial {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--fg) 4%, transparent);
}

.profile-sub__trial-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--fs-12);
  color: var(--muted);
}

.profile-sub__trial-head strong {
  font-size: var(--fs-13);
  font-weight: var(--fw-600);
  color: var(--fg);
}

.profile-sub__trial-note {
  margin: 0;
  font-size: var(--fs-12);
  line-height: 1.4;
  color: var(--muted);
}

.profile-sub__trial-note[hidden] {
  display: none !important;
}

.profile-sub__bar {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fg) 10%, transparent);
  overflow: hidden;
}

.profile-sub__bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff5f5f, #ff8a7a);
  transition: width 0.35s ease;
}

.profile-sub__perks {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-sub__perks li {
  position: relative;
  padding-left: 22px;
  font-size: var(--fs-13);
  line-height: 1.4;
  color: var(--fg);
}

.profile-sub__perks li::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 0.4em;
  width: 7px;
  height: 4px;
  border-left: 2px solid #ff5f5f;
  border-bottom: 2px solid #ff5f5f;
  transform: rotate(-45deg);
}

.profile-sub__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--space-16);
  border-radius: var(--radius-pill);
  background: #ff5f5f;
  color: #fff;
  text-decoration: none;
  font-size: var(--fs-14);
  font-weight: var(--fw-600);
  text-align: center;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.profile-sub__cta:hover {
  filter: brightness(1.05);
}

.profile-sub__cta:focus-visible {
  outline: none;
  box-shadow: none;
}

.profile-sub__cta.is-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}

.profile-sub__cta[hidden] {
  display: none !important;
}

.profile-login-cta {
  display: inline-flex;
  margin-top: var(--space-14);
  min-height: 40px;
  align-items: center;
  padding: 0 var(--space-16);
  border-radius: var(--radius-pill);
  background: #ff5f5f;
  color: #fff;
  text-decoration: none;
  font-size: var(--fs-14);
  font-weight: var(--fw-600);
}

@media (max-width: 720px) {
  .profile-page__grid {
    grid-template-columns: 1fr;
  }

  .profile-card__identity {
    flex-wrap: wrap;
  }

  .profile-card__identity-left {
    flex: 1 1 auto;
  }

  .profile-card__identity > .profile-field--identity {
    flex: 1 1 100%;
    width: 100%;
    margin-left: 0;
  }

  .profile-field__row {
    flex-wrap: wrap;
  }

  .profile-field__save:not(.profile-field__save--block) {
    width: 100%;
  }
}

html[data-device="phone"] .profile-field--identity .profile-field__row,
html[data-device="phone"] .profile-share .profile-field__row {
  flex-wrap: nowrap;
}

html[data-device="phone"] .profile-field--identity .profile-field__save,
html[data-device="phone"] .profile-share .profile-field__save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 10px;
}

html[data-device="phone"] .profile-field--identity .profile-field__save-icon,
html[data-device="phone"] .profile-share .profile-field__save-icon {
  display: block;
  font-size: 14px;
  line-height: 1;
}

html[data-device="phone"] .profile-field--identity .profile-field__save-label,
html[data-device="phone"] .profile-share .profile-field__save-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.profile-visibility-inline {
  min-width: 0;
  margin: 16px 0 0;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--border);
}

html[data-theme="dark"] .profile-visibility-inline {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.profile-visibility-inline .profile-toggle {
  margin-bottom: 10px;
}

.profile-visibility-inline .profile-share {
  margin-top: 2px;
}

.profile-field--email {
  margin-top: 16px;
  margin-bottom: 0;
}

.profile-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  margin-bottom: 14px;
  position: relative;
  user-select: none;
}

.profile-toggle__input {
  position: absolute;
  width: 44px;
  height: 26px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  top: 2px;
  left: 0;
}

.profile-toggle__ui {
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fg) 18%, transparent);
  position: relative;
  transition: background-color 0.18s ease;
  margin-top: 2px;
  pointer-events: none;
}

.profile-toggle__ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}

.profile-toggle__input:checked + .profile-toggle__ui {
  background: #2e7d32;
}

.profile-toggle__input:checked + .profile-toggle__ui::after {
  transform: translateX(18px);
}

.profile-toggle__text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.profile-toggle__text strong {
  font-size: var(--fs-14);
}

.profile-toggle__hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.profile-share {
  display: grid;
  gap: 6px;
}
