/* ==========================================================================
   AiHub.sol - User Profile & Account Settings Styling
   Palette: Deep Black (#070709), Elevated Surface (#121217, #16161c),
            Accent Orange (#ff7a00, #ff8c1a), Clean White (#ffffff)
   ========================================================================== */

.profile-settings-page {
  padding: 2.5rem 0 5rem 0;
  min-height: calc(100vh - 160px);
}

.profile-settings-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.profile-settings-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-settings-title .badge-tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  background: rgba(255, 122, 0, 0.15);
  border: 1px solid var(--border-accent);
  color: var(--accent-orange);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-weight: 600;
  text-transform: uppercase;
}

.profile-settings-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .profile-settings-layout {
    grid-template-columns: 1fr;
  }
}

/* Sidebar Card: Avatar & Account Summary */
.profile-sidebar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.profile-sidebar-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-orange), #ff9500);
}

.avatar-edit-container {
  position: relative;
  margin-bottom: 1.25rem;
}

.avatar-image-wrap {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--border-accent);
  background: var(--bg-surface-elevated);
  box-shadow: 0 0 25px var(--accent-orange-glow);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-badge-preview {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-orange);
  color: #000000;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.avatar-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.75rem;
}

.avatar-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid var(--border-medium);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  width: 100%;
}

.avatar-action-btn:hover {
  border-color: var(--accent-orange);
  color: var(--accent-orange);
  background: var(--bg-surface-hover);
}

.avatar-action-btn.btn-remove-avatar {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  font-size: 0.775rem;
}

.avatar-action-btn.btn-remove-avatar:hover {
  color: var(--color-danger);
}

.avatar-file-input {
  display: none;
}

.sidebar-user-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin-top: 0.5rem;
}

.sidebar-user-handle {
  font-size: 0.85rem;
  color: var(--accent-orange);
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.sidebar-scores-list {
  width: 100%;
  margin: 1.25rem 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.sidebar-score-label {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sidebar-score-val {
  font-weight: 700;
  color: #ffffff;
}

.server-controlled-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-subtle);
  margin-top: 0.25rem;
  line-height: 1.4;
  text-align: left;
}

/* Main Form Container */
.profile-form-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.profile-tabs-nav {
  display: flex;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.5rem 1rem 0 1rem;
  gap: 0.5rem;
  overflow-x: auto;
}

.profile-tab-btn {
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.profile-tab-btn:hover {
  color: #ffffff;
}

.profile-tab-btn.active {
  color: var(--accent-orange);
  border-bottom-color: var(--accent-orange);
}

.profile-tab-pane {
  padding: 2rem;
  display: none;
}

.profile-tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

.form-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-section-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.profile-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

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

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

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.field-label .badge-optional {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

.field-input, .field-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: #ffffff;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

.field-input:focus, .field-textarea:focus {
  outline: none;
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 3px var(--accent-orange-subtle);
}

.field-input:disabled, .field-input[readonly] {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  cursor: not-allowed;
  border-color: var(--border-subtle);
}

.field-textarea {
  resize: vertical;
  min-height: 100px;
}

.field-hint {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.field-prefix-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-prefix {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.field-input.has-prefix {
  padding-left: 2.25rem;
}

/* Wallet Card Display */
.wallet-identity-card {
  background: linear-gradient(145deg, #161622 0%, #0d0d14 100%);
  border: 1px solid rgba(255, 122, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.wallet-identity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.wallet-identity-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-orange);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.wallet-identity-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-weight: 600;
}

.wallet-address-display-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.wallet-address-text {
  font-family: monospace;
  font-size: 0.9rem;
  color: #ffffff;
  letter-spacing: 0.03em;
  word-break: break-all;
  flex: 1;
}

.btn-copy-address {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-copy-address:hover {
  border-color: var(--accent-orange);
  color: var(--accent-orange);
}

/* Form Actions Bar */
.profile-actions-bar {
  padding: 1.25rem 2rem;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.unsaved-warning {
  font-size: 0.825rem;
  color: var(--color-warning);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.unsaved-warning.visible {
  opacity: 1;
}

.actions-buttons-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Loading State for Buttons */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  top: 50%;
  left: 50%;
  margin-top: -7px;
  margin-left: -7px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
