/*
 * An existing record's fields, read-only and gray until ✎ Edit (record-edit-lock.js).
 */

/* The heading a section's Edit button sits in: title on the left, button on the right. */
.rel-lock__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}

.rel-lock__bar {
  margin-left: auto;
  display: inline-flex;
}

.rel-lock__edit {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--primary, #1A2D5A);
  border-radius: 999px;
  background: var(--card, #fff);
  color: var(--primary, #1A2D5A);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

.rel-lock__edit:hover,
.rel-lock__edit:focus-visible {
  background: var(--primary, #1A2D5A);
  color: #fff;
}

.rel-lock--editing .rel-lock__edit {
  border-color: var(--muted, #6F7E9D);
  color: var(--text2, #2E3E63);
}

.rel-lock--editing .rel-lock__edit:hover {
  background: var(--muted, #6F7E9D);
  color: #fff;
}

/* Locked: gray, and plainly not a box to type in. */
.rel-lock--locked input[data-rel-locked],
.rel-lock--locked select[data-rel-locked],
.rel-lock--locked textarea[data-rel-locked] {
  background: #eef1f6 !important;
  color: var(--text2, #2E3E63) !important;
  border-color: #d9dee8 !important;
  cursor: not-allowed;
  opacity: 1;
  -webkit-text-fill-color: var(--text2, #2E3E63);
}

/* A native dropdown paints itself white whatever its background says, and its arrow
   invites a click that does nothing. Locked, it is drawn as plain text in a box. */
.rel-lock--locked select[data-rel-locked] {
  -webkit-appearance: none;
  appearance: none;
  background-image: none !important;
}

/* Being edited: the section says so. */
.rel-lock--editing {
  box-shadow: 0 0 0 2px rgba(26, 45, 90, .18);
  border-radius: 12px;
}

.rel-lock__note {
  margin: .35rem 0 .75rem;
  padding: 8px 12px;
  border-left: 3px solid var(--primary, #1A2D5A);
  border-radius: 6px;
  background: rgba(26, 45, 90, .05);
  color: var(--text2, #2E3E63);
  font-size: 13px;
  line-height: 1.5;
}

/* --- Locked, a section reads as a list ----------------------------------------
   Label above value, in columns that fold to two on a phone; a long value (an
   address) takes the whole row. The field boxes are hidden, not removed. */
.rel-hidden {
  display: none !important;
}

/* 140px: a half-width card holds two or three details a row, a full-width one four
   to six. At 200px a card on a laptop screen held one, and each detail took a row. */
.rel-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0 1rem;
  margin: 0 0 .25rem;
  padding: 0;
}

.rel-view__item {
  min-width: 0;
  padding: .35rem 0 .4rem;
  border-bottom: 1px solid rgba(26, 45, 90, .06);
}

.rel-view__item--wide {
  grid-column: 1 / -1;
}

.rel-view__label {
  margin: 0 0 .1rem;
  color: var(--muted, #6F7E9D);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: .01em;
}

.rel-view__value {
  margin: 0;
  color: var(--text, #0D1B3E);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* In a section's header the button is a tag beside the title, not a second title. */
.profile-section-card__head .rel-lock__edit,
.profile-account-card .card-title .rel-lock__edit {
  min-height: 28px;
  padding: 3px 11px;
  font-size: 12px;
}

.rel-view__value--empty {
  color: var(--muted, #6F7E9D);
  font-weight: 400;
  font-style: italic;
}

@media (max-width: 640px) {
  .rel-view {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 .9rem;
  }
}

button[data-rel-locked][disabled] {
  opacity: .55;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .rel-lock__edit {
    min-height: 36px;
    padding: 6px 14px;
  }

  /* A section with a subtitle ("Upload PAN, Aadhaar, …") pushed ✎ Edit onto a row
     of its own under it. The button takes the corner beside the title instead, and
     the subtitle the full width below both. */
  .profile-section-card__head.rel-lock__heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: .5rem;
  }

  .profile-section-card__head.rel-lock__heading > .rel-lock__bar {
    grid-column: 2;
    grid-row: 1;
    margin-left: 0;
  }

  .profile-section-card__head.rel-lock__heading > .profile-section-card__subtitle {
    grid-column: 1 / -1;
  }
}
