/* Pilot profile — wide engaging layout (matches logbook width on desktop) */

.rcs-profile-page .rcs-pilot-wrap {
  max-width: min(1320px, calc(100vw - 32px));
  z-index: 5;
}

.rcs-profile-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rcs-profile-hero {
  overflow: hidden;
}

.rcs-profile-hero-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px 28px;
  align-items: center;
}

.rcs-profile-avatar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.rcs-profile-avatar-ring {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 16%;
  padding: 4px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.85), rgba(59, 130, 246, 0.75));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.rcs-profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 16%;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.12);
  border: 3px solid rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  position: relative;
}

.rcs-profile-avatar-initials {
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  color: inherit;
}

.rcs-profile-avatar img,
.rcs-profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rcs-profile-avatar-img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.rcs-profile-avatar-img.is-ready {
  opacity: 1;
}

.rcs-profile-avatar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.rcs-profile-avatar-actions .rcs-btn {
  font-size: 12px;
  padding: 6px 10px;
}

.rcs-profile-hero-meta h2 {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  line-height: 1.2;
  color: var(--rcs-muted, #9ca3af);
  text-transform: none;
  letter-spacing: normal;
}

.rcs-profile-hero-line {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--rcs-muted, #64748b);
}

.rcs-profile-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
}

.rcs-profile-hero-billing {
  margin: 12px 0 0;
}

.rcs-profile-hero-meta .rcs-billing-flash {
  margin: 8px 0 0;
}

.rcs-profile-stat {
  font-size: 13px;
  color: var(--rcs-muted, #64748b);
}

.rcs-profile-stat strong {
  color: var(--rcs-text);
  font-weight: 600;
}

.rcs-profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px;
  align-items: start;
}

.rcs-profile-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.rcs-profile-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.rcs-profile-card-head h2 {
  margin: 0;
}

.rcs-prefs-save-hint {
  font-size: 12px;
  color: #16a34a;
  min-height: 1.2em;
  margin: 0 0 8px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.rcs-prefs-save-hint.visible {
  opacity: 1;
}

.rcs-prefs-save-hint.error {
  color: #dc2626;
}

.rcs-profile-page .rcs-preset-row {
  margin-top: 16px;
}

.rcs-profile-page .rcs-discipline-fieldset {
  margin-top: 16px;
}

.rcs-discipline-fieldset legend {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}

.rcs-discipline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px 12px;
}

.rcs-discipline-other-wrap {
  margin-top: 10px;
}

.rcs-discipline-other-wrap[hidden] {
  display: none !important;
}

.rcs-birth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.rcs-birth-row label small {
  display: block;
  font-weight: 400;
  color: var(--rcs-muted, #64748b);
  font-size: 12px;
  margin-top: 2px;
}

.rcs-profile-field {
  margin-top: 10px;
}

.rcs-profile-field-label {
  display: block;
  font-size: 12px;
  color: var(--rcs-muted, #64748b);
  margin: 0 0 4px;
}

.rcs-pilot-page .rcs-profile-check-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--rcs-border);
  background: var(--rcs-input-bg);
  color: var(--rcs-text);
  box-sizing: border-box;
  cursor: pointer;
  font-weight: 400;
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

.rcs-pilot-page .rcs-profile-check-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--rcs-accent, #dc2626);
  cursor: pointer;
}

.rcs-profile-check-field__text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.4;
}

.rcs-profile-field-hint {
  margin: 6px 0 0;
}

.rcs-profile-field--check:has(input:disabled) .rcs-profile-check-field {
  opacity: 0.72;
  cursor: not-allowed;
}

.rcs-profile-field--check:has(input:disabled) .rcs-profile-check-field input {
  cursor: not-allowed;
}

/* Avatar crop modal */
.rcs-avatar-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.rcs-avatar-modal[hidden] {
  display: none !important;
}

.rcs-avatar-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}

.rcs-avatar-modal-panel {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  background: var(--rcs-card-bg, rgba(255, 255, 255, 0.96));
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

.rcs-avatar-modal-panel h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.rcs-avatar-modal-panel .rcs-hint {
  margin: 0 0 14px;
}

.rcs-avatar-crop-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 16%;
  overflow: hidden;
  background: #0f172a;
  margin: 0 auto 16px;
  max-width: 280px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15);
  touch-action: none;
  user-select: none;
  cursor: default;
}

.rcs-avatar-crop-stage.is-pannable {
  cursor: grab;
}

.rcs-avatar-crop-stage.is-panning {
  cursor: grabbing;
}

.rcs-avatar-crop-img {
  position: absolute;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  pointer-events: none;
  user-select: none;
}

.rcs-avatar-crop-ring {
  position: absolute;
  inset: 0;
  border-radius: 16%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.rcs-avatar-slider-row {
  margin-bottom: 12px;
}

.rcs-avatar-slider-row label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.rcs-avatar-slider-row input[type="range"] {
  width: 100%;
}

.rcs-avatar-slider-row:has(input:disabled) {
  opacity: 0.42;
}

.rcs-avatar-rotate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.rcs-avatar-rotate-btns {
  display: flex;
  gap: 8px;
}

.rcs-avatar-rotate-btns .rcs-btn {
  min-width: 2.5rem;
  font-size: 1.15rem;
  line-height: 1;
  padding: 6px 10px;
}

.rcs-avatar-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

html[data-rcs-theme="dark"] .rcs-avatar-modal-panel {
  background: rgba(17, 24, 39, 0.96);
}

html[data-rcs-theme="dark"] .rcs-profile-avatar {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.5);
}

@media (max-width: 960px) {
  .rcs-profile-grid {
    grid-template-columns: 1fr;
  }

  .rcs-profile-hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .rcs-profile-hero-stats {
    justify-content: center;
  }
}

@media (max-width: 520px) {
  .rcs-profile-page .rcs-pilot-wrap {
    padding-left: 12px;
    padding-right: 12px;
  }

  .rcs-birth-row {
    grid-template-columns: 1fr;
  }

  .rcs-discipline-grid {
    grid-template-columns: 1fr 1fr;
  }

  .rcs-profile-avatar-ring {
    width: 100px;
    height: 100px;
  }
}

/* Mobile web + app: after scroll, drop the sticky hint so only the Save button remains. PC unchanged. */
@media (max-width: 899px) {
  .rcs-profile-page .rcs-dirty-save.is-scrolled {
    width: max-content;
    max-width: calc(100% - 8px);
    margin-left: auto;
    padding: 8px 10px;
    border-radius: 999px;
  }

  .rcs-profile-page .rcs-dirty-save.is-scrolled .rcs-dirty-save__copy {
    display: none;
  }

  .rcs-profile-page .rcs-dirty-save.is-scrolled .rcs-dirty-save__row {
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 8px;
  }

  .rcs-profile-page .rcs-dirty-save.is-scrolled .rcs-dirty-save__actions .rcs-status {
    display: none;
  }
}

html.rcs-client-app .rcs-profile-page .rcs-dirty-save.is-scrolled,
body.rcs-footer-embed .rcs-profile-page .rcs-dirty-save.is-scrolled {
  width: max-content;
  max-width: calc(100% - 8px);
  margin-left: auto;
  padding: 8px 10px;
  border-radius: 999px;
}

html.rcs-client-app .rcs-profile-page .rcs-dirty-save.is-scrolled .rcs-dirty-save__copy,
body.rcs-footer-embed .rcs-profile-page .rcs-dirty-save.is-scrolled .rcs-dirty-save__copy {
  display: none;
}

html.rcs-client-app .rcs-profile-page .rcs-dirty-save.is-scrolled .rcs-dirty-save__row,
body.rcs-footer-embed .rcs-profile-page .rcs-dirty-save.is-scrolled .rcs-dirty-save__row {
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 8px;
}

html.rcs-client-app .rcs-profile-page .rcs-dirty-save.is-scrolled .rcs-dirty-save__actions .rcs-status,
body.rcs-footer-embed .rcs-profile-page .rcs-dirty-save.is-scrolled .rcs-dirty-save__actions .rcs-status {
  display: none;
}
