/*
JobMee! profile editor layout hotfix
Place at: JobMee/static/profile_layout_fix.css
Load after styles.css.
*/

/* Prevent grid/flex children from shrinking around their textareas. */
#view-profile .wide-card,
#view-profile .voice-card,
#view-profile .resume-text-card,
#view-profile .resume-source-editor {
  min-width: 0;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

#view-profile .wide-card {
  grid-column: 1 / -1;
}

/* Writing voice editor: use the full card width. */
#view-profile .voice-card > #profileVoice,
#view-profile textarea#profileVoice {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: 190px;
  box-sizing: border-box !important;
  margin: 16px 0 0;
  padding: 20px 22px;
  border: 1px solid var(--app-line, rgba(20, 20, 20, 0.14));
  border-radius: 20px;
  background: var(--app-surface, rgba(255, 255, 255, 0.72));
  color: var(--app-text, #161616);
  font: inherit;
  font-size: 1rem;
  line-height: 1.65;
  resize: vertical;
  overflow: auto;
  outline: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

#view-profile textarea#profileVoice:focus {
  border-color: var(--accent, #c9ff2f);
  box-shadow: 0 0 0 4px rgba(201, 255, 47, 0.16);
}

/* Résumé editor shell and textarea: fill the whole panel. */
#view-profile .resume-source-editor {
  display: block !important;
  position: relative;
  overflow: hidden;
  min-height: clamp(30rem, 58vh, 46rem);
  margin-top: 12px;
  border: 1px solid var(--app-line, rgba(20, 20, 20, 0.14));
  border-radius: 22px;
  background:
    radial-gradient(circle at 10% 0%, rgba(201, 255, 47, 0.12), transparent 34%),
    var(--app-surface, rgba(255, 255, 255, 0.72));
}

#view-profile .resume-source-editor > #resumeText,
#view-profile textarea#resumeText {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: clamp(30rem, 58vh, 46rem);
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 24px 26px 88px;
  border: 0 !important;
  border-radius: 22px;
  background: transparent !important;
  color: var(--app-text, #161616);
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.98rem;
  line-height: 1.72;
  letter-spacing: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  resize: vertical;
  overflow: auto;
  outline: none;
  scrollbar-gutter: stable;
}

#view-profile .resume-source-editor:focus-within {
  border-color: var(--accent, #c9ff2f);
  box-shadow: 0 0 0 4px rgba(201, 255, 47, 0.16);
}

/* Keep the toolbar readable and properly spread across the card. */
#view-profile .resume-source-toolbar {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* The sticky save bar must not cover the bottom lines of the résumé. */
#view-profile .profile-grid,
#view-profile .profile-page,
#view-profile .view-content {
  min-width: 0;
}

#view-profile {
  padding-bottom: 120px;
}

/* Dark-mode surfaces. */
html[data-theme="dark"] #view-profile textarea#profileVoice,
html[data-theme="dark"] #view-profile .resume-source-editor {
  background:
    radial-gradient(circle at 10% 0%, rgba(201, 255, 47, 0.08), transparent 34%),
    rgba(255, 255, 255, 0.045);
}

html[data-theme="dark"] #view-profile textarea#profileVoice,
html[data-theme="dark"] #view-profile textarea#resumeText {
  color: #f5f5f1;
}

/* Tablet and mobile adjustments. */
@media (max-width: 900px) {
  #view-profile .voice-card > #profileVoice,
  #view-profile textarea#profileVoice {
    min-height: 170px;
    padding: 18px;
  }

  #view-profile .resume-source-editor,
  #view-profile .resume-source-editor > #resumeText,
  #view-profile textarea#resumeText {
    min-height: 34rem;
  }

  #view-profile .resume-source-editor > #resumeText,
  #view-profile textarea#resumeText {
    padding: 20px 18px 96px;
    font-size: 0.96rem;
  }
}

@media (max-width: 560px) {
  #view-profile .resume-source-toolbar {
    align-items: flex-start;
  }

  #view-profile .resume-source-toolbar small {
    width: 100%;
  }

  #view-profile .resume-source-editor,
  #view-profile .resume-source-editor > #resumeText,
  #view-profile textarea#resumeText {
    min-height: 30rem;
  }
}
