.profile-page {
  margin-top: 16px;
  position: relative;
  z-index: 2;
}

.profile-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
}

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

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

.profile-card {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(160deg, rgba(18, 24, 40, 0.88), rgba(9, 12, 20, 0.96));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  padding: 20px;
  overflow: hidden;
  position: relative;
}

.profile-card::after {
  content: "";
  position: absolute;
  inset: -30%;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.06) 48%, transparent 62%);
  transform: translateX(-45%);
  animation: sheen 28s linear infinite;
  pointer-events: none;
}

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.profile-avatar-wrapper {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid rgba(214, 176, 122, 0.5);
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #7a92b8, #2f3b56);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.profile-avatar-img.has-image {
  display: block;
}

.profile-avatar-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.4);
}

.profile-avatar-placeholder svg {
  width: 50px;
  height: 50px;
}

.profile-avatar-placeholder.hidden {
  display: none;
}

.profile-avatar-actions {
  display: flex;
  gap: 8px;
}

.avatar-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(214, 176, 122, 0.4);
  background: rgba(12, 16, 28, 0.8);
  color: var(--accent-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.avatar-upload-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(214, 176, 122, 0.7);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

.avatar-upload-btn input {
  display: none;
}

.avatar-upload-btn svg {
  width: 14px;
  height: 14px;
}

.profile-user-info {
  text-align: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 1;
}

.profile-display-name {
  font-family: "Cinzel", serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-3);
  margin-bottom: 4px;
}

.profile-display-title {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 1;
}

.profile-stat {
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  background: rgba(10, 14, 26, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.profile-tokens {
  margin-top: 16px;
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(214, 176, 122, 0.12), rgba(196, 138, 68, 0.08));
  border: 1px solid rgba(214, 176, 122, 0.3);
  position: relative;
  z-index: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-tokens::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(214, 176, 122, 0.15), transparent 60%);
  pointer-events: none;
}

.profile-tokens::after {
  content: "";
  position: absolute;
  inset: -50%;
  background: linear-gradient(120deg, transparent 40%, rgba(255, 255, 255, 0.08) 50%, transparent 60%);
  transform: translateX(-100%);
  animation: tokensSheenProfile 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes tokensSheenProfile {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

.tokens-icon-large {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(214, 176, 122, 0.3), rgba(196, 138, 68, 0.2));
  border: 1px solid rgba(214, 176, 122, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 1;
}

.tokens-icon-large svg {
  width: 32px;
  height: 32px;
  color: var(--accent-3);
  filter: drop-shadow(0 0 8px rgba(214, 176, 122, 0.6));
}

.tokens-info-large {
  flex: 1;
  position: relative;
  z-index: 1;
}

.tokens-label-large {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 4px;
}

.tokens-value-large {
  font-family: "Cinzel", serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--accent-3);
  text-shadow: 0 0 30px rgba(214, 176, 122, 0.6);
  line-height: 1;
}

.tokens-info-large .tokens-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 6px;
}

.tokens-info-large .tokens-value {
  font-family: "Cinzel", serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-3);
  text-shadow: 0 0 20px rgba(214, 176, 122, 0.4);
}

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

.profile-form-card {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(160deg, rgba(18, 24, 40, 0.88), rgba(9, 12, 20, 0.96));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.profile-form-card::after {
  content: "";
  position: absolute;
  inset: -30%;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.06) 48%, transparent 62%);
  transform: translateX(-45%);
  animation: sheen 28s linear infinite;
  pointer-events: none;
}

.profile-form-header {
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.profile-form-header h2 {
  font-family: "Cinzel", serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-3);
  margin-bottom: 6px;
}

.profile-form-header p {
  font-size: 13px;
  color: var(--muted);
}

.profile-form {
  display: grid;
  gap: 16px;
  position: relative;
  z-index: 1;
}

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

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

@media (max-width: 768px) {
  .profile-form-grid,
  .profile-form-grid-3 {
    grid-template-columns: 1fr;
  }
}

.profile-field {
  display: grid;
  gap: 8px;
}

.profile-field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.profile-field input,
.profile-field textarea,
.profile-field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 14, 26, 0.7);
  color: var(--text);
  font-size: 13px;
  font-family: "Manrope", system-ui, sans-serif;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-field input:focus,
.profile-field textarea:focus,
.profile-field select:focus {
  outline: none;
  border-color: rgba(214, 176, 122, 0.5);
  box-shadow: 0 0 0 3px rgba(214, 176, 122, 0.15);
}

.profile-field input::placeholder,
.profile-field textarea::placeholder {
  color: rgba(167, 177, 201, 0.5);
}

.profile-field select {
  cursor: pointer;
}

.profile-field select option {
  background: #0b1020;
  color: var(--text);
}

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

.field-hint {
  font-size: 10px;
  color: var(--muted);
  text-align: right;
}

.profile-form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
}

.save-status {
  font-size: 12px;
  color: var(--muted);
}

.save-status.success {
  color: #6ddb8a;
}

.save-status.error {
  color: #e57373;
}

.save-status.loading {
  color: var(--accent);
}

.profile-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 1;
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(200, 80, 80, 0.3);
  background: rgba(80, 20, 20, 0.5);
  color: rgba(255, 180, 180, 0.9);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.logout-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(200, 80, 80, 0.6);
  background: rgba(100, 30, 30, 0.6);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

.logout-btn svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 768px) {
  .profile-form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .save-status {
    text-align: center;
  }
}

@keyframes sheen {
  0% {
    transform: translateX(-45%);
  }
  50% {
    transform: translateX(20%);
  }
  100% {
    transform: translateX(60%);
  }
}
