/* 
 * CareerNest - Single Applicant Profile Styles
 * Modern profile layout with gradient banner design
 */

/* Container */
.cn-applicant-profile {
  min-height: 100vh;
  padding: 0;
}

.cn-applicant-container {
  max-width: 100%;
  margin: 0 auto;
}

/* ==========================================
   PROFILE HEADER - Modern Design
   ========================================== */

.cn-profile-header-wrapper {
  position: relative;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  margin: 2rem 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cn-profile-banner {
  height: 132px;
  background: linear-gradient(
      135deg,
      rgba(0, 0, 0, 0.2) 0%,
      transparent 30%,
      transparent 70%,
      rgba(0, 0, 0, 0.2) 100%
    ),
    var(--cn-primary-btn);
  position: relative;
}

.cn-profile-header-content {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 3rem 2.5rem 3rem;
  gap: 2rem;
}

/* Left Section - Photo and Info */
.cn-profile-left-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  flex: 1;
}

.cn-profile-photo-wrapper {
  margin-top: -80px;
  position: relative;
  z-index: 10;
}

.cn-profile-photo {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 6px solid #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cn-profile-photo-placeholder {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0e0e0 0%, #c0c0c0 100%);
  border: 6px solid #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  font-weight: bold;
  color: #666;
}

.cn-profile-info {
  flex: 1;
  text-align: left;
}

.cn-profile-name {
  font-size: 26px;
  font-weight: 700;
  font-style: normal;
  margin: 0 0 0.75rem 0;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  line-height: 132%;
  letter-spacing: 0%;
  text-transform: capitalize;
}

.cn-edit-profile-btn {
  color: #666;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  padding: 0.25rem;
}

.cn-edit-profile-btn:hover {
  color: var(--cn-primary-btn);
  transform: scale(1.1);
}

.cn-profile-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cn-location-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: #666;
  font-size: 0.875rem;
}

.cn-location-item svg {
  color: #666;
  width: 16px;
  height: 16px;
}

.cn-availability-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: #f0fdf4;
  color: #16a34a;
  border-radius: 16px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.cn-availability-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
  display: inline-block;
}

/* Contact Section */
.cn-profile-contact-section {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.cn-contact-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cn-contact-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff8c42 0%, #ff6b35 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cn-contact-icon:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(255, 107, 53, 0.3);
}

.cn-contact-icon svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

.cn-contact-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.cn-contact-label {
  font-size: 0.75rem;
  color: #888;
  font-weight: 500;
}

.cn-contact-value {
  font-size: 0.875rem;
  color: #1a1a1a;
  font-weight: 600;
  text-decoration: none;
  word-break: break-all;
}

.cn-contact-value:hover {
  color: var(--cn-primary-btn);
  text-decoration: underline;
}

/* ==========================================
   PROFILE BODY
   ========================================== */

.cn-profile-body {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
  padding: 0 1rem 2rem 1rem;
}

.cn-profile-main {
  min-width: 0;
}

/* Profile Sections */
.cn-profile-section {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cn-section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 1.5rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--cn-primary-btn);
}

.cn-section-content {
  color: #444;
  line-height: 1.7;
}

.cn-section-content p {
  margin: 0;
}

/* Read More/Less Links */
.cn-read-more-link,
.cn-read-less-link {
  color: var(--cn-primary-btn);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  display: inline;
  margin-left: 0.25rem;
}

.cn-read-more-link:hover,
.cn-read-less-link:hover {
  text-decoration: underline;
}

/* Experience Items */
.cn-experience-item,
.cn-education-item,
.cn-license-item {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e5e7eb;
}

.cn-experience-item:last-child,
.cn-education-item:last-child,
.cn-license-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.cn-experience-icon,
.cn-education-icon,
.cn-license-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border-radius: 12px;
}

.cn-experience-icon svg,
.cn-education-icon svg,
.cn-license-icon svg {
  stroke: var(--cn-primary-btn);
}

.cn-experience-details h3,
.cn-education-details h3,
.cn-license-details h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
}

.cn-company-name,
.cn-institution-name,
.cn-issuer-name {
  font-size: 14px;
  color: var(--cn-primary-btn);
  font-weight: 500;
  margin: 0 0 0.5rem 0;
}

.cn-date-range {
  font-size: 14px;
  color: #666;
  margin: 0 0 0.75rem 0;
  font-style: italic;
}

.cn-notes {
  color: #555;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-top: 0.75rem;
}

.cn-notes p {
  margin: 0.5rem 0;
}

/* Skills */
.cn-skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cn-skill-tag {
  display: inline-block;
  padding: 0.3rem 1rem;
  background: #f5f5f5;
  color: #101010;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid #e0e0e0;
  transition: all 0.2s ease;
}

.cn-skill-tag:hover {
  background: #e8e8e8;
  transform: translateY(-2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* ==========================================
   SIDEBAR
   ========================================== */

.cn-profile-sidebar {
  position: sticky;
  top: 2rem;
  height: fit-content;
}

.cn-sidebar-card {
  background: #fafafa;
  border: 1px solid #dadada;
  border-radius: 8px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: none;
}

.cn-sidebar-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 1.25rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e5e7eb;
}

.cn-sidebar-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: flex-start;
}

.cn-sidebar-item:last-child {
  margin-bottom: 0;
}

.cn-sidebar-icon {
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eeeeee;
  border-radius: 999px;
}

.cn-sidebar-icon svg {
  width: 28px;
  height: 28px;
}

.cn-sidebar-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cn-sidebar-label {
  font-size: 12px;
  color: #888;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cn-sidebar-value {
  font-size: 18px;
  color: #1a1a1a;
  font-weight: 600;
  line-height: 1.4;
}

.cn-sidebar-link {
  font-size: 0.95rem;
  color: var(--cn-primary-btn);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.cn-sidebar-link:hover {
  color: var(--cn-primary-btn);
  text-decoration: underline;
  opacity: 0.8;
}

/* Download Button */
.cn-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: var(--cn-primary-btn);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.cn-download-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  color: white;
}

.cn-download-btn svg {
  flex-shrink: 0;
}

/* Additional Links */
.cn-links-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cn-link-with-icon {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--cn-primary-btn);
  text-decoration: none;
  font-weight: normal;
  transition: color 0.2s ease;
}

.cn-link-with-icon:hover {
  color: var(--cn-primary-btn);
  text-decoration: underline;
  opacity: 0.8;
}

.cn-link-icon {
  flex-shrink: 0;
}

.cn-link-notes {
  margin: 0.5rem 0 0 0;
  font-size: 0.875rem;
  color: #666;
  line-height: 1.5;
}

/* Platform-specific link colors */
.cn-link-linkedin {
  color: #0077b5;
}

.cn-link-github {
  color: #333;
}

.cn-link-twitter {
  color: #1da1f2;
}

.cn-link-facebook {
  color: #1877f2;
}

.cn-link-instagram {
  color: #e4405f;
}

.cn-link-portfolio {
  color: var(--cn-primary-btn);
}

.cn-link-website {
  color: #666;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 1024px) {
  .cn-profile-header-content {
    padding: 0 2rem 2rem 2rem;
  }

  .cn-profile-body {
    grid-template-columns: 1fr;
  }

  .cn-profile-sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .cn-profile-banner {
    height: 140px;
  }

  .cn-profile-header-content {
    flex-direction: column;
    padding: 0 1.5rem 2rem 1.5rem;
    gap: 1.5rem;
  }

  .cn-profile-left-section {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    width: 100%;
  }

  .cn-profile-photo-wrapper {
    margin-top: -70px;
  }

  .cn-profile-photo,
  .cn-profile-photo-placeholder {
    width: 140px;
    height: 140px;
  }

  .cn-profile-photo-placeholder span {
    font-size: 3.5rem;
  }

  .cn-profile-name {
    font-size: 2rem;
    justify-content: flex-start;
  }

  .cn-profile-meta {
    justify-content: flex-start;
  }

  .cn-profile-contact-section {
    grid-template-columns: repeat(3, auto);
    justify-content: flex-start;
    width: 100%;
    padding-top: 0;
    gap: 0.75rem;
  }

  .cn-contact-card {
    width: auto;
    min-width: unset;
  }

  .cn-contact-info {
    display: none;
  }

  .cn-contact-icon {
    width: 40px;
    height: 40px;
  }

  .cn-contact-icon svg {
    width: 20px;
    height: 20px;
  }

  .cn-profile-section {
    padding: 1.5rem;
  }

  .cn-section-title {
    font-size: 1.5rem;
  }

  .cn-experience-item,
  .cn-education-item,
  .cn-license-item {
    flex-direction: column;
    gap: 1rem;
  }

  .cn-experience-icon,
  .cn-education-icon,
  .cn-license-icon {
    align-self: flex-start;
  }

  .cn-applicant-container {
    margin: 0;
  }

  .cn-profile-header-wrapper {
    margin: 1rem 0.5rem;
    border-radius: 12px;
  }

  .cn-profile-body {
    padding: 0 0.5rem 1rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .cn-profile-name {
    font-size: 1.75rem;
  }

  /* Contact section on tiny phones: icons-only is established at 768px,
     here we make sure 3 icons fit comfortably on a 360-375px viewport.
     Switch from rigid `repeat(3, auto)` to a flex row that can wrap if
     a 4th card ever joins, with consistent gap and centered alignment. */
  .cn-profile-contact-section {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    justify-content: flex-start;
    grid-template-columns: none; /* override the 768px grid rule */
  }

  .cn-contact-icon {
    /* 44×44 touch target floor (Apple HIG / Material). */
    width: 44px;
    height: 44px;
  }

  .cn-contact-icon svg {
    width: 22px;
    height: 22px;
  }

  .cn-sidebar-card {
    padding: 1.25rem;
  }

  /* Tight section padding so content has more horizontal room */
  .cn-profile-section {
    padding: 1.25rem 1rem;
  }

  /* Profile header padding tightening — banner + content */
  .cn-profile-header-content {
    padding: 0.875rem 1rem 1.25rem;
  }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
  .cn-applicant-profile {
    background: white;
  }

  .cn-profile-header-wrapper,
  .cn-profile-section,
  .cn-sidebar-card {
    box-shadow: none;
    page-break-inside: avoid;
  }

  .cn-edit-profile-btn {
    display: none;
  }

  .cn-download-btn {
    display: none;
  }
}

/* ── Inline section editing (LinkedIn-style) ────────────────────────
 * Section pencil → flips view ↔ edit in place. Owner-only — visitors
 * never see these affordances. Empty-state placeholders also owner-only.
 * ──────────────────────────────────────────────────────────────────── */

/* Section header layout — title left, pencil button right */
.cn-profile-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.cn-profile-section-header .cn-section-title {
  margin: 0;
}

/* Pencil button — appears only for the profile owner */
.cn-section-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  color: #4a5568;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
  font-family: inherit;
  flex-shrink: 0;
}

.cn-section-edit-btn:hover {
  background: #f8fafc;
  border-color: #0073aa;
  color: #0073aa;
}

.cn-section-edit-btn:focus-visible {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.cn-section-edit-btn svg {
  display: block;
}

/* Empty-state placeholder — only rendered for owner when section has no data */
.cn-section-empty-prompt {
  margin: 0;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border: 1px dashed #cbd5e0;
  border-radius: 8px;
  color: #718096;
  font-size: 0.92rem;
  font-style: italic;
  line-height: 1.5;
}

/* Edit form — hidden by default, revealed when section gets .cn-editing */
.cn-section-edit-form {
  display: none;
  margin-top: 1rem;
}

.cn-profile-section.cn-editing .cn-section-view {
  display: none;
}

.cn-profile-section.cn-editing .cn-section-edit-form {
  display: block;
}

/* Additional Links lives in a .cn-sidebar-card (not a .cn-sidebar-item),
   so we need the parallel show-form rule. Only target the repeater form
   variant so we don't accidentally affect the Resume card (no edit form). */
.cn-sidebar-card.cn-editing .cn-section-view {
  display: none;
}

.cn-sidebar-card.cn-editing .cn-section-edit-form--repeater {
  display: block;
}

.cn-section-edit-form .cn-form-field {
  margin-bottom: 1rem;
}

.cn-section-edit-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 0.375rem;
}

.cn-section-edit-form .cn-input,
.cn-section-edit-form .cn-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cn-section-edit-form .cn-input:focus,
.cn-section-edit-form .cn-textarea:focus {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.cn-section-edit-form .cn-field-help {
  margin: 0.375rem 0 0 0;
  font-size: 0.8rem;
  color: #718096;
  font-style: italic;
}

.cn-section-edit-actions {
  display: flex;
  gap: 0.625rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* Polish the Cancel + Save buttons inside inline edit forms.
   Override the global .cn-btn-outline / .cn-btn-primary defaults (which can
   feel overly aggressive in this context — thick borders, large padding) to
   give a more refined inline-edit look. Pill shape, lighter weight, calmer
   hover. */
.cn-section-edit-actions .cn-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  border-width: 1px;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.4;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.1s ease;
}

.cn-section-edit-actions .cn-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.18);
}

/* Cancel — ghost / soft. Subtle by design. */
.cn-section-edit-actions .cn-btn-outline,
.cn-section-edit-actions .cn-section-cancel-btn {
  background: transparent !important;
  border-color: #cbd5e0 !important;
  color: #4a5568 !important;
}

.cn-section-edit-actions .cn-btn-outline:hover,
.cn-section-edit-actions .cn-section-cancel-btn:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #1a202c !important;
  transform: none !important;
}

/* Save — solid brand button, slightly tighter than the global default. */
.cn-section-edit-actions .cn-btn-primary,
.cn-section-edit-actions .cn-section-save-btn {
  border-color: var(--cn-primary-btn, #FF8200) !important;
  background: var(--cn-primary-btn, #FF8200) !important;
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.cn-section-edit-actions .cn-btn-primary:hover,
.cn-section-edit-actions .cn-section-save-btn:hover {
  background: var(--cn-primary-btn-hover, #e37600) !important;
  border-color: var(--cn-primary-btn-hover, #e37600) !important;
  color: #fff !important;
  transform: translateY(-1px);
}

.cn-section-edit-actions .cn-btn-primary:disabled,
.cn-section-edit-actions .cn-section-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.cn-section-error {
  margin-top: 0.625rem;
  padding: 0.5rem 0.75rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #991b1b;
  font-size: 0.85rem;
}

/* Saved flash — quick green confirmation that disappears after a beat */
.cn-section-saved-flash {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  background: rgba(16, 185, 129, 0.12);
  border-radius: 999px;
  color: #047857;
  font-size: 0.78rem;
  font-weight: 600;
  margin-left: 0.5rem;
  animation: cn-flash-in 0.2s ease, cn-flash-out 0.3s ease 1.8s forwards;
}

@keyframes cn-flash-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes cn-flash-out {
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

/* LinkedIn contact card — inline pencil sits in a tighter spot inside the
   contact card layout, not its own section header. Adjust button + form. */
.cn-contact-card .cn-section-edit-btn--inline {
  margin-left: auto;
  padding: 0.25rem 0.625rem;
  font-size: 0.7rem;
}

.cn-contact-card .cn-section-edit-form--inline {
  margin-top: 0.75rem;
  flex-basis: 100%;
}

.cn-contact-card .cn-section-edit-form--inline .cn-form-field {
  margin-bottom: 0.625rem;
}

/* Empty-state in contact card — muted "Not added yet" */
.cn-contact-card .cn-contact-empty-prompt {
  color: #94a3b8;
  font-style: italic;
  font-size: 0.85rem;
}

/* When the LinkedIn contact card is editing, hide the icon + label so the
   form fits cleanly in the card's width. Hide the pencil too — the form's
   own Cancel/Save buttons are the actions while editing. */
.cn-contact-card.cn-editing .cn-contact-icon,
.cn-contact-card.cn-editing .cn-contact-info,
.cn-contact-card.cn-editing .cn-section-edit-btn--inline {
  display: none;
}

/* Show the inline form when the contact card is in editing state.
   The base .cn-section-edit-form rule sets display:none, and the existing
   .cn-profile-section.cn-editing rule only matches main sections — we need
   a parallel rule for the .cn-contact-card variant or the form stays hidden. */
.cn-contact-card.cn-editing .cn-section-edit-form--inline {
  display: block;
  margin-top: 0;
  flex-basis: 100%;
  width: 100%;
}

/* ── Sidebar item editing (Stage 2) ─────────────────────────────────
 * Sidebar items live inside .cn-sidebar-card. Each is a flex row of
 * icon + info + pencil. When editing, hide info + pencil, show form. */

.cn-sidebar-item {
  position: relative;
}

/* Position the inline pencil to the right of the row */
.cn-sidebar-item .cn-section-edit-btn--inline {
  margin-left: auto;
  flex-shrink: 0;
  padding: 0.25rem 0.625rem;
  font-size: 0.7rem;
}

/* Hide info + pencil while editing; show form (taking the freed width) */
.cn-sidebar-item.cn-editing .cn-sidebar-info,
.cn-sidebar-item.cn-editing .cn-section-edit-btn--inline {
  display: none;
}

.cn-sidebar-item.cn-editing .cn-section-edit-form--inline {
  display: block;
  flex: 1;
  margin-top: 0;
}

/* Empty-state placeholder inside a sidebar item */
.cn-sidebar-empty-prompt {
  color: #94a3b8;
  font-style: italic;
  font-weight: 400 !important;
}

/* Checkbox group inside the work_types edit form — compact layout */
.cn-section-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.875rem;
  margin-top: 0.5rem;
}

.cn-section-checkbox-group .cn-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 400;
  color: #1a202c;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: background 0.12s ease;
}

.cn-section-checkbox-group .cn-checkbox-label:hover {
  background: #f1f5f9;
}

.cn-section-checkbox-group input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
}

/* ── Inline location editing (Stage 2) ──────────────────────────────
 * Location lives in `.cn-profile-meta` (header inline area). Smaller
 * affordances: micro pencil, compact form (input + save + cancel inline). */

/* Reset the wrapper to flex so view + form share row layout */
.cn-location-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.cn-location-item .cn-section-view {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.cn-location-item.cn-editing .cn-section-view {
  display: none;
}

/* Compact form for location — input + buttons all on one row */
.cn-section-edit-form--compact {
  display: none;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0;
}

.cn-location-item.cn-editing .cn-section-edit-form--compact {
  display: inline-flex;
}

.cn-section-edit-form--compact .cn-input {
  flex: 1;
  min-width: 180px;
  padding: 0.4rem 0.625rem;
  font-size: 0.875rem;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  background: #fff;
}

.cn-section-edit-form--compact .cn-input:focus {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.cn-section-edit-form--compact .cn-section-error {
  flex-basis: 100%;
}

/* Polished button styling for the compact (location) form — same look as
   the .cn-section-edit-actions buttons but applied directly inside the
   compact form since there's no separate actions wrapper. */
.cn-section-edit-form--compact .cn-btn {
  padding: 0.4rem 0.875rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border-width: 1px;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.4;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.1s ease;
}

.cn-section-edit-form--compact .cn-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.18);
}

/* Cancel — ghost / soft */
.cn-section-edit-form--compact .cn-btn-outline,
.cn-section-edit-form--compact .cn-section-cancel-btn {
  background: transparent !important;
  border-color: #cbd5e0 !important;
  color: #4a5568 !important;
}

.cn-section-edit-form--compact .cn-btn-outline:hover,
.cn-section-edit-form--compact .cn-section-cancel-btn:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #1a202c !important;
  transform: none !important;
}

/* Save — solid brand */
.cn-section-edit-form--compact .cn-btn-primary,
.cn-section-edit-form--compact .cn-section-save-btn {
  border-color: var(--cn-primary-btn, #FF8200) !important;
  background: var(--cn-primary-btn, #FF8200) !important;
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.cn-section-edit-form--compact .cn-btn-primary:hover,
.cn-section-edit-form--compact .cn-section-save-btn:hover {
  background: var(--cn-primary-btn-hover, #e37600) !important;
  border-color: var(--cn-primary-btn-hover, #e37600) !important;
  color: #fff !important;
  transform: translateY(-1px);
}

.cn-section-edit-form--compact .cn-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Micro pencil for location — minimal visual weight */
.cn-section-edit-btn--micro {
  padding: 0.125rem 0.375rem;
  font-size: 0.7rem;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s ease, color 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cn-section-edit-btn--micro:hover {
  color: var(--cn-primary-btn, #0073aa);
  background: rgba(0, 115, 170, 0.08);
}

/* Empty-state placeholder for inline location */
.cn-location-empty-prompt {
  color: #94a3b8;
  font-style: italic;
}

/* ── Stage 3: avatar / resume / repeater editing ─────────────────── */

/* Header photo hover overlay (owner-only). Mirrors the dashboard avatar
   pattern but scoped to .cn-profile-photo-wrapper. */
.cn-profile-photo-wrapper {
  position: relative;
}

.cn-applicant-photo-edit-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease;
  font-family: inherit;
  padding: 0;
  z-index: 2;
}

.cn-profile-photo-wrapper[data-cn-applicant-photo-editable="1"]:hover .cn-applicant-photo-edit-overlay,
.cn-profile-photo-wrapper[data-cn-applicant-photo-editable="1"]:focus-within .cn-applicant-photo-edit-overlay {
  opacity: 1;
}

.cn-applicant-photo-edit-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@media (hover: none) {
  /* Touch fallback — small camera badge always visible */
  .cn-applicant-photo-edit-overlay {
    opacity: 1;
    inset: auto -2px -2px auto;
    width: 36px;
    height: 36px;
    background: var(--cn-primary-btn, #FF8200);
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  }
  .cn-applicant-photo-edit-label { display: none; }
}

/* Loading state */
.cn-profile-photo-wrapper.cn-applicant-photo-uploading .cn-profile-photo,
.cn-profile-photo-wrapper.cn-applicant-photo-uploading .cn-profile-photo-placeholder {
  opacity: 0.4;
  filter: blur(1px);
}

.cn-profile-photo-wrapper.cn-applicant-photo-uploading .cn-applicant-photo-edit-overlay {
  opacity: 0;
  pointer-events: none;
}

.cn-applicant-photo-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 50%;
  z-index: 3;
}

.cn-applicant-photo-spinner-dot {
  width: 6px;
  height: 6px;
  background: var(--cn-primary-btn, #FF8200);
  border-radius: 50%;
  animation: cn-photo-bounce 1s infinite ease-in-out;
}

.cn-applicant-photo-spinner-dot:nth-child(2) { animation-delay: 0.15s; }
.cn-applicant-photo-spinner-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes cn-photo-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* ── Resume sidebar card ────────────────────────────────────────── */
.cn-resume-card .cn-resume-filename {
  font-size: 0.85rem;
  color: #4a5568;
  margin: 0.5rem 0;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cn-resume-card .cn-resume-owner-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.625rem;
}

/* Polished Replace + Remove buttons — same pill pattern as the inline edit
   forms. Override default .cn-btn-outline / .cn-btn-danger styles. */
.cn-resume-card .cn-resume-replace-btn.cn-btn,
.cn-resume-card .cn-resume-remove-btn.cn-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.875rem !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  line-height: 1.4 !important;
  border-radius: 999px !important;
  border: 1px solid #cbd5e0 !important;
  background: transparent !important;
  color: #4a5568 !important;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cn-resume-card .cn-resume-replace-btn.cn-btn:hover {
  background: #f1f5f9 !important;
  border-color: var(--cn-primary-btn, #0073aa) !important;
  color: var(--cn-primary-btn, #0073aa) !important;
}

.cn-resume-card .cn-resume-remove-btn.cn-btn {
  border-color: #fca5a5 !important;
  color: #b91c1c !important;
}

.cn-resume-card .cn-resume-remove-btn.cn-btn:hover {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
}

/* Empty state Upload button — primary brand */
.cn-resume-card .cn-resume-replace-btn.cn-btn-primary {
  border-color: var(--cn-primary-btn, #FF8200) !important;
  background: var(--cn-primary-btn, #FF8200) !important;
  color: #fff !important;
}

.cn-resume-card .cn-resume-replace-btn.cn-btn-primary:hover {
  background: var(--cn-primary-btn-hover, #e37600) !important;
  border-color: var(--cn-primary-btn-hover, #e37600) !important;
  color: #fff !important;
}

.cn-resume-card .cn-resume-help {
  font-size: 0.75rem;
  color: #94a3b8;
  font-style: italic;
  margin: 0.625rem 0 0 0;
}

.cn-resume-card .cn-resume-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 0.625rem;
}

/* ── Repeater rows (Career History / Education / Licenses / Links) ── */
.cn-section-edit-form--repeater {
  margin-top: 1rem;
}

.cn-repeater-items {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.cn-repeater-item {
  position: relative;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem 1.125rem 0.75rem 1.125rem;
}

.cn-repeater-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .cn-repeater-row {
    grid-template-columns: 1fr;
  }

  /* Touch-target floor (Apple HIG / Material): every interactive button
     in inline-edit forms gets at least 44px tap height on mobile. The
     desktop styling uses cn-btn-small with ~30px height which is fine
     for mouse but a thumb-stretch on a phone. */
  .cn-section-edit-actions .cn-btn,
  .cn-repeater-item .cn-repeater-remove.cn-btn,
  .cn-section-edit-form--repeater .cn-repeater-remove.cn-btn,
  .cn-section-edit-form--repeater .cn-repeater-add.cn-btn,
  .cn-resume-replace-btn,
  .cn-resume-remove-btn {
    min-height: 44px;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    font-size: 0.875rem;
  }

  /* Section edit pencil — also a tap target on mobile */
  .cn-section-edit-btn {
    min-height: 36px;
    min-width: 36px;
    padding: 0.5rem 0.75rem;
  }

  /* Save / Cancel rows — stack vertically on tiny screens with full-width
     buttons. Save first (primary action) on top. */
  .cn-section-edit-actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
    align-items: stretch;
  }

  .cn-section-edit-actions .cn-btn {
    width: 100%;
  }
}

.cn-repeater-item .cn-form-field {
  margin-bottom: 0.75rem;
}

.cn-repeater-item .cn-form-field:last-of-type {
  margin-bottom: 0.5rem;
}

.cn-repeater-item .cn-form-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 0.25rem;
}

.cn-repeater-item .cn-form-field .cn-input,
.cn-repeater-item .cn-form-field .cn-textarea {
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-size: 0.875rem;
  background: #fff;
}

.cn-repeater-item .cn-form-field .cn-input:focus,
.cn-repeater-item .cn-form-field .cn-textarea:focus {
  outline: none;
  border-color: var(--cn-primary-btn, #0073aa);
  box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.cn-repeater-item .cn-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 400;
  color: #1a202c;
  margin: 0;
}

/* Repeater "Remove row" button — high specificity to override global
   .cn-btn-outline. Pill shape, soft red, calmer hover. */
.cn-repeater-item .cn-repeater-remove.cn-btn,
.cn-section-edit-form--repeater .cn-repeater-remove.cn-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
  padding: 0.35rem 0.875rem !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  line-height: 1.4 !important;
  background: transparent !important;
  border: 1px solid #fca5a5 !important;
  border-radius: 999px !important;
  color: #b91c1c !important;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  cursor: pointer;
}

.cn-repeater-item .cn-repeater-remove.cn-btn:hover,
.cn-section-edit-form--repeater .cn-repeater-remove.cn-btn:hover {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
}

.cn-repeater-item .cn-repeater-remove.cn-btn:focus-visible,
.cn-section-edit-form--repeater .cn-repeater-remove.cn-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18) !important;
}

/* "+ Add another" button — pill, dashed neutral by default, brand-coloured on hover */
.cn-section-edit-form--repeater > .cn-repeater-add.cn-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 1rem;
  padding: 0.5rem 1.125rem !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  line-height: 1.4 !important;
  border-radius: 999px !important;
  border: 1.5px dashed #cbd5e0 !important;
  background: transparent !important;
  color: #4a5568 !important;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  cursor: pointer;
}

.cn-section-edit-form--repeater > .cn-repeater-add.cn-btn:hover {
  background: rgba(0, 115, 170, 0.05) !important;
  border-color: var(--cn-primary-btn, #0073aa) !important;
  color: var(--cn-primary-btn, #0073aa) !important;
  border-style: solid !important;
}

.cn-section-edit-form--repeater > .cn-repeater-add.cn-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.18) !important;
}

/* ── Right to Work conditional visa field ──────────────────────── */
.cn-rtw-visa-field {
  margin-top: 0.75rem;
}

/* Subvalue line under sidebar value (e.g. visa details under "Foreign Citizen") */
.cn-sidebar-subvalue {
  display: block;
  font-size: 0.78rem;
  color: #718096;
  margin-top: 0.125rem;
  font-style: italic;
}

/* ── WYSIWYG (TinyMCE) editor polish ─────────────────────────────
   The Personal Summary textarea + every repeater Notes field carries
   the .cn-wysiwyg class. When the owner enters edit mode, JS swaps
   the plain textarea for a TinyMCE iframe wrapped in WP's editor
   chrome. The defaults look bolted-on; these rules align the editor
   with the rest of the inline-edit form (rounded corners, brand-
   tinted focus, snug margins).
*/

/* Plain-textarea fallback (before TinyMCE attaches, or if it failed
   to load): keep height matching what TinyMCE will be. */
.cn-section-edit-form textarea.cn-wysiwyg {
  min-height: 140px;
}

/* Editor chrome wrapper — TinyMCE injects div.wp-editor-wrap.tmce-active
   right after the textarea. Tighten its border to match cn-input. */
.cn-section-edit-form .wp-editor-wrap {
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cn-section-edit-form .wp-editor-wrap:focus-within {
  border-color: var(--cn-primary-btn, #0073aa);
  box-shadow: 0 0 0 3px rgba(var(--cn-primary-btn-rgb, 0, 115, 170), 0.15);
}

/* Editor tab strip (Visual / Text) — flatten + brand-tint */
.cn-section-edit-form .wp-editor-tabs {
  background: transparent;
  padding: 4px 6px 0;
}

.cn-section-edit-form .wp-switch-editor {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px 6px 0 0;
  font-size: 0.78rem;
  color: #4a5568;
  margin: 0 2px -1px 0;
  padding: 4px 10px;
  cursor: pointer;
}

.cn-section-edit-form .wp-switch-editor:hover {
  color: var(--cn-primary-btn, #0073aa);
  background: rgba(var(--cn-primary-btn-rgb, 0, 115, 170), 0.06);
}

.cn-section-edit-form .wp-editor-tabs .switch-tmce.active,
.cn-section-edit-form .wp-editor-tabs .switch-html.active {
  background: #fff;
  border-color: #cbd5e0;
  border-bottom-color: #fff;
  color: var(--cn-primary-text, #1a202c);
  font-weight: 600;
}

/* Toolbar row — strip the default border-bottom shadow, slim it */
.cn-section-edit-form .mce-toolbar-grp,
.cn-section-edit-form .quicktags-toolbar {
  background: #f7fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: none !important;
}

/* Editor iframe container — kill default top border (we own the chrome) */
.cn-section-edit-form .mce-edit-area {
  border-top: 0 !important;
}

/* Quicktags textarea (Text mode) — match Visual height */
.cn-section-edit-form .wp-editor-area {
  min-height: 140px !important;
  padding: 10px 12px !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
  font-size: 0.85rem !important;
}

/* Hide the resize-handle row at the bottom — keeps the form compact */
.cn-section-edit-form .wp-editor-wrap .mce-statusbar {
  display: none !important;
}

/* ── Mobile TinyMCE toolbar polish ────────────────────────────────
   On phones the toolbar wraps to multiple rows inside a narrow
   repeater card and looks awful. Tighten the chrome:
   - smaller buttons (24×24 instead of 30×30)
   - allow toolbar to wrap cleanly with min-width:0 + flex-wrap
   - drop the editor min-height so notes don't dominate the form
   - compact tab strip (Visual/Text)
*/
@media (max-width: 600px) {
  .cn-section-edit-form .wp-editor-wrap {
    border-radius: 6px;
  }

  .cn-section-edit-form .mce-toolbar-grp,
  .cn-section-edit-form .quicktags-toolbar {
    padding: 2px 4px !important;
    min-width: 0;
  }

  .cn-section-edit-form .mce-toolbar .mce-btn-group {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .cn-section-edit-form .mce-toolbar .mce-btn {
    margin: 1px !important;
    padding: 0 !important;
    min-width: 26px;
    min-height: 26px;
  }

  .cn-section-edit-form .mce-toolbar .mce-btn button {
    padding: 4px 6px !important;
    min-width: 26px;
    min-height: 26px;
  }

  .cn-section-edit-form .mce-toolbar .mce-ico {
    font-size: 14px !important;
    line-height: 14px !important;
    width: 14px !important;
    height: 14px !important;
  }

  /* Slim the Visual / Text tab strip */
  .cn-section-edit-form .wp-editor-tabs {
    padding: 2px 4px 0;
  }

  .cn-section-edit-form .wp-switch-editor {
    font-size: 0.72rem;
    padding: 3px 8px;
  }

  /* Drop the iframe height so the form fits without dominating */
  .cn-section-edit-form .wp-editor-wrap iframe {
    min-height: 140px !important;
    max-height: 220px;
  }

  .cn-section-edit-form .wp-editor-area {
    min-height: 120px !important;
    padding: 8px 10px !important;
  }

  /* Allow the toolbar row to actually wrap if buttons exceed width */
  .cn-section-edit-form .mce-container,
  .cn-section-edit-form .mce-container-body,
  .cn-section-edit-form .mce-toolbar,
  .cn-section-edit-form .mce-flow-layout,
  .cn-section-edit-form .mce-flow-layout-item {
    flex-wrap: wrap !important;
    max-width: 100% !important;
  }
}
