/* Profile settings shell — resizable sidebar + floating save header (HTML demo) */

/* To Do WEF brand (matches dashboard page.html .btn-primary / accents) */
.profile-settings,
.profile-unsaved-modal {
  --cdb-primary: #6c63ff;
  --cdb-primary-hover: #5b52ee;
  --cdb-primary-fg: #ffffff;
  --cdb-accent: #c4bfff;
  --cdb-accent-muted: #a5a0ff;
  --cdb-muted-fg: #6b6b7a;
  --cdb-surface: #1c1c22;
  --cdb-surface-elevated: #18181c;
  --cdb-border: #2a2a32;
  --cdb-border-strong: #3a3a44;
  --cdb-selected-bg: rgba(108, 99, 255, 0.18);
}

#view-profile.active,
#view-settings.active,
#view-community-detail.active,
#view-module-detail.active,
#view-lesson-detail.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.profile-settings {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Floating header — rohowef: h-[45px] flex items-center px-4 */
.profile-float-header {
  flex-shrink: 0;
  height: 45px;
  min-height: 45px;
  max-height: 45px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(42, 42, 50, 0.5);
  background: rgba(20, 20, 24, 0.95);
  backdrop-filter: blur(8px);
  z-index: 5;
}

.profile-float-header__left {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.profile-float-header__title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  color: #e8e8ec;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-float-header__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.profile-unsaved-link {
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--cdb-accent-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  white-space: nowrap;
}

.profile-unsaved-link:hover {
  color: var(--cdb-accent);
}

.profile-unsaved-link.hidden {
  display: none;
}

/* Save — matches rohowef Button size="sm" + className h-7 px-3 text-xs (DetailView) */
.profile-save-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  border-radius: 6px;
  border: 1px solid transparent;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.profile-save-btn__icon {
  display: block;
  width: 14px;
  height: 14px;
  font-size: 14px;
  flex-shrink: 0;
}

.profile-save-btn__icon.is-spinning {
  animation: profile-save-spin 0.75s linear infinite;
}

/* No changes — outline + muted (disabled), same pattern as .btn-primary:disabled */
.profile-save-btn--idle,
.profile-save-btn:disabled:not(.profile-save-btn--active) {
  background: var(--cdb-surface);
  color: var(--cdb-muted-fg);
  border-color: var(--cdb-border-strong);
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

/* Dirty — To Do WEF .btn-primary */
.profile-save-btn--active:not(:disabled) {
  background: var(--cdb-primary);
  color: var(--cdb-primary-fg);
  border-color: transparent;
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

.profile-save-btn--active:not(:disabled):hover {
  background: var(--cdb-primary-hover);
}

/* Saving — same as active, disabled interaction */
.profile-save-btn--saving {
  opacity: 1;
  pointer-events: none;
  cursor: wait;
}

@keyframes profile-save-spin {
  to {
    transform: rotate(360deg);
  }
}

.profile-save-btn__text {
  white-space: nowrap;
}

.profile-settings-row {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.profile-settings-sidebar {
  flex-shrink: 0;
  align-self: stretch;
  width: var(--profile-sidebar-width, 200px);
  min-width: 160px;
  max-width: 280px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #141418;
  border-right: 1px solid #2a2a32;
  position: relative;
}

.profile-settings-sidebar nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  color: #9a9aaa;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.profile-nav-btn:hover {
  background: #1c1c22;
  color: #e8e8ec;
}

.profile-nav-btn.active {
  background: var(--cdb-selected-bg);
  color: var(--cdb-accent-muted);
  border-right: 2px solid var(--cdb-primary);
  border-radius: 8px 0 0 8px;
}

.profile-settings-resizer {
  width: 6px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  transition: background 0.12s;
}

.profile-settings-resizer:hover,
.profile-settings-resizer.dragging {
  background: color-mix(in srgb, var(--cdb-primary) 35%, transparent);
}

.profile-settings-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 80px 48px;
  box-sizing: border-box;
}

.profile-panel {
  display: none;
  width: 100%;
  max-width: 560px;
}

.profile-panel.active {
  display: block;
}

.profile-section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-section-lead {
  font-size: 12px;
  color: #9a9aaa;
  margin-bottom: 20px;
  line-height: 1.45;
}

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

.profile-fields-grid .cdb-ig--full {
  grid-column: 1 / -1;
}

.profile-readonly-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #2a2a32;
}

.profile-readonly-line {
  font-size: 13px;
  color: #9a9aaa;
  margin-top: 8px;
}

.profile-readonly-line strong {
  color: #c4c4d0;
  font-weight: 600;
}

.profile-readonly-line code {
  color: var(--cdb-accent);
  font-size: 11px;
}

.profile-photo-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-photo-preview-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

/* Unsaved diffs modal */
.profile-unsaved-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
}

.profile-unsaved-modal[aria-hidden="true"] {
  display: none;
}

.profile-unsaved-dialog {
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  background: #18181c;
  border: 1px solid #2a2a32;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.profile-unsaved-dialog__header {
  padding: 16px 20px;
  border-bottom: 1px solid #2a2a32;
}

.profile-unsaved-dialog__header h2 {
  font-size: 15px;
  font-weight: 700;
}

.profile-unsaved-dialog__header p {
  font-size: 12px;
  color: #9a9aaa;
  margin-top: 4px;
}

.profile-unsaved-dialog__body {
  padding: 12px 20px;
  overflow-y: auto;
  flex: 1;
}

.profile-unsaved-row {
  border: 1px solid #2a2a32;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.profile-unsaved-row__label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.profile-unsaved-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 11px;
}

.profile-unsaved-cols span {
  display: block;
  color: #6b6b7a;
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-unsaved-cols pre {
  white-space: pre-wrap;
  word-break: break-word;
  color: #e8e8ec;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  margin: 0;
}

.profile-unsaved-dialog__footer {
  padding: 12px 20px 16px;
  border-top: 1px solid #2a2a32;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .profile-settings-row {
    flex-direction: column;
  }

  .profile-settings-sidebar {
    width: 100% !important;
    max-width: none;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid #2a2a32;
  }

  .profile-settings-sidebar nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
  }

  .profile-nav-btn.active {
    border-right: none;
    border-bottom: 2px solid var(--cdb-primary);
    border-radius: 8px;
  }

  .profile-settings-resizer {
    display: none;
  }

  .profile-fields-grid {
    grid-template-columns: 1fr;
  }

  .profile-settings-main {
    padding: 24px 16px 32px;
    align-items: stretch;
  }

  .profile-panel {
    max-width: none;
  }
}
