/* ─── User Settings Modal ──────────────────────────────────────────────────── */

.user-settings-modal {
  width: 750px !important;
  max-height: 85vh;
  min-height: 400px;
  max-height: 700px;
  padding: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.us-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  /* height: 650px; */
}

/* Sidebar */
.us-sidebar {
  width: 170px;
  flex-shrink: 0;
  padding: 16px 0;
  border-right: 1px solid hsl(from var(--modal-primary-color) h s calc(l - 5));
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 20px;
  margin-top: 1px;
}

.us-tab {
  min-height: 32px !important;
  width: 100%;
  padding: 10px 18px;
  text-align: left;
  background: transparent;
  border: none;
  /* color: hsl(from var(--text-color) h s calc(l - 20)); */
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  border-radius: 0;
  transition: all 0.15s ease;
  letter-spacing: 0.03em;
  border-left: 2px solid transparent;
  /* border-radius: 5px; */
}

.us-tab:hover {
  color: var(--text-color);
  background: hsl(from var(--modal-primary-color) h s calc(l + 3));
}

.us-tab.active {
  color: var(--accent-color);
  /* background: hsl(from var(--modal-primary-color) h s calc(l + 5)); */
  border-left: 2px solid var(--accent-color);
}

/* Content area */
.us-content {
  flex: 1;
  overflow: hidden;
  padding: 0;
  min-height: 0;
  position: relative;
}

.us-content-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
}

.us-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid hsl(from var(--modal-background-color) h s calc(l + 12));
  border-top-color: hsl(from var(--text-color) h s calc(l - 20));
  border-radius: 50%;
  animation: us-spin 0.7s linear infinite;
}

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

.us-content::-webkit-scrollbar { width: 4px; }
.us-content::-webkit-scrollbar-track { background: transparent; }
.us-content::-webkit-scrollbar-thumb { background: hsl(from var(--modal-primary-color) h s calc(l + 10)); border-radius: 2px; }

.us-panel {
    margin: 5px;
    max-height: 620px;
    overflow: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Sections */


.us-section:last-child {
  border-bottom: none;
}

.us-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(from var(--text-color) h s calc(l - 15));
  margin: 0 0 8px 0;
}

.us-divider {
  height: 1px;
  background: hsl(from var(--modal-primary-color) h s calc(l + 8));
  margin-bottom: 14px;
}

/* Inputs */
.us-input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  margin-bottom: 10px;
  background: hsl(from var(--modal-background-color) h s calc(l + 2));
  border: 1px solid hsl(from var(--modal-background-color) h s calc(l + 5));
  border-radius: 5px;
  color: hsl(from var(--text-color) h s calc(l - 10));
  opacity: 0.6;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.us-input:focus {
  opacity: 1;
  border-color: hsl(from var(--modal-background-color) h s calc(l + 15));
  color: var(--text-color);
}

.us-input:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.us-field-note {
    opacity: 0.4;
    margin-left: 176px;
    display: block;
    font-size: 9px;
    /* color: hsl(from var(--text-color) h s calc(l - 25)); */
    margin-top: 3px;
    margin-bottom: 8px;
}

.us-label {
  display: block;
  font-size: 11px;
  color: hsl(from var(--text-color) h s calc(l - 15));
  margin-bottom: 5px;
}

.us-current-value {
  font-size: 11px;
  color: hsl(from var(--text-color) h s calc(l - 20));
  margin: 0 0 10px 0;
}

.us-hint {
  font-size: 11px;
  color: hsl(from var(--text-color) h s calc(l - 25));
  margin: 0 0 12px 0;
  line-height: 1.5;
}

/* Password field */
.us-pw-wrap {
  position: relative;
  margin-bottom: 10px;
}

.us-pw-wrap .us-input {
  margin-bottom: 0;
  padding-right: 36px;
  width: 100%;
}

.us-pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: hsl(from var(--text-color) h s calc(l - 30));
  font-size: 12px;
  user-select: none;
  transition: color 0.15s ease;
}

.us-pw-toggle.visible {
  color: var(--accent-color);
}

/* Buttons */
.us-btn {
  padding: 8px 16px;
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.us-btn-primary {
  background: var(--accent-color);
  color: var(--dark-text-color);
  border-color: var(--accent-color);
}

.us-btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
}

.us-btn-secondary {
    /* max-width: 109px; */
    background: transparent;
    /* color: var(--text-color); */
    border-color: hsl(from var(--modal-primary-color) h s calc(l + 12));
    float: left;
    margin-left: 14px;
    min-height: 30px;
}

.us-btn-secondary:hover:not(:disabled) {
  background: hsl(from var(--modal-primary-color) h s calc(l + 5));
}

.us-btn-danger {
  background: transparent;
  color: #e05252;
  border-color: #e05252;
}

.us-btn-danger:hover:not(:disabled) {
  background: rgba(224, 82, 82, 0.12);
}

.us-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.us-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* Status messages */
.us-status {
  font-size: 11px;
  /* min-height: 18px; */
  margin-bottom: 6px;
}

.us-status-success {
  color: var(--accent-color);
}

.us-status-error {
  color: #e05252;
}

/* ─── Avatar section ─────────────────────────────────────────────────────── */

.us-avatar-row {
  display: flex;
  /* align-items: center; */
  gap: 24px;
  margin-bottom: 8px;
}

.us-avatar-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.us-avatar-preview {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid hsl(from var(--modal-primary-color) h s calc(l + 12));
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(from var(--modal-background-color) h s calc(l + 5));
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease;
}

.us-avatar-preview:hover {
  border-color: var(--accent-color);
}

.us-avatar-preview:hover .us-avatar-overlay {
  opacity: 1;
}

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

.us-avatar-overlay-icon {
  font-size: 20px;
  color: white;
}

.us-avatar-edit-label {
  font-size: 10px;
  color: hsl(from var(--text-color) h s calc(l - 20));
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.15s ease;
}

.us-avatar-edit-label:hover {
  color: var(--accent-color);
}

.us-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.us-avatar-placeholder {
  width: 44px;
  height: 44px;
  color: hsl(from var(--text-color) h s calc(l - 25));
}

.us-avatar-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.us-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.us-field-label {
  font-size: 10px;
  /* color: hsl(from var(--text-color) h s calc(l - 25)); */
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.5;
}

.us-avatar-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

/* Textarea */
.us-textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
  margin-bottom: 4px;
}

/* Bio footer: char count + save button */
.us-bio-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.us-char-count {
  font-size: 10px;
  /* color: hsl(from var(--text-color) h s calc(l - 30)); */
  letter-spacing: 0.04em;
  opacity: 0.3;
}

/* ─── Inline save button (hidden until field is edited) ──────────────────── */

.us-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.us-field-row .us-input {
  flex: 1;
  margin-bottom: 0;
}

/* ─── URL-style username input ───────────────────────────────────────────── */

.us-url-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    background: hsl(from var(--modal-background-color) h s calc(l + 2));
    border: 1px solid hsl(from var(--modal-background-color) h s calc(l + 5));
    border-radius: 5px;
    padding: 10px 0px 10px 12px;
    height: 36px;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
    cursor: text;
}

.us-url-input-wrap:focus-within {
  border-color: hsl(from var(--modal-background-color) h s calc(l + 15));
}

.us-url-prefix {
  font-size: 12px;
  font-family: inherit;
  color: hsl(from var(--text-color) h s calc(l - 15));
  opacity: 0.5;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

.us-url-input {
    margin-top: 20px;
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: hsl(from var(--text-color) h s calc(l - 10));
    font-size: 12px;
    font-family: inherit;
    padding: 0;
    min-width: 40px;
}

.us-url-input-wrap:focus-within .us-url-input {
  color: var(--text-color);
}

.us-copy-url-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  color: hsl(from var(--text-color) h s calc(l - 30));
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.us-copy-url-btn svg {
  margin-top: 0px;
  width: 20px;
  height: 20px;
}

.us-copy-url-btn:hover {
  opacity: 1;
  background-color: transparent;
  color: var(--text-color);
}

.us-copy-url-btn.copied {
  opacity: 1;
  background-color: transparent;
  color: var(--accent-color, #4ade80);
}

.us-inline-save {
  padding: 8px 14px;
  border-radius: 5px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--accent-color);
  color: var(--dark-text-color);
  border-color: var(--accent-color);
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.us-inline-save.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.us-inline-save:hover:not(:disabled) {
  filter: brightness(1.1);
}

.us-inline-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Password section collapsed/expanded ───────────────────────────────── */

.us-pw-fields {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.25s ease;
}

.us-pw-fields.expanded {
    padding: 14px 14px 0px;
    width: 473px;
    max-height: 300px;
    opacity: 1;
}
/* Toggle switch */
.us-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.us-toggle-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.us-toggle-label span {
  font-size: 12px;
  color: var(--text-color);
}

.us-toggle-label small {
  font-size: 10px;
  color: hsl(from var(--text-color) h s calc(l - 25));
}

.us-toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.us-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
}

.us-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: hsl(from var(--modal-primary-color) h s calc(l + 10));
  border-radius: 20px;
  transition: background 0.2s ease;
}

.us-toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.us-toggle-switch input:checked + .us-toggle-slider {
  background: var(--accent-color);
}

.us-toggle-switch input:checked + .us-toggle-slider::before {
  transform: translateX(16px);
}

/* Danger section */
.us-danger-section .us-section-title {
  color: #e05252;
}

.us-danger-section .us-divider {
  background: rgba(224, 82, 82, 0.25);
}

/* Delete confirmation overlay */
.us-confirm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

.us-confirm-box {
  background: var(--modal-background-color);
  border: 1px solid hsl(from var(--modal-primary-color) h s calc(l + 10));
  border-radius: 8px;
  padding: 24px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.us-confirm-box h3 {
  margin: 0 0 4px;
  font-size: 14px;
  color: #e05252;
  font-weight: 600;
}

.us-confirm-box p {
  font-size: 12px;
  color: hsl(from var(--text-color) h s calc(l - 10));
  line-height: 1.5;
  margin: 0;
}

/* Billing panel */
.us-billing-panel {
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 300px;
  gap: 12px;
}

.us-billing-icon {
  font-size: 36px;
  color: var(--accent-color);
  opacity: 0.6;
  line-height: 1;
}

.us-billing-panel h2 {
  font-size: 18px;
  margin: 0;
  font-weight: 400;
  color: var(--text-color);
}

.us-billing-panel p {
  font-size: 12px;
  color: hsl(from var(--text-color) h s calc(l - 20));
  max-width: 300px;
  line-height: 1.6;
  margin: 0;
}

.us-coming-soon-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: hsl(from var(--accent-color) h s calc(l - 50));
  color: var(--accent-color);
  border: 1px solid hsl(from var(--accent-color) h s calc(l - 25));
}
