/* ═══════════════════════════════════════════════════════════════
   PROFILE & SETTINGS — styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Nav avatar dropdown ───────────────────────────────────────── */

.nav-avatar-wrap {
  position: relative;
}

.nav-avatar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 2px solid rgba(220,20,60,0.2);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.2s;
  line-height: 0;
}

.nav-avatar-btn:hover,
.nav-avatar-btn[aria-expanded="true"] {
  border-color: #DC143C;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border: 1px solid #e2e8f0;
  z-index: 200;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.nav-dropdown.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-dropdown__header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid #f1f5f9;
}

.nav-dropdown__name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-dropdown__email {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.nav-dropdown__divider {
  height: 1px;
  background: #f1f5f9;
  margin: 4px 0;
}

.nav-dropdown__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-dropdown__item:hover {
  background: #f8fafc;
  color: #0f172a;
}

.nav-dropdown__item--danger {
  color: #DC143C;
}

.nav-dropdown__item--danger:hover {
  background: #fff5f7;
  color: #DC143C;
}

/* ── Profile page ───────────────────────────────────────────────── */

.profile-page {
  min-height: 100vh;
  background: #FAFAFA;
  padding-top: 24px;
  padding-bottom: 60px;
}

.profile-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.profile-container--narrow {
  max-width: 640px;
}

.profile-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid #f1f5f9;
}

/* ── Profile header card ──────────────────────────────────────── */

.profile-header-layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.profile-avatar-wrap {
  flex-shrink: 0;
}

.profile-header-info {
  flex: 1;
  min-width: 160px;
}

.profile-name {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 4px;
}

.profile-username {
  font-size: 14px;
  color: #94a3b8;
  margin: 0 0 6px;
}

.profile-member-since {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 12px;
}

.profile-bio {
  font-size: 14px;
  color: #334155;
  line-height: 1.6;
  margin: 0;
}

.btn-edit-profile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  border: 2px solid #DC143C;
  border-radius: 8px;
  color: #DC143C;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-edit-profile:hover {
  background: #DC143C;
  color: #fff;
}

.btn-edit-profile i[data-lucide],
.btn-edit-profile svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Profile details card ─────────────────────────────────────── */

.profile-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.profile-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 32px;
}

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

.profile-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-detail-label {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-detail-value {
  font-size: 14px;
  color: #0f172a;
  font-weight: 500;
}

.profile-not-set {
  color: #cbd5e1;
  font-weight: 400;
  font-style: italic;
}

/* ── Activity section ─────────────────────────────────────────── */

.profile-activity-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-activity-item {
  padding: 16px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
}

.profile-activity-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.profile-activity-article {
  font-size: 14px;
  font-weight: 600;
  color: #DC143C;
  text-decoration: none;
}

.profile-activity-article:hover { text-decoration: underline; }

.profile-activity-date {
  font-size: 12px;
  color: #94a3b8;
}

.profile-activity-excerpt {
  font-size: 14px;
  color: #475569;
  margin: 0;
  line-height: 1.5;
}

.profile-empty-state {
  text-align: center;
  padding: 32px 0;
  color: #94a3b8;
}

.profile-empty-state p { margin: 0; font-size: 14px; }

/* ── Profile settings ─────────────────────────────────────────── */

.profile-settings-header {
  margin-bottom: 8px;
}

.profile-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  margin-bottom: 12px;
  transition: color 0.2s;
}

.profile-back-link:hover { color: #DC143C; }

.profile-settings-title {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.profile-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.profile-message {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
}

.profile-message--success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.profile-message--error {
  background: #fff5f5;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.profile-message--info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.settings-card {
  border-radius: 14px;
}

.settings-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

/* Avatar upload */

.avatar-upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.avatar-upload-wrap {
  position: relative;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
  display: inline-block;
}

.avatar-camera-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.avatar-upload-wrap:hover .avatar-camera-overlay { opacity: 1; }

.avatar-upload-hint {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
}

/* Form fields */

.settings-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 500px) {
  .settings-form-grid { grid-template-columns: 1fr; }
}

.settings-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.settings-form-field--full {
  grid-column: 1 / -1;
}

.settings-form-field label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-char-count {
  font-weight: 400;
  color: #94a3b8;
}

.settings-form-field input,
.settings-form-field textarea {
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #0f172a;
  font-family: inherit;
  transition: border-color 0.2s;
  background: #fff;
  resize: vertical;
}

.settings-form-field input:focus,
.settings-form-field textarea:focus {
  outline: none;
  border-color: #DC143C;
}

.settings-form-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
}

.btn-save-settings {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  padding: 11px 24px;
  background: #DC143C;
  color: #fff;
  border: 1.5px solid transparent;
  border-radius: var(--border-radius-pill, 999px);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-save-settings:hover { background: #b0102e; }

/* Info rows */

.settings-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.settings-info-label {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

.settings-info-value {
  font-size: 14px;
  color: #0f172a;
}

.settings-badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.settings-badge--green {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.settings-badge--amber {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.settings-actions-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-settings-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 180px;
  padding: 11px 24px;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--border-radius-pill, 999px);
  color: #334155;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.btn-settings-secondary:hover {
  border-color: #DC143C;
  color: #DC143C;
}

.btn-settings-secondary i[data-lucide],
.btn-settings-secondary svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Mobile: settings buttons span the full width of the form fields above */
@media (max-width: 600px) {
  .settings-form-actions { flex-wrap: wrap; }
  .settings-actions-row { width: 100%; }
  .btn-save-settings,
  .btn-settings-secondary {
    width: 100%;
    min-width: 0;
  }
}

/* Danger zone */

.settings-card--danger {
  border-color: #fecaca;
  background: #fff8f8;
}

.settings-section-title--danger { color: #DC143C; border-color: #fecaca; }

.settings-danger-desc {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 16px;
}

.btn-delete-account {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border: 2px solid #DC143C;
  border-radius: 8px;
  color: #DC143C;
  font-size: 14px;
  font-weight: 600;
  background: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-delete-account:hover {
  background: #DC143C;
  color: #fff;
}

/* ── Shared modal styles ───────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.is-open { display: flex; }

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal--crop {
  max-width: 560px;
}

.modal h3 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 12px;
}

.modal-body-text {
  font-size: 14px;
  color: #475569;
  margin: 0 0 12px;
  line-height: 1.5;
}

.modal-text-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.2s;
}

.modal-text-input:focus {
  outline: none;
  border-color: #DC143C;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-modal-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 20px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s;
}

.btn-modal-cancel:hover { border-color: #94a3b8; }

.btn-modal-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 20px;
  background: #DC143C;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn-modal-danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-modal-danger:not(:disabled):hover { background: #b0102e; }

/* ── Crop container ─────────────────────────────────────────────── */

.crop-container {
  max-height: 400px;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 20px;
  background: #000;
}

.crop-container img {
  max-width: 100%;
  display: block;
}

/* ── Logout modal (reuse existing nav styles from navbar.css) ─── */
/* These already exist in navbar.css but ensure they're available */
.logout-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.logout-modal-overlay.is-open { display: flex; }

.logout-modal {
  background: #fff;
  border-radius: 14px;
  padding: 28px 32px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.15);
}

.logout-modal h3 { margin: 0 0 8px; font-size: 1.15rem; color: #0f172a; }
.logout-modal p { margin: 0 0 16px; color: #334155; font-size: 0.95rem; }

.logout-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.logout-modal-actions button,
.logout-modal-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.logout-cancel {
  background: #fff;
  color: #0f172a;
  border-color: rgba(0,0,0,0.12) !important;
}

.logout-confirm {
  background: #DC143C;
  color: #fff;
}

/* ── Tom Select Dropdown ─────────────────────────────────────── */
.ts-dropdown {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1) !important;
  margin-top: 4px !important;
  overflow: hidden;
  z-index: 9999 !important;
}

.ts-dropdown .option {
  padding: 10px 16px !important;
  font-size: 14px !important;
  color: #334155 !important;
  background: #ffffff !important;
  cursor: pointer !important;
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
  background: rgba(220,20,60,0.05) !important;
  color: #DC143C !important;
}

.ts-dropdown .option.selected {
  background: #DC143C !important;
  color: #ffffff !important;
}

.ts-dropdown .create {
  color: #94a3b8 !important;
  font-style: italic !important;
  padding: 10px 16px !important;
}

.ts-dropdown .no-results,
.ts-dropdown-content .loading {
  color: #94a3b8;
  padding: 10px 16px;
}

/* ── Inline feedback (auth pages) ─────────────────────────────── */

.inline-feedback {
  display: block;
  font-size: 13px;
  font-weight: 500;
}

.inline-feedback--success { color: #22c55e; }
.inline-feedback--error   { color: #DC143C; }
.inline-feedback--warning { color: #f59e0b; }
