/* Profile settings — rohowef light theme */

.profile-settings,
.profile-unsaved-modal {
  --cdb-primary: hsl(221 83% 53%);
  --cdb-primary-hover: hsl(221 83% 48%);
  --cdb-primary-fg: hsl(0 0% 98%);
  --cdb-accent: hsl(221 83% 53%);
  --cdb-accent-muted: hsl(221 83% 48%);
  --cdb-muted-fg: hsl(220 8.9% 46%);
  --cdb-fg: hsl(220 8.9% 15%);
  --cdb-surface: hsl(220 14% 96%);
  --cdb-surface-elevated: hsl(0 0% 100%);
  --cdb-border: hsl(220 13% 88%);
  --cdb-border-strong: hsl(220 13% 75%);
  --cdb-selected-bg: hsl(221 83% 53% / 0.15);
}

#view-profile.active,
#view-settings.active,
#view-league-detail.active,
#view-create-event.active,
#view-event-detail.active,
#view-edit-event.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.profile-settings,
.nested-sidebar-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--cdb-bg, hsl(0 0% 98%));
}

.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 var(--cdb-border);
  background: hsl(0 0% 100%);
  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: var(--cdb-fg);
  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-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  white-space: nowrap;
}

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

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

.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 hsl(220 8.9% 15% / 0.06);
}

.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;
}

.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;
}

.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);
  box-shadow: 0 3px 10px hsl(221 83% 53% / 0.32);
}

.profile-save-btn--active:not(:disabled):active:not(.profile-save-btn--saving) {
  transform: translateY(1px);
  box-shadow: 0 1px 3px hsl(221 83% 53% / 0.22);
}

.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: var(--cdb-surface-elevated);
  border-right: 1px solid var(--cdb-border);
  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: var(--cdb-muted-fg);
  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: var(--cdb-surface);
  color: var(--cdb-fg);
}

.profile-nav-btn:active {
  transform: translateY(1px);
}

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

.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: hsl(221 83% 53% / 0.25);
}

.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;
  background: var(--cdb-bg, hsl(0 0% 98%));
}

.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;
  color: var(--cdb-fg);
}

.profile-section-lead {
  font-size: 12px;
  color: var(--cdb-muted-fg);
  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 var(--cdb-border);
}

.profile-readonly-line {
  font-size: 13px;
  color: var(--cdb-muted-fg);
  margin-top: 8px;
}

.profile-readonly-line strong {
  color: var(--cdb-fg);
  font-weight: 600;
}

.profile-readonly-line code {
  color: var(--cdb-primary);
  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;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--cdb-border);
  background: var(--cdb-surface-elevated);
}

.profile-avatar.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--cdb-muted-fg);
  background: var(--cdb-surface);
}

.profile-unsaved-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: hsl(220 8.9% 15% / 0.4);
}

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

.profile-unsaved-dialog {
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  background: var(--cdb-surface-elevated);
  border: 1px solid var(--cdb-border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px -12px hsl(220 8.9% 15% / 0.2);
}

.profile-unsaved-dialog__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--cdb-border);
}

.profile-unsaved-dialog__header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--cdb-fg);
}

.profile-unsaved-dialog__header p {
  font-size: 12px;
  color: var(--cdb-muted-fg);
  margin-top: 4px;
}

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

.profile-unsaved-row {
  border: 1px solid var(--cdb-border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--cdb-bg, hsl(0 0% 98%));
}

.profile-unsaved-row__label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--cdb-fg);
}

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

.profile-unsaved-cols span {
  display: block;
  color: var(--cdb-muted-fg);
  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: var(--cdb-fg);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  margin: 0;
}

.profile-unsaved-dialog__footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--cdb-border);
  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 var(--cdb-border);
  }

  .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;
  }
}
