/* ===== Profile layout ===== */
.profile-layout {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: flex;
  gap: 40px;
  min-height: 60vh;
}

/* ===== Sidebar ===== */
.profile-sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-sidebar__user {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--separador);
  margin-bottom: 8px;
}

.profile-sidebar__avatar {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: var(--brillo1);
  flex-shrink: 0;
}

.profile-sidebar__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-sidebar__avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 18px;
  font-weight: 700;
  color: var(--azul);
  background: var(--separador);
}

.profile-sidebar__avatar-overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
  color: var(--text-on-primary);
  font-size: 10px;
}

.profile-sidebar__avatar:hover .profile-sidebar__avatar-overlay {
  opacity: 1;
}

.profile-sidebar__avatar input[type="file"] {
  display: none;
}

.profile-sidebar__info {
  min-width: 0;
}

.profile-sidebar__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--negro2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-sidebar__email {
  font-size: 12px;
  color: var(--gris-claro1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar nav links */
.profile-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--gris-claro1);
  cursor: pointer;
  transition: color var(--transition-fast), background-color var(--transition-fast);
  white-space: nowrap;
}

.profile-sidebar__link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.profile-sidebar__link:hover {
  color: var(--negro2);
  background: var(--brillo1);
  text-decoration: none;
}

.profile-sidebar__link:hover svg {
  opacity: 1;
}

.profile-sidebar__link--active {
  color: var(--azul);
  background: var(--separador);
}

.profile-sidebar__link--active svg {
  opacity: 1;
}

.profile-sidebar__link--active:hover {
  color: var(--azul);
  background: var(--separador);
}

.profile-sidebar__separator {
  height: 1px;
  background: var(--separador);
  margin: 8px 0;
}

.profile-sidebar__link--danger {
  color: var(--rojo);
}

.profile-sidebar__link--danger:hover {
  background: rgba(237, 0, 0, 0.06);
  color: var(--rojo);
}

/* ===== Main content area ===== */
.profile-main {
  flex: 1;
  min-width: 0;
}

.profile-main__header {
  margin-bottom: 32px;
}

.profile-main__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--negro2);
  margin-bottom: 4px;
}

.profile-main__subtitle {
  font-size: 14px;
  color: var(--gris-claro1);
}

/* ===== Profile content sections ===== */
.profile__section {
  display: none;
}

.profile__section--active {
  display: block;
}

/* ===== Account & Password forms ===== */
.profile-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--separador);
  padding: 28px;
}

.profile-card + .profile-card {
  margin-top: 20px;
}

.profile-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--negro2);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--separador);
}

.profile-card__fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-card__row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-card__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gris-claro1);
}

.profile-card__input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--gris-claro2);
  border-radius: var(--radius-sm);
  background: var(--celeste);
  color: var(--negro2);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
}

.profile-card__input:focus {
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: var(--surface);
}

.profile-card__input::placeholder {
  color: var(--gris-claro2);
}

.profile-card__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--separador);
}

.profile-card__btn {
  padding: 9px 24px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.profile-card__btn--primary {
  background: var(--azul);
  color: var(--text-on-primary);
}

.profile-card__btn--primary:hover {
  background: var(--btn-primary-hover);
}

.profile-card__error {
  font-size: 12px;
  color: var(--rojo);
  margin-top: 4px;
}

/* ===== Large avatar display on profile ===== */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 36px;
  padding: 24px 28px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--separador);
}

.profile-hero__avatar {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: var(--brillo1);
  flex-shrink: 0;
}

.profile-hero__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-hero__avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 28px;
  font-weight: 700;
  color: var(--azul);
  background: var(--separador);
}

.profile-hero__avatar-overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
  color: var(--text-on-primary);
  font-size: 12px;
  font-weight: 500;
}

.profile-hero__avatar:hover .profile-hero__avatar-overlay {
  opacity: 1;
}

.profile-hero__avatar input[type="file"] {
  display: none;
}

.profile-hero__info {
  min-width: 0;
}

.profile-hero__name {
  font-size: 20px;
  font-weight: 700;
  color: var(--negro2);
  word-break: break-word;
}

.profile-hero__email {
  font-size: 14px;
  color: var(--gris-claro1);
  margin-top: 2px;
  word-break: break-all;
}

.profile-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--azul);
  background: var(--separador);
  border-radius: 20px;
}

/* ===== Responsive ===== */
@media screen and (max-width: 768px) {
  .profile-layout {
    flex-direction: column;
    padding: 24px 16px 64px;
    gap: 24px;
  }

  .profile-sidebar {
    width: 100%;
    flex-direction: column;
  }

  .profile-sidebar__user {
    padding-bottom: 16px;
  }

  .profile-sidebar__nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .profile-sidebar__nav::-webkit-scrollbar {
    display: none;
  }

  .profile-sidebar__link {
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 13px;
    flex-shrink: 0;
  }

  .profile-sidebar__link svg {
    display: none;
  }

  .profile-sidebar__separator {
    display: none;
  }

  .profile-hero {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
  }

  .profile-card {
    padding: 20px 16px;
  }

  .profile-card__actions {
    justify-content: stretch;
  }

  .profile-card__btn {
    width: 100%;
    text-align: center;
  }

  .profile-main__title {
    font-size: 20px;
  }
}

@media screen and (max-width: 400px) {
  .profile-layout {
    padding: 16px 12px 48px;
  }

  .profile-card {
    padding: 16px 12px;
  }

  .profile-hero {
    padding: 20px 16px;
  }

  .profile-hero__avatar {
    width: 64px;
    height: 64px;
  }

  .profile-hero__name {
    font-size: 18px;
  }
}
